mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
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:
parent
14b17fed39
commit
616fac0f99
1 changed files with 19 additions and 1 deletions
|
@ -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(
|
||||
|
|
Loading…
Add table
Reference in a new issue