Skip to content

Commit

Permalink
Add test for #11620
Browse files Browse the repository at this point in the history
Ensure that controller names with length equal to the view subDir still
have the subdirectory applied.
  • Loading branch information
markstory committed Jan 25, 2018
1 parent 4c3638f commit 7134214
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/TestCase/View/ViewTest.php
Expand Up @@ -675,6 +675,27 @@ public function testGetViewFileNameSubDir()
$this->assertPathEquals($expected, $result);
}

/**
* Test getViewFileName applies subdirectories on equal length names
*
* @return void
*/
public function testGetViewFileNameSubDirLength()
{
$viewOptions = [
'plugin' => null,
'name' => 'Jobs',
'viewPath' => 'Jobs',
'layoutPath' => 'json',
];
$view = new TestView(null, null, null, $viewOptions);

$view->subDir = 'json';
$result = $view->getViewFileName('index');
$expected = TEST_APP . 'TestApp' . DS . 'Template' . DS . 'Jobs' . DS . 'json' . DS . 'index.ctp';
$this->assertPathEquals($expected, $result);
}

/**
* Test getting layout filenames
*
Expand Down
2 changes: 2 additions & 0 deletions tests/test_app/TestApp/Template/Jobs/json/index.ctp
@@ -0,0 +1,2 @@
<?php
// used to test subdir path additions.

0 comments on commit 7134214

Please sign in to comment.