@@ -143,6 +143,18 @@ function getLayoutFileName($name = null) {
143
143
function loadHelpers (&$ loaded , $ helpers , $ parent = null ) {
144
144
return $ this ->_loadHelpers ($ loaded , $ helpers , $ parent );
145
145
}
146
+ /**
147
+ * paths method
148
+ *
149
+ * @param string $plugin
150
+ * @param boolean $cached
151
+ * @access public
152
+ * @return void
153
+ */
154
+ function paths ($ plugin = null , $ cached = true ) {
155
+ return $ this ->_paths ($ plugin , $ cached );
156
+ }
157
+
146
158
/**
147
159
* cakeError method
148
160
*
@@ -237,7 +249,10 @@ function testPluginGetTemplate() {
237
249
238
250
$ View = new TestView ($ this ->Controller );
239
251
Configure::write ('pluginPaths ' , array (TEST_CAKE_CORE_INCLUDE_PATH . 'tests ' . DS . 'test_app ' . DS . 'plugins ' . DS ));
240
- Configure::write ('viewPaths ' , array (TEST_CAKE_CORE_INCLUDE_PATH . 'tests ' . DS . 'test_app ' . DS . 'views ' . DS ));
252
+ Configure::write ('viewPaths ' , array (
253
+ TEST_CAKE_CORE_INCLUDE_PATH . 'tests ' . DS . 'test_app ' . DS . 'views ' . DS ,
254
+ TEST_CAKE_CORE_INCLUDE_PATH . 'libs ' . DS . 'view ' . DS ,
255
+ ));
241
256
242
257
$ expected = TEST_CAKE_CORE_INCLUDE_PATH . 'tests ' . DS . 'test_app ' . DS . 'plugins ' . DS .'test_plugin ' . DS . 'views ' . DS .'tests ' . DS .'index.ctp ' ;
243
258
$ result = $ View ->getViewFileName ('index ' );
@@ -247,6 +262,36 @@ function testPluginGetTemplate() {
247
262
$ result = $ View ->getLayoutFileName ();
248
263
$ this ->assertEqual ($ result , $ expected );
249
264
}
265
+ /**
266
+ * test that plugin/$plugin_name is only appended to the paths it should be.
267
+ *
268
+ * @return void
269
+ **/
270
+ function testPluginPathGeneration () {
271
+ $ this ->Controller ->plugin = 'test_plugin ' ;
272
+ $ this ->Controller ->name = 'TestPlugin ' ;
273
+ $ this ->Controller ->viewPath = 'tests ' ;
274
+ $ this ->Controller ->action = 'index ' ;
275
+
276
+ Configure::write ('viewPaths ' , array (
277
+ TEST_CAKE_CORE_INCLUDE_PATH . 'tests ' . DS . 'test_app ' . DS . 'views ' . DS ,
278
+ TEST_CAKE_CORE_INCLUDE_PATH . 'libs ' . DS . 'view ' . DS ,
279
+ ));
280
+
281
+ $ View = new TestView ($ this ->Controller );
282
+ $ paths = $ View ->paths ();
283
+ $ this ->assertEqual ($ paths , Configure::read ('viewPaths ' ));
284
+
285
+ $ paths = $ View ->paths ('test_plugin ' );
286
+ $ expected = array (
287
+ TEST_CAKE_CORE_INCLUDE_PATH . 'tests ' . DS . 'test_app ' . DS . 'views ' . DS . 'plugins ' . DS . 'test_plugin ' . DS ,
288
+ TEST_CAKE_CORE_INCLUDE_PATH . 'tests ' . DS . 'test_app ' . DS . 'plugins ' . DS . 'test_plugin ' . DS . 'views ' . DS ,
289
+ TEST_CAKE_CORE_INCLUDE_PATH . 'tests ' . DS . 'test_app ' . DS . 'views ' . DS ,
290
+ TEST_CAKE_CORE_INCLUDE_PATH . 'libs ' . DS . 'view ' . DS
291
+ );
292
+ $ this ->assertEqual ($ paths , $ expected );
293
+ }
294
+
250
295
/**
251
296
* test that CamelCase plugins still find their view files.
252
297
*
0 commit comments