Skip to content

Commit

Permalink
Adds order to the test models to make the results more predictable.
Browse files Browse the repository at this point in the history
Even though there was some code in place to prevent results in random
order from PostgreSQL we were still experiencing this with Jenkins
and Travis.

This commit removes the old code that handled this. From now on this
will be handled differently. Every test model will order by its
primary key. You can disable this by changing the order property
of the model to `null`: `$testModel->order = null`.
  • Loading branch information
Phally committed Jul 19, 2013
1 parent 2f2fba3 commit db1876d
Show file tree
Hide file tree
Showing 9 changed files with 85 additions and 19 deletions.
Expand Up @@ -320,6 +320,8 @@ public function testPaginate() {
$Controller->request->query = array();
$Controller->constructClasses();

$Controller->PaginatorControllerPost->order = null;

$Controller->Paginator->settings = array(
'order' => array('PaginatorControllerComment.id' => 'ASC')
);
Expand Down
Expand Up @@ -62,6 +62,7 @@ class TreeBehaviorAfterTest extends CakeTestCase {
*/
public function testAftersaveCallback() {
$this->Tree = new AfterTree();
$this->Tree->order = null;

$expected = array('AfterTree' => array('name' => 'Six and One Half Changed in AfterTree::afterSave() but not in database', 'parent_id' => 6, 'lft' => 11, 'rght' => 12));
$result = $this->Tree->save(array('AfterTree' => array('name' => 'Six and One Half', 'parent_id' => 6)));
Expand Down

0 comments on commit db1876d

Please sign in to comment.