Skip to content

Commit

Permalink
Add immutability tests (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
samdark authored Aug 17, 2024
1 parent ceec9d7 commit 5c6f36e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/FileRouterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,17 @@ public function testModularityFastPath(): void
$router->process($request, $handler);
}

public function testImmutability(): void
{
$router = $this->createRouter();

$this->assertNotSame($router, $router->withBaseControllerDirectory('x'));
$this->assertNotSame($router, $router->withClassPostfix('x'));
$this->assertNotSame($router, $router->withNamespace('x'));
$this->assertNotSame($router, $router->withDefaultControllerName('x'));
$this->assertNotSame($router, $router->withRoutePrefix('x'));
}

private function createRouter(): FileRouter
{
$container = new SimpleContainer([
Expand Down

0 comments on commit 5c6f36e

Please sign in to comment.