diff --git a/plugins/bc-installer/src/Controller/Admin/InstallationsController.php b/plugins/bc-installer/src/Controller/Admin/InstallationsController.php index 59c5c9402f..79b0f2ac0f 100644 --- a/plugins/bc-installer/src/Controller/Admin/InstallationsController.php +++ b/plugins/bc-installer/src/Controller/Admin/InstallationsController.php @@ -79,6 +79,7 @@ public function index() * @return void * @noTodo * @checked + * @unitTest */ public function step2(InstallationsAdminServiceInterface $service) { diff --git a/plugins/bc-installer/tests/TestCase/Controller/Admin/InstallationsControllerTest.php b/plugins/bc-installer/tests/TestCase/Controller/Admin/InstallationsControllerTest.php index 15c6f3af42..5ede67e6f7 100644 --- a/plugins/bc-installer/tests/TestCase/Controller/Admin/InstallationsControllerTest.php +++ b/plugins/bc-installer/tests/TestCase/Controller/Admin/InstallationsControllerTest.php @@ -10,9 +10,12 @@ */ namespace BcInstaller\Test\TestCase\Controller\Admin; +use BaserCore\Test\Scenario\InitAppScenario; use BaserCore\TestSuite\BcTestCase; use BcInstaller\Controller\Admin\InstallationsController; +use Cake\Core\Configure; use Cake\Event\Event; +use CakephpFixtureFactories\Scenario\ScenarioAwareTrait; /** * Class InstallationsControllerTest @@ -21,6 +24,7 @@ */ class InstallationsControllerTest extends BcTestCase { + use ScenarioAwareTrait; /** /** @@ -29,6 +33,8 @@ class InstallationsControllerTest extends BcTestCase public function setUp(): void { parent::setUp(); + $this->loadFixtureScenario(InitAppScenario::class); + $this->loginAdmin($this->getRequest()); } /** @@ -65,7 +71,18 @@ public function testIndex() */ public function testStep2() { - $this->markTestIncomplete('このテストは、まだ実装されていません。'); + $this->enableSecurityToken(); + $this->enableCsrfToken(); + + Configure::write("BcEnv.isInstalled", false); + + $this->get('/baser/admin/bc-installer/installations/step2'); + $this->assertResponseCode(200); + + $this->post('/baser/admin/bc-installer/installations/step2', ['mode'=>'next']); + $this->assertResponseCode(302); + + Configure::write("BcEnv.isInstalled", true); } /**