From 5a434e782f27f0b74d13a3b6d5a7153b6dbfa757 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90=E1=BB=97=20V=C4=83n=20H=C3=B9ng?= Date: Mon, 16 Oct 2023 12:29:02 +0700 Subject: [PATCH] =?UTF-8?q?admin/ThemeFilesController::view=20=E3=81=AE?= =?UTF-8?q?=E3=83=A6=E3=83=8B=E3=83=83=E3=83=88=E3=83=86=E3=82=B9=E3=83=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/Admin/ThemeFilesController.php | 1 + .../Admin/ThemeFilesControllerTest.php | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/plugins/bc-theme-file/src/Controller/Admin/ThemeFilesController.php b/plugins/bc-theme-file/src/Controller/Admin/ThemeFilesController.php index 86f41d1f2d..447fe4bbe4 100644 --- a/plugins/bc-theme-file/src/Controller/Admin/ThemeFilesController.php +++ b/plugins/bc-theme-file/src/Controller/Admin/ThemeFilesController.php @@ -279,6 +279,7 @@ public function delete_folder(ThemeFoldersAdminServiceInterface $service) * @return void * @checked * @noTodo + * @unitTest */ public function view(ThemeFilesAdminServiceInterface $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 3010912908..8aec89a0d3 100644 --- a/plugins/bc-theme-file/tests/TestCase/Controller/Admin/ThemeFilesControllerTest.php +++ b/plugins/bc-theme-file/tests/TestCase/Controller/Admin/ThemeFilesControllerTest.php @@ -220,7 +220,21 @@ public function test_delete_folder() */ public function test_view() { - $this->markTestIncomplete('このテストは未実装です。'); + //準備 + $this->enableSecurityToken(); + $this->enableCsrfToken(); + //GETメソッドを検証場合 + $this->get('/baser/admin/bc-theme-file/theme_files/view/BcThemeSample/layout/default.php'); + //ステータスを確認 + $this->assertResponseCode(200); + //取得データを確認 + $pageTitle = $this->_controller->viewBuilder()->getVars()['pageTitle']; + $this->assertEquals('BcThemeSample|レイアウトテンプレート表示', $pageTitle); + + //エラーを発生した場合 + $this->get('/baser/admin/bc-theme-file/theme_files/view/BcThemeSample/layout3/default.php'); + //ステータスを確認 + $this->assertResponseCode(404); } /**