diff --git a/tests/TestCase/View/ViewTest.php b/tests/TestCase/View/ViewTest.php index 6f0a6cfc07d..38986c864fd 100644 --- a/tests/TestCase/View/ViewTest.php +++ b/tests/TestCase/View/ViewTest.php @@ -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 * diff --git a/tests/test_app/TestApp/Template/Jobs/json/index.ctp b/tests/test_app/TestApp/Template/Jobs/json/index.ctp new file mode 100644 index 00000000000..67913863ede --- /dev/null +++ b/tests/test_app/TestApp/Template/Jobs/json/index.ctp @@ -0,0 +1,2 @@ +