Skip to content

Commit

Permalink
test: update test code
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Jun 6, 2023
1 parent 2abeb2c commit a7d37df
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions tests/system/Router/AutoRouterImprovedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function testAutoRouteFindsDefaultControllerAndMethodGet()
$router = $this->createNewAutoRouter();

[$directory, $controller, $method, $params]
= $router->getRoute('/');
= $router->getRoute('/', 'get');

$this->assertNull($directory);
$this->assertSame('\\' . Index::class, $controller);
Expand All @@ -72,7 +72,7 @@ public function testAutoRouteFindsDefaultControllerAndMethodPost()
$router = $this->createNewAutoRouter('post');

[$directory, $controller, $method, $params]
= $router->getRoute('/');
= $router->getRoute('/', 'post');

$this->assertNull($directory);
$this->assertSame('\\' . Index::class, $controller);
Expand All @@ -85,7 +85,7 @@ public function testAutoRouteFindsControllerWithFileAndMethod()
$router = $this->createNewAutoRouter();

[$directory, $controller, $method, $params]
= $router->getRoute('mycontroller/somemethod');
= $router->getRoute('mycontroller/somemethod', 'get');

$this->assertNull($directory);
$this->assertSame('\\' . Mycontroller::class, $controller);
Expand All @@ -98,7 +98,7 @@ public function testFindsControllerAndMethodAndParam()
$router = $this->createNewAutoRouter();

[$directory, $controller, $method, $params]
= $router->getRoute('mycontroller/somemethod/a');
= $router->getRoute('mycontroller/somemethod/a', 'get');

$this->assertNull($directory);
$this->assertSame('\\' . Mycontroller::class, $controller);
Expand All @@ -115,15 +115,15 @@ public function testUriParamCountIsGreaterThanMethodParams()

$router = $this->createNewAutoRouter();

$router->getRoute('mycontroller/somemethod/a/b');
$router->getRoute('mycontroller/somemethod/a/b', 'get');
}

public function testAutoRouteFindsControllerWithFile()
{
$router = $this->createNewAutoRouter();

[$directory, $controller, $method, $params]
= $router->getRoute('mycontroller');
= $router->getRoute('mycontroller', 'get');

$this->assertNull($directory);
$this->assertSame('\\' . Mycontroller::class, $controller);
Expand All @@ -136,7 +136,7 @@ public function testAutoRouteFindsControllerWithSubfolder()
$router = $this->createNewAutoRouter();

[$directory, $controller, $method, $params]
= $router->getRoute('subfolder/mycontroller/somemethod');
= $router->getRoute('subfolder/mycontroller/somemethod', 'get');

$this->assertSame('Subfolder/', $directory);
$this->assertSame('\\' . \CodeIgniter\Router\Controllers\Subfolder\Mycontroller::class, $controller);
Expand All @@ -149,7 +149,7 @@ public function testAutoRouteFindsDashedSubfolder()
$router = $this->createNewAutoRouter();

[$directory, $controller, $method, $params]
= $router->getRoute('dash-folder/mycontroller/somemethod');
= $router->getRoute('dash-folder/mycontroller/somemethod', 'get');

$this->assertSame('Dash_folder/', $directory);
$this->assertSame(
Expand All @@ -165,7 +165,7 @@ public function testAutoRouteFindsDashedController()
$router = $this->createNewAutoRouter();

[$directory, $controller, $method, $params]
= $router->getRoute('dash-folder/dash-controller/somemethod');
= $router->getRoute('dash-folder/dash-controller/somemethod', 'get');

$this->assertSame('Dash_folder/', $directory);
$this->assertSame('\\' . Dash_controller::class, $controller);
Expand All @@ -178,7 +178,7 @@ public function testAutoRouteFindsDashedMethod()
$router = $this->createNewAutoRouter();

[$directory, $controller, $method, $params]
= $router->getRoute('dash-folder/dash-controller/dash-method');
= $router->getRoute('dash-folder/dash-controller/dash-method', 'get');

$this->assertSame('Dash_folder/', $directory);
$this->assertSame('\\' . Dash_controller::class, $controller);
Expand All @@ -191,7 +191,7 @@ public function testAutoRouteFindsDefaultDashFolder()
$router = $this->createNewAutoRouter();

[$directory, $controller, $method, $params]
= $router->getRoute('dash-folder');
= $router->getRoute('dash-folder', 'get');

$this->assertSame('Dash_folder/', $directory);
$this->assertSame('\\' . Home::class, $controller);
Expand All @@ -205,7 +205,7 @@ public function testAutoRouteRejectsSingleDot()

$router = $this->createNewAutoRouter();

$router->getRoute('.');
$router->getRoute('.', 'get');
}

public function testAutoRouteRejectsDoubleDot()
Expand All @@ -214,7 +214,7 @@ public function testAutoRouteRejectsDoubleDot()

$router = $this->createNewAutoRouter();

$router->getRoute('..');
$router->getRoute('..', 'get');
}

public function testAutoRouteRejectsMidDot()
Expand All @@ -223,7 +223,7 @@ public function testAutoRouteRejectsMidDot()

$router = $this->createNewAutoRouter();

$router->getRoute('foo.bar');
$router->getRoute('foo.bar', 'get');
}

public function testRejectsDefaultControllerPath()
Expand All @@ -232,7 +232,7 @@ public function testRejectsDefaultControllerPath()

$router = $this->createNewAutoRouter();

$router->getRoute('home');
$router->getRoute('home', 'get');
}

public function testRejectsDefaultControllerAndDefaultMethodPath()
Expand All @@ -241,7 +241,7 @@ public function testRejectsDefaultControllerAndDefaultMethodPath()

$router = $this->createNewAutoRouter();

$router->getRoute('home/index');
$router->getRoute('home/index', 'get');
}

public function testRejectsDefaultMethodPath()
Expand All @@ -250,7 +250,7 @@ public function testRejectsDefaultMethodPath()

$router = $this->createNewAutoRouter();

$router->getRoute('mycontroller/index');
$router->getRoute('mycontroller/index', 'get');
}

public function testRejectsControllerWithRemapMethod()
Expand All @@ -262,6 +262,6 @@ public function testRejectsControllerWithRemapMethod()

$router = $this->createNewAutoRouter();

$router->getRoute('remap/test');
$router->getRoute('remap/test', 'get');
}
}

0 comments on commit a7d37df

Please sign in to comment.