Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix casing of validation rules in bake

  • Loading branch information...
commit 58f38f1667c56f82385df836c094d2c15c3a13b1 1 parent 6160299
@dereuromark dereuromark authored
View
6 lib/Cake/Console/Command/Task/ModelTask.php
@@ -380,7 +380,7 @@ public function initValidations() {
$default = 1;
foreach ($options as $option) {
if ($option{0} !== '_') {
- $choices[$default] = strtolower($option);
+ $choices[$default] = $option;
$default++;
}
}
@@ -433,9 +433,9 @@ public function fieldValidation($fieldName, $metaData, $primaryKey = 'id') {
} elseif ($metaData['type'] === 'string' && $metaData['length'] == 36) {
$guess = $methods['uuid'];
} elseif ($metaData['type'] === 'string') {
- $guess = $methods['notempty'];
+ $guess = $methods['notEmpty'];
} elseif ($metaData['type'] === 'text') {
- $guess = $methods['notempty'];
+ $guess = $methods['notEmpty'];
} elseif ($metaData['type'] === 'integer') {
$guess = $methods['numeric'];
} elseif ($metaData['type'] === 'boolean') {
View
14 lib/Cake/Test/Case/Console/Command/Task/ModelTaskTest.php
@@ -269,7 +269,7 @@ public function testGetTableOddTable() {
*/
public function testInitValidations() {
$result = $this->Task->initValidations();
- $this->assertTrue(in_array('notempty', $result));
+ $this->assertTrue(in_array('notEmpty', $result));
}
/**
@@ -283,7 +283,7 @@ public function testFieldValidationGuessing() {
$this->Task->initValidations();
$result = $this->Task->fieldValidation('text', array('type' => 'string', 'length' => 10, 'null' => false));
- $expected = array('notempty' => 'notempty');
+ $expected = array('notEmpty' => 'notEmpty');
$this->assertEquals($expected, $result);
$result = $this->Task->fieldValidation('text', array('type' => 'date', 'length' => 10, 'null' => false));
@@ -319,7 +319,7 @@ public function testInteractiveFieldValidation() {
->will($this->onConsecutiveCalls('24', 'y', '18', 'n'));
$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);
}
@@ -340,7 +340,7 @@ public function testInteractiveFieldValidationWithBogusResponse() {
->with($this->stringContains('make a valid'));
$result = $this->Task->fieldValidation('text', array('type' => 'string', 'length' => 10, 'null' => false));
- $expected = array('notempty' => 'notempty');
+ $expected = array('notEmpty' => 'notEmpty');
$this->assertEquals($expected, $result);
}
@@ -406,7 +406,7 @@ public function testNonInteractiveDoValidation() {
$result = $this->Task->doValidation($Model);
$expected = array(
'name' => array(
- 'notempty' => 'notempty'
+ 'notEmpty' => 'notEmpty'
),
'email' => array(
'email' => 'email',
@@ -742,7 +742,7 @@ public function testInOptions() {
public function testBakeValidation() {
$validate = array(
'name' => array(
- 'notempty' => 'notempty'
+ 'notempty' => 'notEmpty'
),
'email' => array(
'email' => 'email',
@@ -760,7 +760,7 @@ public function testBakeValidation() {
$expected = <<< STRINGEND
array(
'notempty' => array(
- 'rule' => array('notempty'),
+ 'rule' => array('notEmpty'),
//'message' => 'Your custom message here',
//'allowEmpty' => false,
//'required' => false,
Please sign in to comment.
Something went wrong with that request. Please try again.