mirror of
https://github.com/brmlab/brmsklad.git
synced 2025-08-05 15:43:53 +02: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 @@
|
|||
*
|
||||
* TestCase for the JsHelper
|
||||
*
|
||||
* 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.Helper
|
||||
* @since CakePHP(tm) v 1.3
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
App::uses('HtmlHelper', 'View/Helper');
|
||||
App::uses('JsHelper', 'View/Helper');
|
||||
App::uses('JsBaseEngineHelper', 'View/Helper');
|
||||
|
@ -25,6 +25,11 @@ App::uses('FormHelper', 'View/Helper');
|
|||
App::uses('View', 'View');
|
||||
App::uses('ClassRegistry', 'Utility');
|
||||
|
||||
/**
|
||||
* JsEncodingObject
|
||||
*
|
||||
* @package Cake.Test.Case.View.Helper
|
||||
*/
|
||||
class JsEncodingObject {
|
||||
|
||||
protected $_title = 'Old thing';
|
||||
|
@ -35,6 +40,11 @@ class JsEncodingObject {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* OptionEngineHelper
|
||||
*
|
||||
* @package Cake.Test.Case.View.Helper
|
||||
*/
|
||||
class OptionEngineHelper extends JsBaseEngineHelper {
|
||||
|
||||
protected $_optionMap = array(
|
||||
|
@ -48,6 +58,7 @@ class OptionEngineHelper extends JsBaseEngineHelper {
|
|||
/**
|
||||
* test method for testing option mapping
|
||||
*
|
||||
* @param array $options
|
||||
* @return array
|
||||
*/
|
||||
public function testMap($options = array()) {
|
||||
|
@ -57,6 +68,8 @@ class OptionEngineHelper extends JsBaseEngineHelper {
|
|||
/**
|
||||
* test method for option parsing
|
||||
*
|
||||
* @param $options
|
||||
* @param array $safe
|
||||
* @return void
|
||||
*/
|
||||
public function testParseOptions($options, $safe = array()) {
|
||||
|
@ -161,13 +174,8 @@ class JsHelperTest extends CakeTestCase {
|
|||
protected function _useMock() {
|
||||
$request = new CakeRequest(null, false);
|
||||
|
||||
if (!class_exists('TestJsEngineHelper', false)) {
|
||||
$this->getMock('JsBaseEngineHelper', array(), array($this->View), 'TestJsEngineHelper');
|
||||
}
|
||||
|
||||
$this->Js = new JsHelper($this->View, array('TestJs'));
|
||||
$this->Js->TestJsEngine = new TestJsEngineHelper($this->View);
|
||||
$this->mockObjects[] = $this->Js->TestJsEngine;
|
||||
$this->Js->TestJsEngine = $this->getMock('JsBaseEngineHelper', array(), array($this->View));
|
||||
$this->Js->request = $request;
|
||||
$this->Js->Html = new HtmlHelper($this->View);
|
||||
$this->Js->Html->request = $request;
|
||||
|
@ -319,7 +327,7 @@ class JsHelperTest extends CakeTestCase {
|
|||
->method('append')
|
||||
->with('script', $this->matchesRegularExpression('#<script type="text\/javascript">window.app \= \{"foo"\:1\}\;<\/script>#'));
|
||||
|
||||
$result = $this->Js->writeBuffer(array('onDomReady' => false, 'inline' => false, 'safe' => false));
|
||||
$this->Js->writeBuffer(array('onDomReady' => false, 'inline' => false, 'safe' => false));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -338,7 +346,7 @@ class JsHelperTest extends CakeTestCase {
|
|||
|
||||
$this->Js->buffer('alert("test");');
|
||||
$this->Js->TestJsEngine->expects($this->never())->method('domReady');
|
||||
$result = $this->Js->writeBuffer();
|
||||
$this->Js->writeBuffer();
|
||||
|
||||
unset($_SERVER['HTTP_X_REQUESTED_WITH']);
|
||||
if ($requestWith !== null) {
|
||||
|
@ -352,11 +360,11 @@ class JsHelperTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testWriteScriptsInFile() {
|
||||
$this->skipIf(!is_writable(JS), 'webroot/js is not Writable, script caching test has been skipped.');
|
||||
$this->skipIf(!is_writable(WWW_ROOT . 'js'), 'webroot/js is not Writable, script caching test has been skipped.');
|
||||
|
||||
Configure::write('Cache.disable', false);
|
||||
$this->Js->request->webroot = '/';
|
||||
$this->Js->JsBaseEngine = new TestJsEngineHelper($this->View);
|
||||
$this->Js->JsBaseEngine = $this->getMock('JsBaseEngineHelper', array(), array($this->View));
|
||||
$this->Js->buffer('one = 1;');
|
||||
$this->Js->buffer('two = 2;');
|
||||
$result = $this->Js->writeBuffer(array('onDomReady' => false, 'cache' => true));
|
||||
|
@ -684,7 +692,7 @@ class JsHelperTest extends CakeTestCase {
|
|||
}
|
||||
|
||||
/**
|
||||
* test set()'ing variables to the Javascript buffer and controlling the output var name.
|
||||
* test set()'ing variables to the JavaScript buffer and controlling the output var name.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
@ -858,7 +866,7 @@ class JsBaseEngineTest extends CakeTestCase {
|
|||
|
||||
$object = new JsEncodingObject();
|
||||
$object->title = 'New thing';
|
||||
$object->indexes = array(5,6,7,8);
|
||||
$object->indexes = array(5, 6, 7, 8);
|
||||
$result = $this->JsEngine->object($object);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue