mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 10:36:16 +00:00
Improving test readability
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6817 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
81b57b7d5d
commit
db11f9ef91
1 changed files with 5 additions and 5 deletions
|
@ -2241,7 +2241,8 @@ class ModelTest extends CakeTestCase {
|
||||||
array('id' => '1', 'title' => 'Un-Baleeted First Post', 'body' => 'Not Baleeted!', 'published' => 'Y'),
|
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'),
|
array('id' => '2', 'title' => '', 'body' => 'Trying to get away with an empty title'),
|
||||||
);
|
);
|
||||||
$this->assertFalse($this->model->saveAll($data));
|
$result = $this->model->saveAll($data);
|
||||||
|
$this->assertEqual($result, false);
|
||||||
$result = $this->model->find('all', array('recursive' => -1));
|
$result = $this->model->find('all', array('recursive' => -1));
|
||||||
$errors = array(2 => array('title' => 'This field cannot be left blank'));
|
$errors = array(2 => array('title' => 'This field cannot be left blank'));
|
||||||
$expected = array(
|
$expected = array(
|
||||||
|
@ -2260,16 +2261,15 @@ class ModelTest extends CakeTestCase {
|
||||||
);
|
);
|
||||||
$result = $this->model->saveAll($data, array('atomic' => false));
|
$result = $this->model->saveAll($data, array('atomic' => false));
|
||||||
$this->assertEqual($result, array(true, false));
|
$this->assertEqual($result, array(true, false));
|
||||||
|
$result = $this->model->find('all', array('recursive' => -1));
|
||||||
|
$errors = array(2 => array('title' => 'This field cannot be left blank'));
|
||||||
$newTs = date('Y-m-d H:i:s');
|
$newTs = date('Y-m-d H:i:s');
|
||||||
$expected = array(
|
$expected = array(
|
||||||
array('Post' => array('id' => '1', 'author_id' => '1', 'title' => 'Baleeted First Post', 'body' => 'Baleeted!', 'published' => 'N', 'created' => '2007-03-18 10:39:23', 'updated' => $ts)),
|
array('Post' => array('id' => '1', 'author_id' => '1', 'title' => 'Un-Baleeted First Post', 'body' => 'Not Baleeted!', 'published' => 'Y', 'created' => '2007-03-18 10:39:23', 'updated' => $newTs)),
|
||||||
array('Post' => array('id' => '2', 'author_id' => '3', 'title' => 'Just update the title', 'body' => 'Second Post Body', 'published' => 'Y', 'created' => '2007-03-18 10:41:23', 'updated' => $ts)),
|
array('Post' => array('id' => '2', 'author_id' => '3', 'title' => 'Just update the title', 'body' => 'Second Post Body', 'published' => 'Y', 'created' => '2007-03-18 10:41:23', 'updated' => $ts)),
|
||||||
array('Post' => array('id' => '3', 'author_id' => '1', 'title' => 'Third Post', 'body' => 'Third Post Body', 'published' => 'Y', 'created' => '2007-03-18 10:43:23', 'updated' => '2007-03-18 10:45:31')),
|
array('Post' => array('id' => '3', 'author_id' => '1', 'title' => 'Third Post', 'body' => 'Third Post Body', 'published' => 'Y', 'created' => '2007-03-18 10:43:23', 'updated' => '2007-03-18 10:45:31')),
|
||||||
array('Post' => array('id' => '4', 'author_id' => '2', 'title' => 'Creating a fourth post', 'body' => 'Fourth post body', 'published' => 'N', 'created' => $ts, 'updated' => $ts))
|
array('Post' => array('id' => '4', 'author_id' => '2', 'title' => 'Creating a fourth post', 'body' => 'Fourth post body', 'published' => 'N', 'created' => $ts, 'updated' => $ts))
|
||||||
);
|
);
|
||||||
$expected[0]['Post'] = array_merge($expected[0]['Post'], $data[0], array('updated' => $newTs));
|
|
||||||
$result = $this->model->find('all', array('recursive' => -1));
|
|
||||||
$errors = array(2 => array('title' => 'This field cannot be left blank'));
|
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
$this->assertEqual($this->model->validationErrors, $errors);
|
$this->assertEqual($this->model->validationErrors, $errors);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue