Test to disprove #2123, it is possible to load classes in plugin's Lib directory. App::uses() is intended for classes not procedural files.

This commit is contained in:
Jose Lorenzo Rodriguez 2011-10-26 21:29:04 -04:30
parent 3735c7db67
commit ee7f417085
2 changed files with 35 additions and 0 deletions

View file

@ -794,4 +794,20 @@ class AppTest extends CakeTestCase {
$this->assertArrayHasKey('Controller', $result);
$this->assertArrayHasKey('Controller/Component', $result);
}
/**
* Proves that it is possible to load plugin libraries in top
* level Lib dir for plugins
*
* @return void
*/
public function testPluginLibClasses() {
App::build(array(
'plugins' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)
), App::RESET);
CakePlugin::loadAll();
$this->assertFalse(class_exists('TestPluginOtherLibrary', false));
App::uses('TestPluginOtherLibrary', 'TestPlugin.Lib');
$this->assertTrue(class_exists('TestPluginOtherLibrary'));
}
}

View file

@ -0,0 +1,19 @@
<?php
/**
* Test Suite TestPlugin Other Library
*
* PHP 5
*
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
* Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
* @package Cake.Test.test_app.Plugin.TestPlugin.Lib
* @since CakePHP(tm) v 2.0.1
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
class TestPluginOtherLibrary {}