Skip to content

Commit 29e5fab

Browse files
committed
test: add test for translateUriToCamelCase and Default Method Fallback
1 parent 53bfdef commit 29e5fab

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/system/Router/AutoRouterImprovedTest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,28 @@ public function testAutoRouteFallbackToDefaultMethod(): void
277277
], $router->getPos());
278278
}
279279

280+
public function testAutoRouteFallbackToDefaultMethodWithTranslateUriToCamelCase(): void
281+
{
282+
$config = config(Routing::class);
283+
$config->translateUriToCamelCase = true;
284+
Factories::injectMock('config', Routing::class, $config);
285+
286+
$router = $this->createNewAutoRouter();
287+
288+
[$directory, $controller, $method, $params]
289+
= $router->getRoute('index/15', Method::GET);
290+
291+
$this->assertNull($directory);
292+
$this->assertSame('\\' . Index::class, $controller);
293+
$this->assertSame('getIndex', $method);
294+
$this->assertSame(['15'], $params);
295+
$this->assertSame([
296+
'controller' => 0,
297+
'method' => null,
298+
'params' => 1,
299+
], $router->getPos());
300+
}
301+
280302
public function testAutoRouteFallbackToDefaultControllerOneParam(): void
281303
{
282304
$router = $this->createNewAutoRouter();

0 commit comments

Comments
 (0)