Skip to content

Commit

Permalink
test: change the mock controller place.
Browse files Browse the repository at this point in the history
  • Loading branch information
ping-yee committed Oct 13, 2023
1 parent ec94928 commit 4727ce4
Show file tree
Hide file tree
Showing 12 changed files with 15 additions and 15 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions tests/system/Router/RouteCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1680,7 +1680,7 @@ public function testAutoRoutesControllerNameReturnsFQCN($namespace): void
$routes->setAutoRoute(true);
$routes->setDefaultNamespace($namespace);

copy(TESTPATH . 'system/Router/Controllers/App/Product.php', APPPATH . 'Controllers/Product.php');
copy(TESTPATH . '_support/_controller/Product.php', APPPATH . 'Controllers/Product.php');

$router = new Router($routes, Services::request());
$router->handle('/product');
Expand All @@ -1703,7 +1703,7 @@ public function testRoutesControllerNameReturnsFQCN($namespace): void
$routes->setDefaultNamespace($namespace);
$routes->get('/product', 'Product');

copy(TESTPATH . 'system/Router/Controllers/App/Product.php', APPPATH . 'Controllers/Product.php');
copy(TESTPATH . '_support/_controller/Product.php', APPPATH . 'Controllers/Product.php');

$router = new Router($routes, Services::request());
$router->handle('/product');
Expand Down
26 changes: 13 additions & 13 deletions tests/system/Router/RouterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public function testAutoRouteFindsDefaultControllerAndMethod(): void
$this->collection->setDefaultMethod('getSomemethod');
$router = new Router($this->collection, $this->request);

copy(TESTPATH . 'system/Router/Controllers/App/Mycontroller.php', APPPATH . 'Controllers/Mycontroller.php');
copy(TESTPATH . '_support/_controller/Mycontroller.php', APPPATH . 'Controllers/Mycontroller.php');

$router->autoRoute('/');

Expand All @@ -216,7 +216,7 @@ public function testAutoRouteFindsControllerWithFileAndMethod(): void
$this->collection->setAutoRoute(true);
$router = new Router($this->collection, $this->request);

copy(TESTPATH . 'system/Router/Controllers/App/Mycontroller.php', APPPATH . 'Controllers/Mycontroller.php');
copy(TESTPATH . '_support/_controller/Mycontroller.php', APPPATH . 'Controllers/Mycontroller.php');

$router->autoRoute('mycontroller/getSomemethod');

Expand All @@ -231,7 +231,7 @@ public function testAutoRouteFindsControllerWithFile(): void
$this->collection->setAutoRoute(true);
$router = new Router($this->collection, $this->request);

copy(TESTPATH . 'system/Router/Controllers/App/Mycontroller.php', APPPATH . 'Controllers/Mycontroller.php');
copy(TESTPATH . '_support/_controller/Mycontroller.php', APPPATH . 'Controllers/Mycontroller.php');

$router->autoRoute('mycontroller');

Expand All @@ -248,7 +248,7 @@ public function testAutoRouteFindsControllerWithSubfolder(): void

mkdir(APPPATH . 'Controllers/Subfolder');

copy(TESTPATH . 'system/Router/Controllers/App/Subfolder/Mycontroller.php', APPPATH . 'Controllers/Subfolder/Mycontroller.php');
copy(TESTPATH . '_support/_controller/Subfolder/Mycontroller.php', APPPATH . 'Controllers/Subfolder/Mycontroller.php');

$router->autoRoute('subfolder/mycontroller/getSomemethod');

Expand All @@ -267,7 +267,7 @@ public function testAutoRouteFindsDashedSubfolder(): void
$router->setTranslateURIDashes(true);

mkdir(APPPATH . 'Controllers/Dash_folder');
copy(TESTPATH . 'system/Router/Controllers/App/Dash_folder/Mycontroller.php', APPPATH . 'Controllers/Dash_folder/Mycontroller.php');
copy(TESTPATH . '_support/_controller/Dash_folder/Mycontroller.php', APPPATH . 'Controllers/Dash_folder/Mycontroller.php');

$router->autoRoute('dash-folder/mycontroller/somemethod');

Expand All @@ -286,7 +286,7 @@ public function testAutoRouteFindsDashedController(): void
$router->setTranslateURIDashes(true);

