Permalink
Browse files

Adjust bake, docblocks and tests for notBlank.

  • Loading branch information...
dereuromark committed May 17, 2015
1 parent 8662426 commit 4f3602ad5ffcd9a517054e2c41a3450ffaf545f0
@@ -443,9 +443,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['notBlank'];
} elseif ($metaData['type'] === 'text') {
$guess = $methods['notEmpty'];
$guess = $methods['notBlank'];
} elseif ($metaData['type'] === 'integer') {
$guess = $methods['numeric'];
} elseif ($metaData['type'] === 'float') {
View
@@ -134,7 +134,7 @@ class Model extends Object implements CakeEventListener {
*
* ```
* public $validate = array(
* 'name' => 'notEmpty'
* 'name' => 'notBlank'
* );
* ```
*
@@ -537,7 +537,7 @@ public function count() {
*
* ```
* $validator
* ->add('title', 'required', array('rule' => 'notEmpty', 'required' => true))
* ->add('title', 'required', array('rule' => 'notBlank', 'required' => true))
* ->add('user_id', 'valid', array('rule' => 'numeric', 'message' => 'Invalid User'))
*
* $validator->add('password', array(
@@ -185,7 +185,7 @@ public function getRules() {
*
* ```
* $set
* ->setRule('required', array('rule' => 'notEmpty', 'required' => true))
* ->setRule('required', array('rule' => 'notBlank', 'required' => true))
* ->setRule('between', array('rule' => array('lengthBetween', 4, 10))
* ```
*
@@ -227,7 +227,7 @@ public function removeRule($name) {
*
* ```
* $set->setRules(array(
* 'required' => array('rule' => 'notEmpty', 'required' => true),
* 'required' => array('rule' => 'notBlank', 'required' => true),
* 'inRange' => array('rule' => array('between', 4, 10)
* ));
* ```
@@ -268,7 +268,7 @@ public function testGetTableOddTable() {
*/
public function testInitValidations() {
$result = $this->Task->initValidations();
$this->assertTrue(in_array('notEmpty', $result));
$this->assertTrue(in_array('notBlank', $result));
}
/**
@@ -282,7 +282,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('notBlank' => 'notBlank');
$this->assertEquals($expected, $result);
$result = $this->Task->fieldValidation('text', array('type' => 'date', 'length' => 10, 'null' => false));
@@ -318,7 +318,7 @@ public function testInteractiveFieldValidation() {
->will($this->onConsecutiveCalls('25', 'y', '19', 'n'));
$result = $this->Task->fieldValidation('text', array('type' => 'string', 'length' => 10, 'null' => false));
$expected = array('notEmpty' => 'notEmpty', 'maxLength' => 'maxLength');
$expected = array('notBlank' => 'notBlank', 'maxLength' => 'maxLength');
$this->assertEquals($expected, $result);
}
@@ -339,7 +339,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('notBlank' => 'notBlank');
$this->assertEquals($expected, $result);
}
@@ -371,7 +371,7 @@ public function testSkippingChoiceInteractiveFieldValidation() {
->will($this->onConsecutiveCalls('25', 'y', 's'));
$result = $this->Task->fieldValidation('text', array('type' => 'string', 'length' => 10, 'null' => false));
$expected = array('notEmpty' => 'notEmpty', '_skipFields' => true);
$expected = array('notBlank' => 'notBlank', '_skipFields' => true);
$this->assertEquals($expected, $result);
}
@@ -387,7 +387,7 @@ public function testSkippingAnotherInteractiveFieldValidation() {
->will($this->onConsecutiveCalls('25', 's'));
$result = $this->Task->fieldValidation('text', array('type' => 'string', 'length' => 10, 'null' => false));
$expected = array('notEmpty' => 'notEmpty', '_skipFields' => true);
$expected = array('notBlank' => 'notBlank', '_skipFields' => true);
$this->assertEquals($expected, $result);
}
@@ -444,7 +444,7 @@ public function testInteractiveDoValidationWithSkipping() {
$result = $this->Task->doValidation($Model);
$expected = array(
'name' => array(
'notEmpty' => 'notEmpty'
'notBlank' => 'notBlank'
),
'email' => array(
'email' => 'email',
@@ -502,7 +502,7 @@ public function testNonInteractiveDoValidation() {
$result = $this->Task->doValidation($Model);
$expected = array(
'name' => array(
'notEmpty' => 'notEmpty'
'notBlank' => 'notBlank'
),
'email' => array(
'email' => 'email',
@@ -838,7 +838,7 @@ public function testInOptions() {
public function testBakeValidation() {
$validate = array(
'name' => array(
'notempty' => 'notEmpty'
'notBlank' => 'notBlank'
),
'email' => array(
'email' => 'email',
@@ -855,8 +855,8 @@ public function testBakeValidation() {
$this->assertRegExp('/\$validate \= array\(/', $result);
$expected = <<< STRINGEND
array(
'notempty' => array(
'rule' => array('notEmpty'),
'notBlank' => array(
'rule' => array('notBlank'),
//'message' => 'Your custom message here',
//'allowEmpty' => false,
//'required' => false,
@@ -1106,7 +1106,7 @@ public function testValidateErrorsOnArbitraryModels() {
$TestController = new TestController();
$Post = new ControllerPost();
$Post->validate = array('title' => 'notEmpty');
$Post->validate = array('title' => 'notBlank');
$Post->set('title', '');
$result = $TestController->validateErrors($Post);
@@ -942,7 +942,7 @@ public function testMultipleUpdate() {
$TestModel = new TranslatedItem();
$TestModel->locale = 'eng';
$TestModel->validate['title'] = 'notEmpty';
$TestModel->validate['title'] = 'notBlank';
$data = array('TranslatedItem' => array(
'id' => 1,
'title' => array('eng' => 'New Title #1', 'deu' => 'Neue Titel #1', 'cze' => 'Novy Titulek #1'),
Oops, something went wrong.

0 comments on commit 4f3602a

Please sign in to comment.