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 @@
/**
* CakeValidationRuleTest file
*
* PHP 5
*
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
* 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/view/1196/Testing CakePHP(tm) Tests
* @package Cake.Test.Case.Model.Validator
* @since CakePHP(tm) v 2.2.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('CakeValidationRule', 'Model/Validator');
@ -29,8 +28,8 @@ class CakeValidationRuleTest extends CakeTestCase {
/**
* Auxiliary method to test custom validators
*
* @return boolean
**/
* @return bool
*/
public function myTestRule() {
return false;
}
@ -38,8 +37,8 @@ class CakeValidationRuleTest extends CakeTestCase {
/**
* Auxiliary method to test custom validators
*
* @return boolean
**/
* @return bool
*/
public function myTestRule2() {
return true;
}
@ -48,7 +47,7 @@ class CakeValidationRuleTest extends CakeTestCase {
* Auxiliary method to test custom validators
*
* @return string
**/
*/
public function myTestRule3() {
return 'string';
}
@ -59,7 +58,7 @@ class CakeValidationRuleTest extends CakeTestCase {
* @return void
*/
public function testIsValid() {
$def = array('rule' => 'notEmpty', 'message' => 'Can not be empty');
$def = array('rule' => 'notBlank', 'message' => 'Can not be empty');
$data = array(
'fieldName' => ''
);
@ -123,19 +122,19 @@ class CakeValidationRuleTest extends CakeTestCase {
* @return void
*/
public function testIsRequired() {
$def = array('rule' => 'notEmpty', 'required' => true);
$def = array('rule' => 'notBlank', 'required' => true);
$Rule = new CakeValidationRule($def);
$this->assertTrue($Rule->isRequired());
$def = array('rule' => 'notEmpty', 'required' => false);
$def = array('rule' => 'notBlank', 'required' => false);
$Rule = new CakeValidationRule($def);
$this->assertFalse($Rule->isRequired());
$def = array('rule' => 'notEmpty', 'required' => 'create');
$def = array('rule' => 'notBlank', 'required' => 'create');
$Rule = new CakeValidationRule($def);
$this->assertTrue($Rule->isRequired());
$def = array('rule' => 'notEmpty', 'required' => 'update');
$def = array('rule' => 'notBlank', 'required' => 'update');
$Rule = new CakeValidationRule($def);
$this->assertFalse($Rule->isRequired());
@ -157,14 +156,14 @@ class CakeValidationRuleTest extends CakeTestCase {
$Rule = new CakeValidationRule($def);
$this->assertFalse($Rule->isEmptyAllowed());
$def = array('rule' => 'notEmpty', 'allowEmpty' => false, 'on' => 'update');
$def = array('rule' => 'notBlank', 'allowEmpty' => false, 'on' => 'update');
$Rule = new CakeValidationRule($def);
$this->assertTrue($Rule->isEmptyAllowed());
$Rule->isUpdate(true);
$this->assertFalse($Rule->isEmptyAllowed());
$def = array('rule' => 'notEmpty', 'allowEmpty' => false, 'on' => 'create');
$def = array('rule' => 'notBlank', 'allowEmpty' => false, 'on' => 'create');
$Rule = new CakeValidationRule($def);
$this->assertFalse($Rule->isEmptyAllowed());