mkdir(APPPATH . 'Controllers/Dash_folder');
copy(TESTPATH . 'system/Router/Controllers/App/Dash_folder/Dash_controller.php', APPPATH . 'Controllers/Dash_folder/Dash_controller.php');
copy(TESTPATH . '_support/_controller/Dash_folder/Dash_controller.php', APPPATH . 'Controllers/Dash_folder/Dash_controller.php');

$router->autoRoute('dash-folder/dash-controller/getSomemethod');

Expand All @@ -305,7 +305,7 @@ public function testAutoRouteFindsDashedMethod(): void
$router->setTranslateURIDashes(true);

mkdir(APPPATH . 'Controllers/Dash_folder');
copy(TESTPATH . 'system/Router/Controllers/App/Dash_folder/Dash_controller.php', APPPATH . 'Controllers/Dash_folder/Dash_controller.php');
copy(TESTPATH . '_support/_controller/Dash_folder/Dash_controller.php', APPPATH . 'Controllers/Dash_folder/Dash_controller.php');

$router->autoRoute('dash-folder/dash-controller/getDash_method');

Expand All @@ -324,7 +324,7 @@ public function testAutoRouteFindsDefaultDashFolder(): void
$router->setTranslateURIDashes(true);

mkdir(APPPATH . 'Controllers/Dash_folder');
copy(TESTPATH . 'system/Router/Controllers/App/Dash_folder/Home.php', APPPATH . 'Controllers/Dash_folder/Home.php');
copy(TESTPATH . '_support/_controller/Dash_folder/Home.php', APPPATH . 'Controllers/Dash_folder/Home.php');

$router->autoRoute('dash-folder');

Expand All @@ -343,7 +343,7 @@ public function testAutoRouteFindsMByteDir(): void
$router->setTranslateURIDashes(true);

mkdir(APPPATH . 'Controllers/Φ');
copy(TESTPATH . 'system/Router/Controllers/App/Φ/Home.php', APPPATH . 'Controllers/Φ/Home.php');
copy(TESTPATH . '_support/_controller/Φ/Home.php', APPPATH . 'Controllers/Φ/Home.php');

$router->autoRoute('Φ');

Expand All @@ -361,7 +361,7 @@ public function testAutoRouteFindsMByteController(): void
$router = new Router($this->collection, $this->request);
$router->setTranslateURIDashes(true);

copy(TESTPATH . 'system/Router/Controllers/App/Φ.php', APPPATH . 'Controllers/Φ.php');
copy(TESTPATH . '_support/_controller/Φ.php', APPPATH . 'Controllers/Φ.php');

$router->autoRoute('Φ');

Expand Down Expand Up @@ -759,7 +759,7 @@ public function testTranslateURIDashesForAutoRoute(): void
$router = new Router($this->collection, $this->request);
$router->setTranslateURIDashes(true);

copy(TESTPATH . 'system/Router/Controllers/App/Admin_user.php', APPPATH . 'Controllers/Admin_user.php');
copy(TESTPATH . '_support/_controller/Admin_user.php', APPPATH . 'Controllers/Admin_user.php');

$router->autoRoute('admin_user/show_list');

Expand All @@ -777,7 +777,7 @@ public function testAutoRouteMatchesZeroParams(): void
$this->collection->setAutoRoute(true);
$router = new Router($this->collection, $this->request);

copy(TESTPATH . 'system/Router/Controllers/App/Mycontroller.php', APPPATH . 'Controllers/Mycontroller.php');
copy(TESTPATH . '_support/_controller/Mycontroller.php', APPPATH . 'Controllers/Mycontroller.php');

$router->autoRoute('mycontroller/getSomemethod/0/abc');

Expand Down Expand Up @@ -855,7 +855,7 @@ public function testRouterPriorDirectory(): void
mkdir(APPPATH . 'Controllers/foo');
mkdir(APPPATH . 'Controllers/foo/bar');
mkdir(APPPATH . 'Controllers/foo/bar/baz');
copy(TESTPATH . 'system/Router/Controllers/App/foo/bar/baz/Some_controller.php', APPPATH . 'Controllers/foo/bar/baz/Some_controller.php');
copy(TESTPATH . '_support/_controller/foo/bar/baz/Some_controller.php', APPPATH . 'Controllers/foo/bar/baz/Some_controller.php');

$router->setDirectory('foo/bar/baz', false, true);
$router->handle('Some_controller/some_method/param1/param2/param3');
Expand Down

0 comments on commit 4727ce4

Please sign in to comment.