Skip to content
Permalink
Browse files

fix extra '/' in viewPath if prefix is set to false

This would cause for example the `assertTemplate()` to fail if the route is define with 'prefix' => false
  • Loading branch information...
antograssiot committed Aug 12, 2015
1 parent 79a3402 commit 8455cfc2883d7e9592b3f92e5a16843abab2a8b0
Showing with 4 additions and 1 deletion.
  1. +1 −1 src/Controller/Controller.php
  2. +3 −0 tests/TestCase/Controller/ControllerTest.php
@@ -375,7 +375,7 @@ public function setRequest(Request $request)
if (!$this->viewPath) {
$viewPath = $this->name;
if (isset($request->params['prefix'])) {
if (!empty($request->params['prefix'])) {
$prefixes = array_map(
'Cake\Utility\Inflector::camelize',
explode('/', $request->params['prefix'])
@@ -871,6 +871,9 @@ public function testViewPathConventions()
$this->assertEquals('Admin' . DS . 'Super' . DS . 'Posts', $Controller->viewPath);
$request = new Request('pages/home');
$request->addParams([
'prefix' => false
]);
$Controller = new \TestApp\Controller\PagesController($request, $response);
$this->assertEquals('Pages', $Controller->viewPath);
}

0 comments on commit 8455cfc

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.