mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Added tests to disprove strange App::import behavior. Closes #5395
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7629 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
f080163e8a
commit
597f7642fa
3 changed files with 101 additions and 29 deletions
|
@ -30,22 +30,22 @@
|
||||||
App::import('Core', 'Configure');
|
App::import('Core', 'Configure');
|
||||||
/**
|
/**
|
||||||
* TestConfigure class
|
* TestConfigure class
|
||||||
*
|
*
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.tests.cases.libs
|
* @subpackage cake.tests.cases.libs
|
||||||
*/
|
*/
|
||||||
class TestConfigure extends Configure {
|
class TestConfigure extends Configure {
|
||||||
/**
|
/**
|
||||||
* &getInstance method
|
* &getInstance method
|
||||||
*
|
*
|
||||||
* @param bool $boot
|
* @param bool $boot
|
||||||
* @access public
|
* @access public
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function &getInstance($boot = true) {
|
function &getInstance($boot = true) {
|
||||||
/**
|
/**
|
||||||
* instance property
|
* instance property
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
|
@ -67,7 +67,7 @@ class TestConfigure extends Configure {
|
||||||
class ConfigureTest extends CakeTestCase {
|
class ConfigureTest extends CakeTestCase {
|
||||||
/**
|
/**
|
||||||
* setUp method
|
* setUp method
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -78,7 +78,7 @@ class ConfigureTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* tearDown method
|
* tearDown method
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -100,7 +100,7 @@ class ConfigureTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* testListObjects method
|
* testListObjects method
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -144,7 +144,7 @@ class ConfigureTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* testRead method
|
* testRead method
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -167,7 +167,7 @@ class ConfigureTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* testWrite method
|
* testWrite method
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -180,7 +180,7 @@ class ConfigureTest extends CakeTestCase {
|
||||||
$result = $this->Configure->read('SomeName.someKey');
|
$result = $this->Configure->read('SomeName.someKey');
|
||||||
$this->assertEqual($result, null);
|
$this->assertEqual($result, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testSetErrorReporting Level
|
* testSetErrorReporting Level
|
||||||
*
|
*
|
||||||
|
@ -190,21 +190,21 @@ class ConfigureTest extends CakeTestCase {
|
||||||
$this->Configure->write('debug', 0);
|
$this->Configure->write('debug', 0);
|
||||||
$result = ini_get('error_reporting');
|
$result = ini_get('error_reporting');
|
||||||
$this->assertEqual($result, 0);
|
$this->assertEqual($result, 0);
|
||||||
|
|
||||||
$this->Configure->write('debug', 2);
|
$this->Configure->write('debug', 2);
|
||||||
$result = ini_get('error_reporting');
|
$result = ini_get('error_reporting');
|
||||||
$this->assertEqual($result, E_ALL);
|
$this->assertEqual($result, E_ALL);
|
||||||
|
|
||||||
$result = ini_get('display_errors');
|
$result = ini_get('display_errors');
|
||||||
$this->assertEqual($result, 1);
|
$this->assertEqual($result, 1);
|
||||||
|
|
||||||
$this->Configure->write('debug', 0);
|
$this->Configure->write('debug', 0);
|
||||||
$result = ini_get('error_reporting');
|
$result = ini_get('error_reporting');
|
||||||
$this->assertEqual($result, 0);
|
$this->assertEqual($result, 0);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* testDelete method
|
* testDelete method
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -235,7 +235,7 @@ class ConfigureTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* testLoad method
|
* testLoad method
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -248,7 +248,7 @@ class ConfigureTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* testStore method
|
* testStore method
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -259,7 +259,7 @@ class ConfigureTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* testVersion method
|
* testVersion method
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -273,7 +273,7 @@ class ConfigureTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* testBuildPaths method
|
* testBuildPaths method
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -286,14 +286,14 @@ class ConfigureTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* AppImportTest class
|
* AppImportTest class
|
||||||
*
|
*
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.tests.cases.libs
|
* @subpackage cake.tests.cases.libs
|
||||||
*/
|
*/
|
||||||
class AppImportTest extends UnitTestCase {
|
class AppImportTest extends UnitTestCase {
|
||||||
/**
|
/**
|
||||||
* testClassLoading method
|
* testClassLoading method
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -364,7 +364,7 @@ class AppImportTest extends UnitTestCase {
|
||||||
$file = App::import('Model', 'NonExistingModel');
|
$file = App::import('Model', 'NonExistingModel');
|
||||||
$this->assertFalse($file);
|
$this->assertFalse($file);
|
||||||
}
|
}
|
||||||
|
|
||||||
$_back = Configure::read('pluginPaths');
|
$_back = Configure::read('pluginPaths');
|
||||||
Configure::write('pluginPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS));
|
Configure::write('pluginPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS));
|
||||||
|
|
||||||
|
@ -372,16 +372,16 @@ class AppImportTest extends UnitTestCase {
|
||||||
$this->assertTrue($result);
|
$this->assertTrue($result);
|
||||||
$this->assertTrue(class_exists('TestPluginAppController'));
|
$this->assertTrue(class_exists('TestPluginAppController'));
|
||||||
$this->assertTrue(class_exists('TestsController'));
|
$this->assertTrue(class_exists('TestsController'));
|
||||||
|
|
||||||
$result = App::import('Helper', 'TestPlugin.OtherHelper');
|
$result = App::import('Helper', 'TestPlugin.OtherHelper');
|
||||||
$this->assertTrue($result);
|
$this->assertTrue($result);
|
||||||
$this->assertTrue(class_exists('OtherHelperHelper'));
|
$this->assertTrue(class_exists('OtherHelperHelper'));
|
||||||
|
|
||||||
Configure::write('pluginPaths', $_back);
|
Configure::write('pluginPaths', $_back);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* testFileLoading method
|
* testFileLoading method
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -395,7 +395,7 @@ class AppImportTest extends UnitTestCase {
|
||||||
// import($type = null, $name = null, $parent = true, $file = null, $search = array(), $return = false) {
|
// import($type = null, $name = null, $parent = true, $file = null, $search = array(), $return = false) {
|
||||||
/**
|
/**
|
||||||
* testFileLoadingWithArray method
|
* testFileLoadingWithArray method
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -412,7 +412,7 @@ class AppImportTest extends UnitTestCase {
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* testFileLoadingReturnValue method
|
* testFileLoadingReturnValue method
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -431,7 +431,7 @@ class AppImportTest extends UnitTestCase {
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* testLoadingWithSearch method
|
* testLoadingWithSearch method
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -444,7 +444,7 @@ class AppImportTest extends UnitTestCase {
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* testLoadingWithSearchArray method
|
* testLoadingWithSearchArray method
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -459,7 +459,7 @@ class AppImportTest extends UnitTestCase {
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* testMultipleLoading method
|
* testMultipleLoading method
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -547,6 +547,18 @@ class AppImportTest extends UnitTestCase {
|
||||||
$text = ob_get_clean();
|
$text = ob_get_clean();
|
||||||
$this->assertTrue($result);
|
$this->assertTrue($result);
|
||||||
$this->assertEqual($text, 'This is the MyTest.php file');
|
$this->assertEqual($text, 'This is the MyTest.php file');
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
$result = App::import('Vendor', 'Welcome');
|
||||||
|
$text = ob_get_clean();
|
||||||
|
$this->assertTrue($result);
|
||||||
|
$this->assertEqual($text, 'This is the welcome.php file in vendors directoy');
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
$result = App::import('Vendor', 'TestPlugin.Welcome');
|
||||||
|
$text = ob_get_clean();
|
||||||
|
$this->assertTrue($result);
|
||||||
|
$this->assertEqual($text, 'This is the welcome.php file in test_plugin/vendors directoy');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
30
cake/tests/test_app/plugins/test_plugin/vendors/welcome.php
vendored
Normal file
30
cake/tests/test_app/plugins/test_plugin/vendors/welcome.php
vendored
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
<?php
|
||||||
|
/* SVN FILE: $Id$ */
|
||||||
|
/**
|
||||||
|
* Short description for file.
|
||||||
|
*
|
||||||
|
* Long description for file
|
||||||
|
*
|
||||||
|
* PHP versions 4 and 5
|
||||||
|
*
|
||||||
|
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||||
|
* Copyright 2005-2008, Cake Software Foundation, Inc.
|
||||||
|
* 1785 E. Sahara Avenue, Suite 490-204
|
||||||
|
* Las Vegas, Nevada 89104
|
||||||
|
*
|
||||||
|
* Licensed under The Open Group Test Suite License
|
||||||
|
* Redistributions of files must retain the above copyright notice.
|
||||||
|
*
|
||||||
|
* @filesource
|
||||||
|
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc.
|
||||||
|
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||||
|
* @package cake.tests
|
||||||
|
* @subpackage cake.tests.test_app.plugins.test_plugin.vendors
|
||||||
|
* @since CakePHP(tm) v 1.2.0.4206
|
||||||
|
* @version $Revision$
|
||||||
|
* @modifiedby $LastChangedBy$
|
||||||
|
* @lastmodified $Date$
|
||||||
|
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
|
||||||
|
*/
|
||||||
|
?>
|
||||||
|
This is the welcome.php file in test_plugin/vendors directoy
|
30
cake/tests/test_app/vendors/welcome.php
vendored
Normal file
30
cake/tests/test_app/vendors/welcome.php
vendored
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
<?php
|
||||||
|
/* SVN FILE: $Id$ */
|
||||||
|
/**
|
||||||
|
* Short description for file.
|
||||||
|
*
|
||||||
|
* Long description for file
|
||||||
|
*
|
||||||
|
* PHP versions 4 and 5
|
||||||
|
*
|
||||||
|
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||||
|
* Copyright 2005-2008, Cake Software Foundation, Inc.
|
||||||
|
* 1785 E. Sahara Avenue, Suite 490-204
|
||||||
|
* Las Vegas, Nevada 89104
|
||||||
|
*
|
||||||
|
* Licensed under The Open Group Test Suite License
|
||||||
|
* Redistributions of files must retain the above copyright notice.
|
||||||
|
*
|
||||||
|
* @filesource
|
||||||
|
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc.
|
||||||
|
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||||
|
* @package cake.tests
|
||||||
|
* @subpackage cake.tests.test_app.vendors
|
||||||
|
* @since CakePHP(tm) v 1.2.0.4206
|
||||||
|
* @version $Revision$
|
||||||
|
* @modifiedby $LastChangedBy$
|
||||||
|
* @lastmodified $Date$
|
||||||
|
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
|
||||||
|
*/
|
||||||
|
?>
|
||||||
|
This is the welcome.php file in vendors directoy
|
Loading…
Add table
Reference in a new issue