Applied patch from 'grigri' updating Model test to clear possible mis-interpretation of test cases. Closes #5439

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7612 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
mark_story 2008-09-16 17:17:24 +00:00
parent 14b17fed39
commit 616fac0f99

View file

@ -2101,7 +2101,25 @@ class ModelTest extends CakeTestCase {
$TestModel->validate = array(
'title' => array(
'tooShort' => array('rule' => array('minLength', 50)),
'onlyLetters' => array('rule' => '/[a-z]+/i')
'onlyLetters' => array('rule' => '/^[a-z]+$/i')
),
);
$data = array('TestValidate' => array(
'title' => 'I am a short string'
));
$TestModel->create($data);
$result = $TestModel->validates();
$this->assertFalse($result);
$result = $TestModel->validationErrors;
$expected = array(
'title' => 'onlyLetters'
);
$this->assertEqual($result, $expected);
$TestModel->validate = array(
'title' => array(
'tooShort' => array('rule' => array('minLength', 50), 'last' => true),
'onlyLetters' => array('rule' => '/^[a-z]+$/i')
),
);
$data = array('TestValidate' => array(