mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Adding tests for #2506
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4950 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
2dd02aafba
commit
01ce8392a4
1 changed files with 28 additions and 1 deletions
|
@ -84,7 +84,7 @@
|
|||
var $hasAndBelongsToMany = array('Tag');
|
||||
var $validate = array(
|
||||
'user_id' => VALID_NUMBER,
|
||||
'title' => VALID_NOT_EMPTY,
|
||||
'title' => array('allowEmpty' => false, 'rule' => VALID_NOT_EMPTY),
|
||||
'body' => VALID_NOT_EMPTY
|
||||
);
|
||||
}
|
||||
|
@ -1093,6 +1093,33 @@ function testRecursiveFindAllWithLimit() {
|
|||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
function testValidates() {
|
||||
$this->model =& new Article();
|
||||
|
||||
$data = array('Article' => array('user_id' => '1', 'title' => '', 'body' => 'body'));
|
||||
$result = $this->model->create($data);
|
||||
$this->assertTrue($result);
|
||||
$result = $this->model->validates();
|
||||
$this->assertFalse($result);
|
||||
$this->assertTrue(!empty($this->model->validationErrors));
|
||||
|
||||
$data = array('Article' => array('user_id' => '1', 'title' => 'title', 'body' => 'body'));
|
||||
$result = $this->model->create($data) && $this->model->validates();
|
||||
$this->assertTrue($result);
|
||||
|
||||
$data = array('Article' => array('user_id' => '1', 'title' => '0', 'body' => 'body'));
|
||||
$result = $this->model->create($data);
|
||||
$this->assertTrue($result);
|
||||
$result = $this->model->validates();
|
||||
$this->assertTrue($result);
|
||||
|
||||
$data = array('Article' => array('user_id' => '1', 'title' => 0, 'body' => 'body'));
|
||||
$result = $this->model->create($data);
|
||||
$this->assertTrue($result);
|
||||
$result = $this->model->validates();
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
function testSave() {
|
||||
$this->model =& new User();
|
||||
|
||||
|
|
Loading…
Reference in a new issue