mirror of
				https://github.com/brmlab/brmsklad.git
				synced 2025-10-31 00:03: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
				
			
		|  | @ -2,19 +2,18 @@ | |||
| /** | ||||
|  * XmlViewTest file | ||||
|  * | ||||
|  * 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.View | ||||
|  * @since         CakePHP(tm) v 2.1.0 | ||||
|  * @license       MIT License (http://www.opensource.org/licenses/mit-license.php) | ||||
|  * @license       http://www.opensource.org/licenses/mit-license.php MIT License | ||||
|  */ | ||||
| 
 | ||||
| App::uses('Controller', 'Controller'); | ||||
|  | @ -29,6 +28,11 @@ App::uses('XmlView', 'View'); | |||
|  */ | ||||
| class XmlViewTest extends CakeTestCase { | ||||
| 
 | ||||
| 	public function setUp() { | ||||
| 		parent::setUp(); | ||||
| 		Configure::write('debug', 0); | ||||
| 	} | ||||
| 
 | ||||
| /** | ||||
|  * testRenderWithoutView method | ||||
|  * | ||||
|  | @ -64,6 +68,102 @@ class XmlViewTest extends CakeTestCase { | |||
| 
 | ||||
| 		$expected = Xml::build(array('response' => array('users' => $data)))->asXML(); | ||||
| 		$this->assertSame($expected, $output); | ||||
| 
 | ||||
| 		$Controller->set('_rootNode', 'custom_name'); | ||||
| 		$View = new XmlView($Controller); | ||||
| 		$output = $View->render(false); | ||||
| 
 | ||||
| 		$expected = Xml::build(array('custom_name' => array('users' => $data)))->asXML(); | ||||
| 		$this->assertSame($expected, $output); | ||||
| 	} | ||||
| 
 | ||||
| /** | ||||
|  * Test that rendering with _serialize does not load helpers | ||||
|  * | ||||
|  * @return void | ||||
|  */ | ||||
| 	public function testRenderSerializeNoHelpers() { | ||||
| 		$Request = new CakeRequest(); | ||||
| 		$Response = new CakeResponse(); | ||||
| 		$Controller = new Controller($Request, $Response); | ||||
| 		$Controller->helpers = array('Html'); | ||||
| 		$Controller->set(array( | ||||
| 			'_serialize' => 'tags', | ||||
| 			'tags' => array('cakephp', 'framework') | ||||
| 		)); | ||||
| 		$View = new XmlView($Controller); | ||||
| 		$View->render(); | ||||
| 		$this->assertFalse(isset($View->Html), 'No helper loaded.'); | ||||
| 	} | ||||
| 
 | ||||
| /** | ||||
|  * Test that rendering with _serialize respects XML options. | ||||
|  * | ||||
|  * @return void | ||||
|  */ | ||||
| 	public function testRenderSerializeWithOptions() { | ||||
| 		$Request = new CakeRequest(); | ||||
| 		$Response = new CakeResponse(); | ||||
| 		$Controller = new Controller($Request, $Response); | ||||
| 		$data = array( | ||||
| 			'_serialize' => array('tags'), | ||||
| 			'_xmlOptions' => array('format' => 'attributes', 'return' => 'domdocument'), | ||||
| 			'tags' => array( | ||||
| 				'tag' => array( | ||||
| 					array( | ||||
| 						'id' => '1', | ||||
| 						'name' => 'defect' | ||||
| 					), | ||||
| 					array( | ||||
| 						'id' => '2', | ||||
| 						'name' => 'enhancement' | ||||
| 					) | ||||
| 				) | ||||
| 			) | ||||
| 		); | ||||
| 		$Controller->set($data); | ||||
| 		$Controller->viewClass = 'Xml'; | ||||
| 		$View = new XmlView($Controller); | ||||
| 		$result = $View->render(); | ||||
| 
 | ||||
| 		$expected = Xml::build(array('response' => array('tags' => $data['tags'])), $data['_xmlOptions'])->saveXML(); | ||||
| 		$this->assertSame($expected, $result); | ||||
| 	} | ||||
| 
 | ||||
| /** | ||||
|  * Test that rendering with _serialize can work with string setting. | ||||
|  * | ||||
|  * @return void | ||||
|  */ | ||||
| 	public function testRenderSerializeWithString() { | ||||
| 		$Request = new CakeRequest(); | ||||
| 		$Response = new CakeResponse(); | ||||
| 		$Controller = new Controller($Request, $Response); | ||||
| 		$data = array( | ||||
| 			'_serialize' => 'tags', | ||||
| 			'_xmlOptions' => array('format' => 'attributes'), | ||||
| 			'tags' => array( | ||||
| 				'tags' => array( | ||||
| 					'tag' => array( | ||||
| 						array( | ||||
| 							'id' => '1', | ||||
| 							'name' => 'defect' | ||||
| 						), | ||||
| 						array( | ||||
| 							'id' => '2', | ||||
| 							'name' => 'enhancement' | ||||
| 						) | ||||
| 					) | ||||
| 				) | ||||
| 			) | ||||
| 		); | ||||
| 		$Controller->set($data); | ||||
| 		$Controller->viewClass = 'Xml'; | ||||
| 		$View = new XmlView($Controller); | ||||
| 		$result = $View->render(); | ||||
| 
 | ||||
| 		$expected = Xml::build($data['tags'], $data['_xmlOptions'])->asXML(); | ||||
| 		$this->assertSame($expected, $result); | ||||
| 	} | ||||
| 
 | ||||
| /** | ||||
|  | @ -79,13 +179,49 @@ class XmlViewTest extends CakeTestCase { | |||
| 		$Controller->set($data); | ||||
| 		$Controller->set('_serialize', array('no', 'user')); | ||||
| 		$View = new XmlView($Controller); | ||||
| 		$this->assertSame('application/xml', $Response->type()); | ||||
| 		$output = $View->render(false); | ||||
| 
 | ||||
| 		$expected = array( | ||||
| 			'response' => array('no' => $data['no'], 'user' => $data['user']) | ||||
| 		); | ||||
| 		$this->assertSame(Xml::build($expected)->asXML(), $output); | ||||
| 
 | ||||
| 		$Controller->set('_rootNode', 'custom_name'); | ||||
| 		$View = new XmlView($Controller); | ||||
| 		$output = $View->render(false); | ||||
| 		$expected = array( | ||||
| 			'custom_name' => array('no' => $data['no'], 'user' => $data['user']) | ||||
| 		); | ||||
| 		$this->assertSame(Xml::build($expected)->asXML(), $output); | ||||
| 	} | ||||
| 
 | ||||
| /** | ||||
|  * Test render with an array in _serialize and alias | ||||
|  * | ||||
|  * @return void | ||||
|  */ | ||||
| 	public function testRenderWithoutViewMultipleAndAlias() { | ||||
| 		$Request = new CakeRequest(); | ||||
| 		$Response = new CakeResponse(); | ||||
| 		$Controller = new Controller($Request, $Response); | ||||
| 		$data = array('original_name' => 'my epic name', 'user' => 'fake', 'list' => array('item1', 'item2')); | ||||
| 		$Controller->set($data); | ||||
| 		$Controller->set('_serialize', array('new_name' => 'original_name', 'user')); | ||||
| 		$View = new XmlView($Controller); | ||||
| 		$this->assertSame('application/xml', $Response->type()); | ||||
| 		$output = $View->render(false); | ||||
| 		$expected = array( | ||||
| 			'response' => array('new_name' => $data['original_name'], 'user' => $data['user']) | ||||
| 		); | ||||
| 		$this->assertSame(Xml::build($expected)->asXML(), $output); | ||||
| 
 | ||||
| 		$Controller->set('_rootNode', 'custom_name'); | ||||
| 		$View = new XmlView($Controller); | ||||
| 		$output = $View->render(false); | ||||
| 		$expected = array( | ||||
| 			'custom_name' => array('new_name' => $data['original_name'], 'user' => $data['user']) | ||||
| 		); | ||||
| 		$this->assertSame(Xml::build($expected)->asXML(), $output); | ||||
| 	} | ||||
| 
 | ||||
| /** | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Brm Ko
						Brm Ko