From ee7f41708533d91ea92ff66f2bcd8969040fea5a Mon Sep 17 00:00:00 2001 From: Jose Lorenzo Rodriguez Date: Wed, 26 Oct 2011 21:29:04 -0430 Subject: [PATCH] Test to disprove #2123, it is possible to load classes in plugin's Lib directory. App::uses() is intended for classes not procedural files. --- lib/Cake/Test/Case/Core/AppTest.php | 16 ++++++++++++++++ .../TestPlugin/Lib/TestPluginOtherLibrary.php | 19 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 lib/Cake/Test/test_app/Plugin/TestPlugin/Lib/TestPluginOtherLibrary.php diff --git a/lib/Cake/Test/Case/Core/AppTest.php b/lib/Cake/Test/Case/Core/AppTest.php index 3520fd461..4c0e9c3ce 100644 --- a/lib/Cake/Test/Case/Core/AppTest.php +++ b/lib/Cake/Test/Case/Core/AppTest.php @@ -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')); + } } diff --git a/lib/Cake/Test/test_app/Plugin/TestPlugin/Lib/TestPluginOtherLibrary.php b/lib/Cake/Test/test_app/Plugin/TestPlugin/Lib/TestPluginOtherLibrary.php new file mode 100644 index 000000000..9df2508a2 --- /dev/null +++ b/lib/Cake/Test/test_app/Plugin/TestPlugin/Lib/TestPluginOtherLibrary.php @@ -0,0 +1,19 @@ + + * 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 {}