diff --git a/plugins/baser-core/src/BcPlugin.php b/plugins/baser-core/src/BcPlugin.php index 9560e58a1c..8025189477 100644 --- a/plugins/baser-core/src/BcPlugin.php +++ b/plugins/baser-core/src/BcPlugin.php @@ -466,6 +466,7 @@ public function routes(RouteBuilder $routes): void * @return RouteBuilder * @checked * @noTodo + * @unitTest */ public function contentsRoutingForReverse(RouteBuilder $routes, string $plugin) { diff --git a/plugins/baser-core/tests/TestCase/BcPluginTest.php b/plugins/baser-core/tests/TestCase/BcPluginTest.php index 34218a84b2..6fbf64c349 100644 --- a/plugins/baser-core/tests/TestCase/BcPluginTest.php +++ b/plugins/baser-core/tests/TestCase/BcPluginTest.php @@ -646,4 +646,24 @@ public function testRestApi() $this->assertEquals(0, count($result->pages)); } + /** + * test contentsRoutingForReverse + */ + public function testContentsRoutingForReverse() + { + SiteFactory::make(['id' => '1', 'main_site_id' => null])->persist(); + SiteFactory::make(['id' => '2', 'main_site_id' => 1, 'alias' => 's'])->persist(); + ContentFactory::make(['plugin' => 'BcBlog', 'type' => 'BlogContent', 'entity_id' => 31, 'url' => '/news/', 'site_id' => 1])->persist(); + $this->BcPlugin = new BcPlugin(['name' => 'BcBlog']); + $routes = Router::createRouteBuilder('/'); + $this->BcPlugin->routes($routes); + $this->getRequest('/'); + $this->assertEquals('/news/', Router::url([ + 'plugin' => 'BcBlog', + 'controller' => 'Blog', + 'action' => 'index', + 'entityId' => 31 + ])); + } + }