Skip to content

Commit

Permalink
Test path generation with multiple paths in App.paths.templates
Browse files Browse the repository at this point in the history
  • Loading branch information
Phillaf committed Feb 20, 2016
1 parent d001dfc commit d848edc
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions tests/TestCase/View/ViewTest.php
Expand Up @@ -518,6 +518,41 @@ public function testPathThemedPluginGeneration()
$this->assertPathEquals($expected, $paths);
}

/**
* Test that multiple paths can be used in App.paths.templates.
*
* @return void
*/
public function testMultipleAppPaths()
{
$viewOptions = ['plugin' => 'TestPlugin',
'name' => 'TestPlugin',
'viewPath' => 'Tests',
'view' => 'index',
'theme' => 'TestTheme'
];

$paths = Configure::read('App.paths.templates');
$paths[] = Plugin::classPath('TestPlugin') . 'Template' . DS;
Configure::write('App.paths.templates', $paths);

$View = new TestView(null, null, null, $viewOptions);
$paths = $View->paths('TestPlugin');
$pluginPath = Plugin::path('TestPlugin');
$themePath = Plugin::path('TestTheme');
$expected = [
$themePath . 'src' . DS . 'Template' . DS . 'Plugin' . DS . 'TestPlugin' . DS,
$themePath . 'src' . DS . 'Template' . DS,
TEST_APP . 'TestApp' . DS . 'Template' . DS . 'Plugin' . DS . 'TestPlugin' . DS,
$pluginPath . 'src' . DS . 'Template' . DS . 'Plugin' . DS . 'TestPlugin' . DS,
$pluginPath . 'src' . DS . 'Template' . DS,
TEST_APP . 'TestApp' . DS . 'Template' . DS,
TEST_APP . 'Plugin' . DS . 'TestPlugin' . DS . 'src' . DS . 'Template' . DS,
CAKE . 'Template' . DS,
];
$this->assertPathEquals($expected, $paths);
}

/**
* Test that CamelCase'd plugins still find their view files.
*
Expand Down

0 comments on commit d848edc

Please sign in to comment.