-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add unitTest_UploaderConfigsController_index
- Loading branch information
thangnn
committed
May 15, 2024
1 parent
74b7c6f
commit 200d0ed
Showing
2 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
plugins/bc-uploader/tests/TestCase/Controller/Admin/UploaderConfigsControllerTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
namespace BcUploader\Test\TestCase\Controller\Admin; | ||
|
||
use BaserCore\Test\Scenario\InitAppScenario; | ||
use BaserCore\TestSuite\BcTestCase; | ||
use BcUploader\Controller\Admin\UploaderConfigsController; | ||
use Cake\TestSuite\IntegrationTestTrait; | ||
use CakephpFixtureFactories\Scenario\ScenarioAwareTrait; | ||
|
||
class UploaderConfigsControllerTest extends BcTestCase | ||
{ | ||
use ScenarioAwareTrait; | ||
use IntegrationTestTrait; | ||
|
||
public function setUp(): void | ||
{ | ||
parent::setUp(); | ||
$this->loadFixtureScenario(InitAppScenario::class); | ||
$this->UploaderConfigsController = new UploaderConfigsController($this->loginAdmin($this->getRequest())); | ||
} | ||
|
||
public function tearDown(): void | ||
{ | ||
parent::tearDown(); | ||
} | ||
|
||
/** | ||
* test index | ||
*/ | ||
public function test_index() | ||
{ | ||
$this->enableSecurityToken(); | ||
$this->enableCsrfToken(); | ||
|
||
//正常系実行 | ||
$this->get("/baser/admin/bc-uploader/uploader_configs/index"); | ||
$this->assertResponseCode(200); | ||
|
||
$this->post("/baser/admin/bc-uploader/uploader_configs/index", ['name_add' => 'value_add']); | ||
$this->assertResponseCode(302); | ||
$this->assertFlashMessage('アップローダー設定を保存しました。'); | ||
$this->assertRedirect("/baser/admin/bc-uploader/uploader_configs/index"); | ||
} | ||
} |