Skip to content

Commit

Permalink
test: fix some test case errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
ping-yee committed Sep 22, 2023
1 parent c780a23 commit a1f2c50
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/system/Router/RouteCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1680,6 +1680,8 @@ public function testAutoRoutesControllerNameReturnsFQCN($namespace): void
$routes->setAutoRoute(true);
$routes->setDefaultNamespace($namespace);

$this->expectException(PageNotFoundException::class);

$router = new Router($routes, Services::request());
$router->handle('/product');

Expand Down
22 changes: 22 additions & 0 deletions tests/system/Router/RouterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@ public function testAutoRouteFindsDefaultControllerAndMethod(): void
$this->collection->setAutoRoute(true);
$this->collection->setDefaultController('Test');
$this->collection->setDefaultMethod('test');

$this->expectException(PageNotFoundException::class);

$router = new Router($this->collection, $this->request);

$router->autoRoute('/');
Expand All @@ -210,6 +213,9 @@ public function testAutoRouteFindsDefaultControllerAndMethod(): void
public function testAutoRouteFindsControllerWithFileAndMethod(): void
{
$this->collection->setAutoRoute(true);

$this->expectException(PageNotFoundException::class);

$router = new Router($this->collection, $this->request);

$router->autoRoute('myController/someMethod');
Expand All @@ -221,6 +227,9 @@ public function testAutoRouteFindsControllerWithFileAndMethod(): void
public function testAutoRouteFindsControllerWithFile(): void
{
$this->collection->setAutoRoute(true);

$this->expectException(PageNotFoundException::class);

$router = new Router($this->collection, $this->request);

$router->autoRoute('myController');
Expand All @@ -232,6 +241,7 @@ public function testAutoRouteFindsControllerWithFile(): void
public function testAutoRouteFindsControllerWithSubfolder(): void
{
$this->collection->setAutoRoute(true);

$router = new Router($this->collection, $this->request);

mkdir(APPPATH . 'Controllers/Subfolder');
Expand Down Expand Up @@ -734,6 +744,9 @@ public function testTranslateURIDashesForParams(): void
public function testTranslateURIDashesForAutoRoute(): void
{
$this->collection->setAutoRoute(true);

$this->expectException(PageNotFoundException::class);

$router = new Router($this->collection, $this->request);
$router->setTranslateURIDashes(true);

Expand All @@ -749,6 +762,9 @@ public function testTranslateURIDashesForAutoRoute(): void
public function testAutoRouteMatchesZeroParams(): void
{
$this->collection->setAutoRoute(true);

$this->expectException(PageNotFoundException::class);

$router = new Router($this->collection, $this->request);

$router->autoRoute('myController/someMethod/0/abc');
Expand All @@ -769,6 +785,9 @@ public function testAutoRouteMatchesZeroParams(): void
public function testAutoRouteMethodEmpty(): void
{
$this->collection->setAutoRoute(true);

$this->expectException(PageNotFoundException::class);

$router = new Router($this->collection, $this->request);
$this->collection->setAutoRoute(true);

Expand Down Expand Up @@ -820,6 +839,9 @@ public function testRegularExpressionPlaceholderWithUnicode(): void
public function testRouterPriorDirectory(): void
{
$this->collection->setAutoRoute(true);

$this->expectException(PageNotFoundException::class);

$router = new Router($this->collection, $this->request);

$router->setDirectory('foo/bar/baz', false, true);
Expand Down

0 comments on commit a1f2c50

Please sign in to comment.