Skip to content

Commit a1f2c50

Browse files
committed
test: fix some test case errors.
1 parent c780a23 commit a1f2c50

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

tests/system/Router/RouteCollectionTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1680,6 +1680,8 @@ public function testAutoRoutesControllerNameReturnsFQCN($namespace): void
16801680
$routes->setAutoRoute(true);
16811681
$routes->setDefaultNamespace($namespace);
16821682

1683+
$this->expectException(PageNotFoundException::class);
1684+
16831685
$router = new Router($routes, Services::request());
16841686
$router->handle('/product');
16851687

tests/system/Router/RouterTest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,9 @@ public function testAutoRouteFindsDefaultControllerAndMethod(): void
199199
$this->collection->setAutoRoute(true);
200200
$this->collection->setDefaultController('Test');
201201
$this->collection->setDefaultMethod('test');
202+
203+
$this->expectException(PageNotFoundException::class);
204+
202205
$router = new Router($this->collection, $this->request);
203206

204207
$router->autoRoute('/');
@@ -210,6 +213,9 @@ public function testAutoRouteFindsDefaultControllerAndMethod(): void
210213
public function testAutoRouteFindsControllerWithFileAndMethod(): void
211214
{
212215
$this->collection->setAutoRoute(true);
216+
217+
$this->expectException(PageNotFoundException::class);
218+
213219
$router = new Router($this->collection, $this->request);
214220

215221
$router->autoRoute('myController/someMethod');
@@ -221,6 +227,9 @@ public function testAutoRouteFindsControllerWithFileAndMethod(): void
221227
public function testAutoRouteFindsControllerWithFile(): void
222228
{
223229
$this->collection->setAutoRoute(true);
230+
231+
$this->expectException(PageNotFoundException::class);
232+
224233
$router = new Router($this->collection, $this->request);
225234

226235
$router->autoRoute('myController');
@@ -232,6 +241,7 @@ public function testAutoRouteFindsControllerWithFile(): void
232241
public function testAutoRouteFindsControllerWithSubfolder(): void
233242
{
234243
$this->collection->setAutoRoute(true);
244+
235245
$router = new Router($this->collection, $this->request);
236246

237247
mkdir(APPPATH . 'Controllers/Subfolder');
@@ -734,6 +744,9 @@ public function testTranslateURIDashesForParams(): void
734744
public function testTranslateURIDashesForAutoRoute(): void
735745
{
736746
$this->collection->setAutoRoute(true);
747+
748+
$this->expectException(PageNotFoundException::class);
749+
737750
$router = new Router($this->collection, $this->request);
738751
$router->setTranslateURIDashes(true);
739752

@@ -749,6 +762,9 @@ public function testTranslateURIDashesForAutoRoute(): void
749762
public function testAutoRouteMatchesZeroParams(): void
750763
{
751764
$this->collection->setAutoRoute(true);
765+
766+
$this->expectException(PageNotFoundException::class);
767+
752768
$router = new Router($this->collection, $this->request);
753769

754770
$router->autoRoute('myController/someMethod/0/abc');
@@ -769,6 +785,9 @@ public function testAutoRouteMatchesZeroParams(): void
769785
public function testAutoRouteMethodEmpty(): void
770786
{
771787
$this->collection->setAutoRoute(true);
788+
789+
$this->expectException(PageNotFoundException::class);
790+
772791
$router = new Router($this->collection, $this->request);
773792
$this->collection->setAutoRoute(true);
774793

@@ -820,6 +839,9 @@ public function testRegularExpressionPlaceholderWithUnicode(): void
820839
public function testRouterPriorDirectory(): void
821840
{
822841
$this->collection->setAutoRoute(true);
842+
843+
$this->expectException(PageNotFoundException::class);
844+
823845
$router = new Router($this->collection, $this->request);
824846

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

0 commit comments

Comments
 (0)