From 4459eccc0fe7675662352641d115cd23879766c2 Mon Sep 17 00:00:00 2001 From: thangnn Date: Fri, 22 Nov 2024 14:14:32 +0700 Subject: [PATCH] Add unitTest_BcPlugin_frontPageRouting --- plugins/baser-core/src/BcPlugin.php | 1 + .../baser-core/tests/TestCase/BcPluginTest.php | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/plugins/baser-core/src/BcPlugin.php b/plugins/baser-core/src/BcPlugin.php index 9560e58a1c..7c6422ddb0 100644 --- a/plugins/baser-core/src/BcPlugin.php +++ b/plugins/baser-core/src/BcPlugin.php @@ -494,6 +494,7 @@ function(RouteBuilder $routes) { * @return RouteBuilder * @checked * @noTodo + * @unitTest */ public function frontPageRouting(RouteBuilder $routes, string $plugin) { diff --git a/plugins/baser-core/tests/TestCase/BcPluginTest.php b/plugins/baser-core/tests/TestCase/BcPluginTest.php index 34218a84b2..7989099a11 100644 --- a/plugins/baser-core/tests/TestCase/BcPluginTest.php +++ b/plugins/baser-core/tests/TestCase/BcPluginTest.php @@ -576,6 +576,24 @@ public function test_applyAsTheme() $this->assertEquals($updateTheme, $site->theme); } + /** + * test frontPageRouting + */ + public function testFrontPageRouting() + { + // 管理画面のプラグイン用ルーティング + $result = Router::parseRequest($this->getRequest('/baser/admin/bc-blog/blog_contents/index')); + $this->assertEquals('BlogContents', $result['controller']); + $result = Router::parseRequest($this->getRequest('/baser/admin/bc-blog/blog_contents/edit/1')); + $this->assertEquals('BlogContents', $result['controller']); + + // フロントエンドのプラグイン用ルーティング + $result = Router::parseRequest($this->getRequest('/bc-blog/blog_contents/index')); + $this->assertEquals('BlogContents', $result['controller']); + $result = Router::parseRequest($this->getRequest('/bc-blog/blog_contents/edit/1')); + $this->assertEquals('BlogContents', $result['controller']); + } + /** * test Rest API */