Permalink
Browse files

Fixing test for postgresql, it is no safe to asume the order of the r…

…eturned results of a joined table
  • Loading branch information...
1 parent 8375570 commit 201a952218e7e83ebc08f80decd4be13739ed773 @lorenzo lorenzo committed Mar 16, 2010
Showing with 7 additions and 4 deletions.
  1. +7 −4 cake/tests/cases/libs/model/model_read.test.php
@@ -51,17 +51,20 @@ function testFetchingNonUniqueFKJoinTableRecords() {
'updated' => '2007-03-18 10:41:31'
)
);
+
$Something->JoinThing->create($joinThingData);
$Something->JoinThing->save();
$result = $Something->JoinThing->find('all', array('conditions' => array('something_else_id' => 2)));
- $this->assertEqual($result[0]['JoinThing']['doomed'], 1);
- $this->assertEqual($result[1]['JoinThing']['doomed'], 0);
+ $this->assertEqual($result[0]['JoinThing']['doomed'], true);
+ $this->assertEqual($result[1]['JoinThing']['doomed'], false);
$result = $Something->find('first');
$this->assertEqual(count($result['SomethingElse']), 2);
- $this->assertEqual($result['SomethingElse'][0]['JoinThing']['doomed'], 1);
- $this->assertEqual($result['SomethingElse'][1]['JoinThing']['doomed'], 0);
+
+ $doomed = Set::extract('/JoinThing/doomed', $result['SomethingElse']);
+ $this->assertTrue(in_array(true, $doomed));
+ $this->assertTrue(in_array(false, $doomed));
}
/**

0 comments on commit 201a952

Please sign in to comment.