mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 17:16:18 +00:00
Fix casing of validation rules in bake
This commit is contained in:
parent
61602990de
commit
58f38f1667
2 changed files with 10 additions and 10 deletions
|
@ -380,7 +380,7 @@ class ModelTask extends BakeTask {
|
||||||
$default = 1;
|
$default = 1;
|
||||||
foreach ($options as $option) {
|
foreach ($options as $option) {
|
||||||
if ($option{0} !== '_') {
|
if ($option{0} !== '_') {
|
||||||
$choices[$default] = strtolower($option);
|
$choices[$default] = $option;
|
||||||
$default++;
|
$default++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -433,9 +433,9 @@ class ModelTask extends BakeTask {
|
||||||
} elseif ($metaData['type'] === 'string' && $metaData['length'] == 36) {
|
} elseif ($metaData['type'] === 'string' && $metaData['length'] == 36) {
|
||||||
$guess = $methods['uuid'];
|
$guess = $methods['uuid'];
|
||||||
} elseif ($metaData['type'] === 'string') {
|
} elseif ($metaData['type'] === 'string') {
|
||||||
$guess = $methods['notempty'];
|
$guess = $methods['notEmpty'];
|
||||||
} elseif ($metaData['type'] === 'text') {
|
} elseif ($metaData['type'] === 'text') {
|
||||||
$guess = $methods['notempty'];
|
$guess = $methods['notEmpty'];
|
||||||
} elseif ($metaData['type'] === 'integer') {
|
} elseif ($metaData['type'] === 'integer') {
|
||||||
$guess = $methods['numeric'];
|
$guess = $methods['numeric'];
|
||||||
} elseif ($metaData['type'] === 'boolean') {
|
} elseif ($metaData['type'] === 'boolean') {
|
||||||
|
|
|
@ -269,7 +269,7 @@ class ModelTaskTest extends CakeTestCase {
|
||||||
*/
|
*/
|
||||||
public function testInitValidations() {
|
public function testInitValidations() {
|
||||||
$result = $this->Task->initValidations();
|
$result = $this->Task->initValidations();
|
||||||
$this->assertTrue(in_array('notempty', $result));
|
$this->assertTrue(in_array('notEmpty', $result));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -283,7 +283,7 @@ class ModelTaskTest extends CakeTestCase {
|
||||||
$this->Task->initValidations();
|
$this->Task->initValidations();
|
||||||
|
|
||||||
$result = $this->Task->fieldValidation('text', array('type' => 'string', 'length' => 10, 'null' => false));
|
$result = $this->Task->fieldValidation('text', array('type' => 'string', 'length' => 10, 'null' => false));
|
||||||
$expected = array('notempty' => 'notempty');
|
$expected = array('notEmpty' => 'notEmpty');
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
$result = $this->Task->fieldValidation('text', array('type' => 'date', 'length' => 10, 'null' => false));
|
$result = $this->Task->fieldValidation('text', array('type' => 'date', 'length' => 10, 'null' => false));
|
||||||
|
@ -319,7 +319,7 @@ class ModelTaskTest extends CakeTestCase {
|
||||||
->will($this->onConsecutiveCalls('24', 'y', '18', 'n'));
|
->will($this->onConsecutiveCalls('24', 'y', '18', 'n'));
|
||||||
|
|
||||||
$result = $this->Task->fieldValidation('text', array('type' => 'string', 'length' => 10, 'null' => false));
|
$result = $this->Task->fieldValidation('text', array('type' => 'string', 'length' => 10, 'null' => false));
|
||||||
$expected = array('notempty' => 'notempty', 'maxlength' => 'maxlength');
|
$expected = array('notEmpty' => 'notEmpty', 'maxLength' => 'maxLength');
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -340,7 +340,7 @@ class ModelTaskTest extends CakeTestCase {
|
||||||
->with($this->stringContains('make a valid'));
|
->with($this->stringContains('make a valid'));
|
||||||
|
|
||||||
$result = $this->Task->fieldValidation('text', array('type' => 'string', 'length' => 10, 'null' => false));
|
$result = $this->Task->fieldValidation('text', array('type' => 'string', 'length' => 10, 'null' => false));
|
||||||
$expected = array('notempty' => 'notempty');
|
$expected = array('notEmpty' => 'notEmpty');
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -406,7 +406,7 @@ class ModelTaskTest extends CakeTestCase {
|
||||||
$result = $this->Task->doValidation($Model);
|
$result = $this->Task->doValidation($Model);
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'name' => array(
|
'name' => array(
|
||||||
'notempty' => 'notempty'
|
'notEmpty' => 'notEmpty'
|
||||||
),
|
),
|
||||||
'email' => array(
|
'email' => array(
|
||||||
'email' => 'email',
|
'email' => 'email',
|
||||||
|
@ -742,7 +742,7 @@ class ModelTaskTest extends CakeTestCase {
|
||||||
public function testBakeValidation() {
|
public function testBakeValidation() {
|
||||||
$validate = array(
|
$validate = array(
|
||||||
'name' => array(
|
'name' => array(
|
||||||
'notempty' => 'notempty'
|
'notempty' => 'notEmpty'
|
||||||
),
|
),
|
||||||
'email' => array(
|
'email' => array(
|
||||||
'email' => 'email',
|
'email' => 'email',
|
||||||
|
@ -760,7 +760,7 @@ class ModelTaskTest extends CakeTestCase {
|
||||||
$expected = <<< STRINGEND
|
$expected = <<< STRINGEND
|
||||||
array(
|
array(
|
||||||
'notempty' => array(
|
'notempty' => array(
|
||||||
'rule' => array('notempty'),
|
'rule' => array('notEmpty'),
|
||||||
//'message' => 'Your custom message here',
|
//'message' => 'Your custom message here',
|
||||||
//'allowEmpty' => false,
|
//'allowEmpty' => false,
|
||||||
//'required' => false,
|
//'required' => false,
|
||||||
|
|
Loading…
Add table
Reference in a new issue