From 9f69e67f31f7a1643ad3aa5bbb13475205ee4178 Mon Sep 17 00:00:00 2001 From: thangnn Date: Tue, 5 Nov 2024 11:22:31 +0700 Subject: [PATCH] Add unitTest_BcFrontAppController_beforeRender --- .../src/Controller/BcFrontAppController.php | 1 + .../TestCase/Controller/BcFrontAppControllerTest.php | 12 +++++------- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/plugins/baser-core/src/Controller/BcFrontAppController.php b/plugins/baser-core/src/Controller/BcFrontAppController.php index afa0637b86..4939ffcada 100644 --- a/plugins/baser-core/src/Controller/BcFrontAppController.php +++ b/plugins/baser-core/src/Controller/BcFrontAppController.php @@ -73,6 +73,7 @@ public function beforeFilter(EventInterface $event) * @param EventInterface $event * @checked * @noTodo + * @unitTest */ public function beforeRender(EventInterface $event): void { diff --git a/plugins/baser-core/tests/TestCase/Controller/BcFrontAppControllerTest.php b/plugins/baser-core/tests/TestCase/Controller/BcFrontAppControllerTest.php index ae24866337..02af962119 100644 --- a/plugins/baser-core/tests/TestCase/Controller/BcFrontAppControllerTest.php +++ b/plugins/baser-core/tests/TestCase/Controller/BcFrontAppControllerTest.php @@ -17,6 +17,7 @@ use BaserCore\TestSuite\BcTestCase; use BaserCore\Utility\BcContainer; use Cake\Core\Configure; +use Cake\Event\Event; use CakephpFixtureFactories\Scenario\ScenarioAwareTrait; /** @@ -95,14 +96,11 @@ public function testBeforeFilter() */ public function testBeforeRender() { - $this->markTestIncomplete('このテストはまだ実装されていません。'); - // TODO ucmitz 本体側の実装要 - /* >>> - $this->BcFrontAppController->setRequest($this->getRequest('/en/サイトID3の固定ページ')); + $this->BcFrontAppController->setRequest($this->getRequest()); $this->BcFrontAppController->beforeRender(new Event('beforeRender')); - $this->assertEquals('en', $this->BcFrontAppController->viewBuilder()->getLayoutPath()); - $this->assertEquals('en', $this->BcFrontAppController->viewBuilder()->getTemplatePath()); - <<< */ + $viewBuilder = $this->BcFrontAppController->viewBuilder(); + $this->assertEquals('BaserCore.BcFrontApp', $viewBuilder->getClassName()); + $this->assertEquals('BcFront', $viewBuilder->getTheme()); } }