diff --git a/plugins/bc-theme-file/src/Controller/Admin/ThemeFilesController.php b/plugins/bc-theme-file/src/Controller/Admin/ThemeFilesController.php index 4367e5d966..43e2a86e09 100644 --- a/plugins/bc-theme-file/src/Controller/Admin/ThemeFilesController.php +++ b/plugins/bc-theme-file/src/Controller/Admin/ThemeFilesController.php @@ -248,6 +248,7 @@ public function delete(ThemeFilesAdminServiceInterface $service) * @return void * @checked * @noTodo + * @unitTest */ public function delete_folder(ThemeFoldersAdminServiceInterface $service) { diff --git a/plugins/bc-theme-file/tests/TestCase/Controller/Admin/ThemeFilesControllerTest.php b/plugins/bc-theme-file/tests/TestCase/Controller/Admin/ThemeFilesControllerTest.php index f32d8d9fbe..4dc0bd8c8c 100644 --- a/plugins/bc-theme-file/tests/TestCase/Controller/Admin/ThemeFilesControllerTest.php +++ b/plugins/bc-theme-file/tests/TestCase/Controller/Admin/ThemeFilesControllerTest.php @@ -13,6 +13,7 @@ use BaserCore\Test\Scenario\InitAppScenario; use BaserCore\TestSuite\BcTestCase; use BaserCore\Utility\BcContainerTrait; +use BaserCore\Utility\BcFolder; use BcThemeFile\Controller\Admin\ThemeFilesController; use CakephpFixtureFactories\Scenario\ScenarioAwareTrait; @@ -132,7 +133,20 @@ public function test_delete() */ public function test_delete_folder() { - $this->markTestIncomplete('このテストは未実装です。'); + $this->enableSecurityToken(); + $this->enableCsrfToken(); + //テストテーマフォルダを作成 + $fullpath = BASER_PLUGINS . 'BcThemeSample' . '/templates/layout'; + $folder = new BcFolder($fullpath . DS . 'delete_folder'); + $folder->create(); + //Postメソッドを検証場合 + $this->post('/baser/admin/bc-theme-file/theme_files/delete_folder/BcThemeSample/layout/delete_folder'); + //戻る値を確認 + $this->assertResponseCode(302); + $this->assertFlashMessage('フォルダ delete_folder を削除しました。'); + $this->assertRedirect('/baser/admin/bc-theme-file/theme_files/index/BcThemeSample/layout/'); + //実際にフォルダが削除されいてるか確認すること + $this->assertFalse(file_exists($fullpath . 'delete_folder')); } /**