Upgrade CakePHP from 2.2.5 to 2.9.5

This commit is contained in:
Brm Ko 2017-02-26 15:29:44 +01:00
parent 5a580df460
commit 235a541597
793 changed files with 60746 additions and 23753 deletions

View file

@ -2,19 +2,18 @@
/**
* AppTest file.
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package Cake.Test.Case.Core
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
/**
@ -96,7 +95,7 @@ class AppTest extends CakeTestCase {
}
/**
* tests that it is possible to set up paths using the cake 1.3 notation for them (models, behaviors, controllers...)
* tests that it is possible to set up paths using the CakePHP 1.3 notation for them (models, behaviors, controllers...)
*
* @return void
*/
@ -302,7 +301,7 @@ class AppTest extends CakeTestCase {
* @return void
*/
public function testListObjects() {
$result = App::objects('class', CAKE . 'Routing', false);
$result = App::objects('class', CAKE . 'Routing', false);
$this->assertTrue(in_array('Dispatcher', $result));
$this->assertTrue(in_array('Router', $result));
@ -363,6 +362,8 @@ class AppTest extends CakeTestCase {
/**
* Make sure that .svn and friends are excluded from App::objects('plugin')
*
* @return void
*/
public function testListObjectsIgnoreDotDirectories() {
$path = CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS;
@ -429,27 +430,6 @@ class AppTest extends CakeTestCase {
App::build();
}
/**
* test that pluginPath can find paths for plugins.
*
* @return void
*/
public function testPluginPath() {
App::build(array(
'plugins' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)
));
CakePlugin::load(array('TestPlugin', 'TestPluginTwo'));
$path = App::pluginPath('TestPlugin');
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS . 'TestPlugin' . DS;
$this->assertEquals($expected, $path);
$path = App::pluginPath('TestPluginTwo');
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS . 'TestPluginTwo' . DS;
$this->assertEquals($expected, $path);
App::build();
}
/**
* test that themePath can find paths for themes.
*
@ -596,7 +576,6 @@ class AppTest extends CakeTestCase {
* test that building helper paths actually works.
*
* @return void
* @link http://cakephp.lighthouseapp.com/projects/42648/tickets/410
*/
public function testImportingHelpersFromAlternatePaths() {
$this->assertFalse(class_exists('BananaHelper', false), 'BananaHelper exists, cannot test importing it.');
@ -749,7 +728,7 @@ class AppTest extends CakeTestCase {
$result = App::import('Vendor', 'css/TestAsset', array('ext' => 'css'));
$text = ob_get_clean();
$this->assertTrue($result);
$this->assertEquals('this is the test asset css file', $text);
$this->assertEquals('/* this is the test asset css file */', trim($text));
$result = App::import('Vendor', 'TestPlugin.sample/SamplePlugin');
$this->assertTrue($result);
@ -794,6 +773,7 @@ class AppTest extends CakeTestCase {
* Tests that the automatic class loader will also find in "libs" folder for both
* app and plugins if it does not find the class in other configured paths
*
* @return void
*/
public function testLoadClassInLibs() {
App::build(array(
@ -808,11 +788,11 @@ class AppTest extends CakeTestCase {
$this->assertFalse(class_exists('TestUtilityClass', false));
App::uses('TestUtilityClass', 'Utility');
$this->assertTrue(class_exists('CustomLibClass'));
$this->assertTrue(class_exists('TestUtilityClass'));
}
/**
* Tests that App::location() returns the defined path for a class
* Tests that App::location() returns the defined path for a class
*
* @return void
*/
@ -848,4 +828,36 @@ class AppTest extends CakeTestCase {
App::uses('TestPluginOtherLibrary', 'TestPlugin.Lib');
$this->assertTrue(class_exists('TestPluginOtherLibrary'));
}
/**
* Test that increaseMemoryLimit increases the maximum amount of memory actually
*
* @dataProvider memoryVariationProvider
* @return void
*/
public function testIncreaseMemoryLimit($memoryLimit, $additionalKb, $expected) {
$this->skipIf(!function_exists('ini_set'));
$originalMemoryLimit = ini_get('memory_limit');
ini_set('memory_limit', $memoryLimit);
App::increaseMemoryLimit($additionalKb);
$this->assertEquals($expected, ini_get('memory_limit'));
ini_set('memory_limit', $originalMemoryLimit);
}
/**
* Data provider function for testIncreaseMemoryLimit
*
* @return void
*/
public function memoryVariationProvider() {
return array(
array('131072K', 100000, '231072K'),
array('256M', 1, '262145K'),
array('1G', 1, '1048577K'),
array('-1', 100000, '-1')
);
}
}