Exemplo n.º 1
0
 /**
  * Test that plugin/$plugin_name is only appended to the paths it should be.
  *
  * @return void
  */
 public function testPluginPathGeneration()
 {
     $viewOptions = ['plugin' => 'TestPlugin', 'name' => 'TestPlugin', 'viewPath' => 'Tests', 'view' => 'index'];
     $View = new TestView(null, null, null, $viewOptions);
     $paths = $View->paths();
     $expected = array_merge(App::path('Template'), App::core('Template'));
     $this->assertEquals($expected, $paths);
     $paths = $View->paths('TestPlugin');
     $pluginPath = Plugin::path('TestPlugin');
     $expected = array(TEST_APP . 'TestApp' . DS . 'Template' . DS . 'Plugin' . DS . 'TestPlugin' . DS, $pluginPath . 'Template' . DS, TEST_APP . 'TestApp' . DS . 'Template' . DS, CAKE . 'Template' . DS);
     $this->assertPathEquals($expected, $paths);
 }
Exemplo n.º 2
0
 /**
  * Test that themed plugin paths are generated correctly.
  *
  * @return void
  */
 public function testPathThemedPluginGeneration()
 {
     $viewOptions = ['plugin' => 'TestPlugin', 'name' => 'TestPlugin', 'viewPath' => 'Tests', 'view' => 'index', 'theme' => 'TestTheme'];
     $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, TEST_APP . 'TestApp' . DS . 'Template' . DS, CAKE . 'Template' . DS];
     $this->assertPathEquals($expected, $paths);
 }
Exemplo n.º 3
0
 /**
  * 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);
 }