mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Fix coding standards.
This commit is contained in:
parent
2ad406ab64
commit
16a1a0ee79
5 changed files with 17 additions and 26 deletions
|
@ -302,7 +302,7 @@ class ModelValidator implements ArrayAccess, IteratorAggregate, Countable {
|
||||||
public function getField($name = null) {
|
public function getField($name = null) {
|
||||||
if ($name !== null && !empty($this->_fields[$name])) {
|
if ($name !== null && !empty($this->_fields[$name])) {
|
||||||
return $this->_fields[$name];
|
return $this->_fields[$name];
|
||||||
} elseif ($name !==null) {
|
} elseif ($name !== null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return $this->_fields;
|
return $this->_fields;
|
||||||
|
|
|
@ -206,7 +206,7 @@ class CakeValidationRule {
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function isLast() {
|
public function isLast() {
|
||||||
return (bool) $this->last;
|
return (bool)$this->last;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -269,7 +269,7 @@ class CakeValidationRule {
|
||||||
if (isset($methods[$rule])) {
|
if (isset($methods[$rule])) {
|
||||||
$this->_ruleParams[] = array_merge($validator, $this->_passedOptions);
|
$this->_ruleParams[] = array_merge($validator, $this->_passedOptions);
|
||||||
$this->_ruleParams[0] = array($field => $this->_ruleParams[0]);
|
$this->_ruleParams[0] = array($field => $this->_ruleParams[0]);
|
||||||
$this->_valid = call_user_func_array($methods[$rule], $this->_ruleParams);
|
$this->_valid = call_user_func_array($methods[$rule], $this->_ruleParams);
|
||||||
} elseif (class_exists('Validation') && method_exists('Validation', $this->_rule)) {
|
} elseif (class_exists('Validation') && method_exists('Validation', $this->_rule)) {
|
||||||
$this->_valid = call_user_func_array(array('Validation', $this->_rule), $this->_ruleParams);
|
$this->_valid = call_user_func_array(array('Validation', $this->_rule), $this->_ruleParams);
|
||||||
} elseif (is_string($validator['rule'])) {
|
} elseif (is_string($validator['rule'])) {
|
||||||
|
|
|
@ -34,8 +34,8 @@ class ModelTest extends PHPUnit_Framework_TestSuite {
|
||||||
public static function suite() {
|
public static function suite() {
|
||||||
$suite = new PHPUnit_Framework_TestSuite('All Model related class tests');
|
$suite = new PHPUnit_Framework_TestSuite('All Model related class tests');
|
||||||
|
|
||||||
$suite->addTestFile(CORE_TEST_CASES . DS . 'Model' . DS . 'Validator' . DS .'CakeValidationSetTest.php');
|
$suite->addTestFile(CORE_TEST_CASES . DS . 'Model' . DS . 'Validator' . DS . 'CakeValidationSetTest.php');
|
||||||
$suite->addTestFile(CORE_TEST_CASES . DS . 'Model' . DS . 'Validator' . DS .'CakeValidationRuleTest.php');
|
$suite->addTestFile(CORE_TEST_CASES . DS . 'Model' . DS . 'Validator' . DS . 'CakeValidationRuleTest.php');
|
||||||
$suite->addTestFile(CORE_TEST_CASES . DS . 'Model' . DS . 'ModelReadTest.php');
|
$suite->addTestFile(CORE_TEST_CASES . DS . 'Model' . DS . 'ModelReadTest.php');
|
||||||
$suite->addTestFile(CORE_TEST_CASES . DS . 'Model' . DS . 'ModelWriteTest.php');
|
$suite->addTestFile(CORE_TEST_CASES . DS . 'Model' . DS . 'ModelWriteTest.php');
|
||||||
$suite->addTestFile(CORE_TEST_CASES . DS . 'Model' . DS . 'ModelDeleteTest.php');
|
$suite->addTestFile(CORE_TEST_CASES . DS . 'Model' . DS . 'ModelDeleteTest.php');
|
||||||
|
|
|
@ -1090,8 +1090,8 @@ class ModelValidationTest extends BaseModelTest {
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'Article' => true,
|
'Article' => true,
|
||||||
'Comment' => array(
|
'Comment' => array(
|
||||||
true,
|
true,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$result = $TestModel->saveAll($data, array('validate' => 'only', 'atomic' => false, 'deep' => true));
|
$result = $TestModel->saveAll($data, array('validate' => 'only', 'atomic' => false, 'deep' => true));
|
||||||
|
@ -1109,8 +1109,8 @@ class ModelValidationTest extends BaseModelTest {
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'Article' => true,
|
'Article' => true,
|
||||||
'Comment' => array(
|
'Comment' => array(
|
||||||
false,
|
false,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$result = $TestModel->saveAll($data, array('validate' => 'only', 'atomic' => false, 'deep' => true));
|
$result = $TestModel->saveAll($data, array('validate' => 'only', 'atomic' => false, 'deep' => true));
|
||||||
|
@ -1152,8 +1152,8 @@ class ModelValidationTest extends BaseModelTest {
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'Article' => true,
|
'Article' => true,
|
||||||
'Comment' => array(
|
'Comment' => array(
|
||||||
true,
|
true,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$result = $TestModel->saveAll($data, array('validate' => 'only', 'atomic' => false, 'deep' => true));
|
$result = $TestModel->saveAll($data, array('validate' => 'only', 'atomic' => false, 'deep' => true));
|
||||||
|
@ -1171,8 +1171,8 @@ class ModelValidationTest extends BaseModelTest {
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'Article' => true,
|
'Article' => true,
|
||||||
'Comment' => array(
|
'Comment' => array(
|
||||||
true,
|
true,
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$result = $TestModel->saveAll($data, array('validate' => 'only', 'atomic' => false, 'deep' => true));
|
$result = $TestModel->saveAll($data, array('validate' => 'only', 'atomic' => false, 'deep' => true));
|
||||||
|
@ -1394,8 +1394,8 @@ class ModelValidationTest extends BaseModelTest {
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'Article' => true,
|
'Article' => true,
|
||||||
'Comment' => array(
|
'Comment' => array(
|
||||||
true,
|
true,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$result = $TestModel->saveAll($data, array('validate' => 'only', 'atomic' => false, 'deep' => false));
|
$result = $TestModel->saveAll($data, array('validate' => 'only', 'atomic' => false, 'deep' => false));
|
||||||
|
@ -1425,8 +1425,8 @@ class ModelValidationTest extends BaseModelTest {
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'Article' => true,
|
'Article' => true,
|
||||||
'Comment' => array(
|
'Comment' => array(
|
||||||
true,
|
true,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$result = $TestModel->saveAll($data, array('validate' => 'only', 'atomic' => false, 'deep' => false));
|
$result = $TestModel->saveAll($data, array('validate' => 'only', 'atomic' => false, 'deep' => false));
|
||||||
|
|
|
@ -26,15 +26,6 @@ App::uses('CakeValidationRule', 'Model/Validator');
|
||||||
*/
|
*/
|
||||||
class CakeValidationRuleTest extends CakeTestCase {
|
class CakeValidationRuleTest extends CakeTestCase {
|
||||||
|
|
||||||
/**
|
|
||||||
* setUp method
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function setUp() {
|
|
||||||
parent::setUp();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Auxiliary method to test custom validators
|
* Auxiliary method to test custom validators
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue