mirror of
https://github.com/brmlab/brmsklad.git
synced 2025-12-17 14:13:58 +01:00
Upgrade CakePHP from 2.2.5 to 2.9.5
This commit is contained in:
parent
5a580df460
commit
235a541597
793 changed files with 60746 additions and 23753 deletions
|
|
@ -4,20 +4,20 @@
|
|||
*
|
||||
* Holds several tests
|
||||
*
|
||||
* PHP 5
|
||||
*
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
|
||||
* 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://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
|
||||
* @package Cake.Test.Case.Core
|
||||
* @since CakePHP(tm) v 1.2.0.5432
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
App::uses('PhpReader', 'Configure');
|
||||
|
||||
/**
|
||||
|
|
@ -67,6 +67,24 @@ class ConfigureTest extends CakeTestCase {
|
|||
Configure::drop('test');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test to ensure bootrapping doesn't overwrite prior configs set under 'App' key
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testBootstrap() {
|
||||
$expected = array(
|
||||
'foo' => 'bar'
|
||||
);
|
||||
Configure::write('App', $expected);
|
||||
|
||||
Configure::bootstrap(true);
|
||||
$result = Configure::read('App');
|
||||
|
||||
$this->assertEquals($expected['foo'], $result['foo']);
|
||||
$this->assertFalse($result['base']);
|
||||
}
|
||||
|
||||
/**
|
||||
* testRead method
|
||||
*
|
||||
|
|
@ -131,6 +149,39 @@ class ConfigureTest extends CakeTestCase {
|
|||
$this->assertEquals('4', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the consume method.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testConsume() {
|
||||
$this->assertNull(Configure::consume('DoesNotExist'), 'Should be null on empty value');
|
||||
Configure::write('Test', array('key' => 'value', 'key2' => 'value2'));
|
||||
|
||||
$result = Configure::consume('Test.key');
|
||||
$this->assertEquals('value', $result);
|
||||
|
||||
$result = Configure::read('Test.key2');
|
||||
$this->assertEquals('value2', $result, 'Other values should remain.');
|
||||
|
||||
$result = Configure::consume('Test');
|
||||
$expected = array('key2' => 'value2');
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testConsumeEmpty
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testConsumeEmpty() {
|
||||
Configure::write('Test', array('key' => 'value', 'key2' => 'value2'));
|
||||
$result = Configure::consume('');
|
||||
$this->assertNull($result);
|
||||
$result = Configure::consume(null);
|
||||
$this->assertNull($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* test setting display_errors with debug.
|
||||
*
|
||||
|
|
@ -158,7 +209,7 @@ class ConfigureTest extends CakeTestCase {
|
|||
|
||||
Configure::delete('SomeName.someKey');
|
||||
$result = Configure::read('SomeName.someKey');
|
||||
$this->assertTrue($result === null);
|
||||
$this->assertNull($result);
|
||||
|
||||
Configure::write('SomeName', array('someKey' => 'myvalue', 'otherKey' => 'otherValue'));
|
||||
|
||||
|
|
@ -171,10 +222,65 @@ class ConfigureTest extends CakeTestCase {
|
|||
Configure::delete('SomeName');
|
||||
|
||||
$result = Configure::read('SomeName.someKey');
|
||||
$this->assertTrue($result === null);
|
||||
$this->assertNull($result);
|
||||
|
||||
$result = Configure::read('SomeName.otherKey');
|
||||
$this->assertTrue($result === null);
|
||||
$this->assertNull($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testCheck method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testCheck() {
|
||||
Configure::write('ConfigureTestCase', 'value');
|
||||
$this->assertTrue(Configure::check('ConfigureTestCase'));
|
||||
|
||||
$this->assertFalse(Configure::check('NotExistingConfigureTestCase'));
|
||||
}
|
||||
|
||||
/**
|
||||
* testCheckingSavedEmpty method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testCheckingSavedEmpty() {
|
||||
$this->assertTrue(Configure::write('ConfigureTestCase', 0));
|
||||
$this->assertTrue(Configure::check('ConfigureTestCase'));
|
||||
|
||||
$this->assertTrue(Configure::write('ConfigureTestCase', '0'));
|
||||
$this->assertTrue(Configure::check('ConfigureTestCase'));
|
||||
|
||||
$this->assertTrue(Configure::write('ConfigureTestCase', false));
|
||||
$this->assertTrue(Configure::check('ConfigureTestCase'));
|
||||
|
||||
$this->assertTrue(Configure::write('ConfigureTestCase', null));
|
||||
$this->assertFalse(Configure::check('ConfigureTestCase'));
|
||||
}
|
||||
|
||||
/**
|
||||
* testCheckKeyWithSpaces method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testCheckKeyWithSpaces() {
|
||||
$this->assertTrue(Configure::write('Configure Test', "test"));
|
||||
$this->assertTrue(Configure::check('Configure Test'));
|
||||
Configure::delete('Configure Test');
|
||||
|
||||
$this->assertTrue(Configure::write('Configure Test.Test Case', "test"));
|
||||
$this->assertTrue(Configure::check('Configure Test.Test Case'));
|
||||
}
|
||||
|
||||
/**
|
||||
* testCheckEmpty
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testCheckEmpty() {
|
||||
$this->assertFalse(Configure::check(''));
|
||||
$this->assertFalse(Configure::check(null));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -185,7 +291,7 @@ class ConfigureTest extends CakeTestCase {
|
|||
*/
|
||||
public function testLoadExceptionOnNonExistantFile() {
|
||||
Configure::config('test', new PhpReader());
|
||||
$result = Configure::load('non_existing_configuration_file', 'test');
|
||||
Configure::load('non_existing_configuration_file', 'test');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -345,10 +451,16 @@ class ConfigureTest extends CakeTestCase {
|
|||
*
|
||||
* @expectedException PHPUnit_Framework_Error
|
||||
* @return void
|
||||
* @throws PHPUnit_Framework_Error
|
||||
*/
|
||||
public function testReaderExceptionOnIncorrectClass() {
|
||||
$reader = new StdClass();
|
||||
Configure::config('test', $reader);
|
||||
|
||||
try {
|
||||
Configure::config('test', $reader);
|
||||
} catch (TypeError $e) {
|
||||
throw new PHPUnit_Framework_Error('Raised an error', 100, __FILE__, __LINE__);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -364,7 +476,10 @@ class ConfigureTest extends CakeTestCase {
|
|||
}
|
||||
|
||||
/**
|
||||
* testDumpNoAdapter
|
||||
*
|
||||
* @expectedException ConfigureException
|
||||
* @return void
|
||||
*/
|
||||
public function testDumpNoAdapter() {
|
||||
Configure::dump(TMP . 'test.php', 'does_not_exist');
|
||||
|
|
@ -391,7 +506,7 @@ class ConfigureTest extends CakeTestCase {
|
|||
/**
|
||||
* Test dumping only some of the data.
|
||||
*
|
||||
* @return
|
||||
* @return void
|
||||
*/
|
||||
public function testDumpPartial() {
|
||||
Configure::config('test_reader', new PhpReader(TMP));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue