Skip to content

Commit

Permalink
test: add test for translateUriToCamelCase and Default Method Fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Jun 21, 2024
1 parent 53bfdef commit 29e5fab
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/system/Router/AutoRouterImprovedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,28 @@ public function testAutoRouteFallbackToDefaultMethod(): void
], $router->getPos());
}

public function testAutoRouteFallbackToDefaultMethodWithTranslateUriToCamelCase(): void
{
$config = config(Routing::class);
$config->translateUriToCamelCase = true;
Factories::injectMock('config', Routing::class, $config);

$router = $this->createNewAutoRouter();

[$directory, $controller, $method, $params]
= $router->getRoute('index/15', Method::GET);

$this->assertNull($directory);
$this->assertSame('\\' . Index::class, $controller);
$this->assertSame('getIndex', $method);
$this->assertSame(['15'], $params);
$this->assertSame([
'controller' => 0,
'method' => null,
'params' => 1,
], $router->getPos());
}

public function testAutoRouteFallbackToDefaultControllerOneParam(): void
{
$router = $this->createNewAutoRouter();
Expand Down

0 comments on commit 29e5fab

Please sign in to comment.