Skip to content

Commit

Permalink
Removing VALID_NUMBER and VALID_NOT_EMPTY from tests, applying patch …
Browse files Browse the repository at this point in the history
…from 'jperras'. Fixes #5901

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7999 3807eeeb-6ff5-0310-8944-8be069107fe0
  • Loading branch information
renan committed Jan 15, 2009
1 parent de5cb3c commit 157ee1e
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion cake/tests/cases/libs/model/behaviors/translate.test.php
Expand Up @@ -540,7 +540,7 @@ function testMultipleUpdate() {

$TestModel =& new TranslatedItem();
$TestModel->locale = 'eng';
$TestModel->validate['title'] = VALID_NOT_EMPTY;
$TestModel->validate['title'] = 'notEmpty';
$data = array('TranslatedItem' => array(
'id' => 1,
'title' => array('eng' => 'New Title #1', 'deu' => 'Neue Titel #1', 'cze' => 'Novy Titulek #1'),
Expand Down
36 changes: 18 additions & 18 deletions cake/tests/cases/libs/model/model.test.php
Expand Up @@ -2201,9 +2201,9 @@ function testValidates() {
$TestModel =& new TestValidate();

$TestModel->validate = array(
'user_id' => VALID_NUMBER,
'title' => array('allowEmpty' => false, 'rule' => VALID_NOT_EMPTY),
'body' => VALID_NOT_EMPTY
'user_id' => 'numeric',
'title' => array('allowEmpty' => false, 'rule' => 'notEmpty'),
'body' => 'notEmpty'
);

$data = array('TestValidate' => array('user_id' => '1', 'title' => '', 'body' => 'body'));
Expand Down Expand Up @@ -2308,7 +2308,7 @@ function testValidates() {

$TestModel->validate = array(
'number' => array('rule' => 'validateNumber', 'min' => 3, 'max' => 5),
'title' => array('allowEmpty' => false, 'rule' => VALID_NOT_EMPTY)
'title' => array('allowEmpty' => false, 'rule' => 'notEmpty')
);

$data = array('TestValidate' => array('title' => 'title', 'number' => '0'));
Expand Down Expand Up @@ -2337,7 +2337,7 @@ function testValidates() {

$TestModel->validate = array(
'number' => array('rule' => 'validateNumber', 'min' => 5, 'max' => 10),
'title' => array('allowEmpty' => false, 'rule' => VALID_NOT_EMPTY)
'title' => array('allowEmpty' => false, 'rule' => 'notEmpty')
);

$data = array('TestValidate' => array('title' => 'title', 'number' => '3'));
Expand Down Expand Up @@ -3307,8 +3307,8 @@ function testSaveAllHasOneValidation() {
$model->Attachment->deleteAll(true);
$this->assertEqual($model->Attachment->find('all'), array());

$model->validate = array('comment' => VALID_NOT_EMPTY);
$model->Attachment->validate = array('attachment' => VALID_NOT_EMPTY);
$model->validate = array('comment' => 'notEmpty');
$model->Attachment->validate = array('attachment' => 'notEmpty');
$model->Attachment->bind('Comment');

$this->assertFalse($model->saveAll(
Expand Down Expand Up @@ -3358,7 +3358,7 @@ function testSaveAllAtomic() {
), array('atomic' => false));
$this->assertIdentical($result, array(true, true, true));

$TestModel->validate = array('title' => VALID_NOT_EMPTY, 'author_id' => 'numeric');
$TestModel->validate = array('title' => 'notEmpty', 'author_id' => 'numeric');
$result = $TestModel->saveAll(array(
array('id' => '1', 'title' => 'Un-Baleeted First Post', 'body' => 'Not Baleeted!', 'published' => 'Y'),
array('id' => '2', 'title' => '', 'body' => 'Trying to get away with an empty title'),
Expand Down Expand Up @@ -3439,7 +3439,7 @@ function testSaveAllHasManyValidation() {
$this->loadFixtures('Article', 'Comment');
$TestModel =& new Article();
$TestModel->belongsTo = $TestModel->hasAndBelongsToMany = array();
$TestModel->Comment->validate = array('comment' => VALID_NOT_EMPTY);
$TestModel->Comment->validate = array('comment' => 'notEmpty');

$result = $TestModel->saveAll(array(
'Article' => array('id' => 2),
Expand Down Expand Up @@ -3476,7 +3476,7 @@ function testSaveAllTransaction() {
$this->loadFixtures('Post', 'Author', 'Comment', 'Attachment');
$TestModel =& new Post();

$TestModel->validate = array('title' => VALID_NOT_EMPTY);
$TestModel->validate = array('title' => 'notEmpty');
$data = array(
array('author_id' => 1, 'title' => 'New Fourth Post'),
array('author_id' => 1, 'title' => 'New Fifth Post'),
Expand Down Expand Up @@ -3523,7 +3523,7 @@ function testSaveAllTransaction() {
}
$this->assertEqual($result, $expected);

$TestModel->validate = array('title' => VALID_NOT_EMPTY);
$TestModel->validate = array('title' => 'notEmpty');
$data = array(
array('author_id' => 1, 'title' => 'New Fourth Post'),
array('author_id' => 1, 'title' => 'New Fifth Post'),
Expand Down Expand Up @@ -3569,7 +3569,7 @@ function testSaveAllValidation() {
);
$this->assertEqual($result, $expected);

$TestModel->validate = array('title' => VALID_NOT_EMPTY, 'author_id' => 'numeric');
$TestModel->validate = array('title' => 'notEmpty', 'author_id' => 'numeric');
$data = array(
array('id' => '1', 'title' => 'Un-Baleeted First Post', 'body' => 'Not Baleeted!', 'published' => 'Y'),
array('id' => '2', 'title' => '', 'body' => 'Trying to get away with an empty title'),
Expand All @@ -3587,7 +3587,7 @@ function testSaveAllValidation() {

$this->assertEqual($TestModel->validationErrors, $errors);

$TestModel->validate = array('title' => VALID_NOT_EMPTY, 'author_id' => 'numeric');
$TestModel->validate = array('title' => 'notEmpty', 'author_id' => 'numeric');
$data = array(
array('id' => '1', 'title' => 'Un-Baleeted First Post', 'body' => 'Not Baleeted!', 'published' => 'Y'),
array('id' => '2', 'title' => '', 'body' => 'Trying to get away with an empty title'),
Expand Down Expand Up @@ -3620,7 +3620,7 @@ function testSaveAllValidation() {
array('title' => 'First new post', 'body' => 'Woohoo!', 'published' => 'Y'),
array('title' => 'Empty body', 'body' => '')
);
$TestModel->validate['body'] = VALID_NOT_EMPTY;
$TestModel->validate['body'] = 'notEmpty';
}
/**
* testSaveAllValidationOnly method
Expand All @@ -3630,7 +3630,7 @@ function testSaveAllValidation() {
*/
function testSaveAllValidationOnly() {
$TestModel =& new Comment();
$TestModel->Attachment->validate = array('attachment' => VALID_NOT_EMPTY);
$TestModel->Attachment->validate = array('attachment' => 'notEmpty');

$data = array(
'Comment' => array(
Expand All @@ -3645,7 +3645,7 @@ function testSaveAllValidationOnly() {
$this->assertFalse($result);

$TestModel =& new Article();
$TestModel->validate = array('title' => VALID_NOT_EMPTY);
$TestModel->validate = array('title' => 'notEmpty');
$result = $TestModel->saveAll(
array(
0 => array('title' => ''),
Expand Down Expand Up @@ -3685,7 +3685,7 @@ function testSaveAllValidateFirst() {
$model =& new Article();
$model->deleteAll(true);

$model->Comment->validate = array('comment' => VALID_NOT_EMPTY);
$model->Comment->validate = array('comment' => 'notEmpty');
$result = $model->saveAll(array(
'Article' => array('title' => 'Post with Author', 'body' => 'This post will be saved author'),
'Comment' => array(
Expand Down Expand Up @@ -6216,7 +6216,7 @@ function testSaveAllHasManyValidationOnly() {
$this->loadFixtures('Article', 'Comment');
$TestModel =& new Article();
$TestModel->belongsTo = $TestModel->hasAndBelongsToMany = array();
$TestModel->Comment->validate = array('comment' => VALID_NOT_EMPTY);
$TestModel->Comment->validate = array('comment' => 'notEmpty');

$result = $TestModel->saveAll(
array(
Expand Down
22 changes: 11 additions & 11 deletions cake/tests/cases/libs/model/models.php
Expand Up @@ -186,7 +186,7 @@ class User extends CakeTestModel {
* @var array
* @access public
*/
var $validate = array('user' => VALID_NOT_EMPTY, 'password' => VALID_NOT_EMPTY);
var $validate = array('user' => 'notEmpty', 'password' => 'notEmpty');
}
/**
* Article class
Expand Down Expand Up @@ -229,7 +229,7 @@ class Article extends CakeTestModel {
* @var array
* @access public
*/
var $validate = array('user_id' => VALID_NUMBER, 'title' => array('allowEmpty' => false, 'rule' => VALID_NOT_EMPTY), 'body' => VALID_NOT_EMPTY);
var $validate = array('user_id' => 'numeric', 'title' => array('allowEmpty' => false, 'rule' => 'notEmpty'), 'body' => 'notEmpty');
/**
* beforeSaveReturn property
*
Expand Down Expand Up @@ -359,7 +359,7 @@ class ArticleFeatured extends CakeTestModel {
* @var array
* @access public
*/
var $validate = array('user_id' => VALID_NUMBER, 'title' => VALID_NOT_EMPTY, 'body' => VALID_NOT_EMPTY);
var $validate = array('user_id' => 'numeric', 'title' => 'notEmpty', 'body' => 'notEmpty');
}
/**
* Featured class
Expand Down Expand Up @@ -632,7 +632,7 @@ class Apple extends CakeTestModel {
* @var array
* @access public
*/
var $validate = array('name' => VALID_NOT_EMPTY);
var $validate = array('name' => 'notEmpty');
/**
* hasOne property
*
Expand Down Expand Up @@ -941,7 +941,7 @@ class NodeAfterFind extends CakeTestModel {
* @var array
* @access public
*/
var $validate = array('name' => VALID_NOT_EMPTY);
var $validate = array('name' => 'notEmpty');
/**
* useTable property
*
Expand Down Expand Up @@ -1030,7 +1030,7 @@ class NodeNoAfterFind extends CakeTestModel {
* @var array
* @access public
*/
var $validate = array('name' => VALID_NOT_EMPTY);
var $validate = array('name' => 'notEmpty');
/**
* useTable property
*
Expand Down Expand Up @@ -1839,10 +1839,10 @@ class ValidationTest extends CakeTestModel {
* @access public
*/
var $validate = array(
'title' => VALID_NOT_EMPTY,
'title' => 'notEmpty',
'published' => 'customValidationMethod',
'body' => array(
VALID_NOT_EMPTY,
'notEmpty',
'/^.{5,}$/s' => 'no matchy',
'/^[0-9A-Za-z \\.]{1,}$/s'
)
Expand Down Expand Up @@ -1905,10 +1905,10 @@ class ValidationTest2 extends CakeTestModel {
* @access public
*/
var $validate = array(
'title' => VALID_NOT_EMPTY,
'title' => 'notEmpty',
'published' => 'customValidationMethod',
'body' => array(
VALID_NOT_EMPTY,
'notEmpty',
'/^.{5,}$/s' => 'no matchy',
'/^[0-9A-Za-z \\.]{1,}$/s'
)
Expand Down Expand Up @@ -2025,7 +2025,7 @@ class Story extends CakeTestModel {
* @var array
* @access public
*/
var $validate = array('title' => VALID_NOT_EMPTY);
var $validate = array('title' => 'notEmpty');
}
/**
* Cd class
Expand Down

0 comments on commit 157ee1e

Please sign in to comment.