Skip to content
Browse files

Fix tests that occasionally fail on postgres.

  • Loading branch information...
1 parent 644d47c commit e0586da808431811dc2d0f0738032b7a5838f8c0 @markstory markstory committed
Showing with 12 additions and 10 deletions.
  1. +12 −10 lib/Cake/Test/Case/Model/BehaviorCollectionTest.php
View
22 lib/Cake/Test/Case/Model/BehaviorCollectionTest.php
@@ -786,21 +786,22 @@ public function testBehaviorHasOneFindCallbacks() {
public function testBehaviorBelongsToFindCallbacks() {
$this->skipIf($this->db instanceof Sqlserver, 'This test is not compatible with SQL Server.');
+ $conditions = array('order' => 'Apple.id ASC');
$Apple = new Apple();
$Apple->unbindModel(array('hasMany' => array('Child'), 'hasOne' => array('Sample')), false);
- $expected = $Apple->find('all');
+ $expected = $Apple->find('all', $conditions);
$Apple->unbindModel(array('belongsTo' => array('Parent')));
- $wellBehaved = $Apple->find('all');
+ $wellBehaved = $Apple->find('all', $conditions);
$Apple->Parent->Behaviors->attach('Test');
$Apple->unbindModel(array('belongsTo' => array('Parent')));
- $this->assertSame($Apple->find('all'), $wellBehaved);
+ $this->assertSame($Apple->find('all', $conditions), $wellBehaved);
$Apple->Parent->Behaviors->attach('Test', array('before' => 'off'));
- $this->assertSame($expected, $Apple->find('all'));
+ $this->assertSame($expected, $Apple->find('all', $conditions));
$Apple->Parent->Behaviors->attach('Test', array('before' => 'test'));
- $this->assertSame($expected, $Apple->find('all'));
+ $this->assertSame($expected, $Apple->find('all', $conditions));
$Apple->Parent->Behaviors->attach('Test', array('before' => 'modify'));
$expected2 = array(
@@ -816,22 +817,23 @@ public function testBehaviorBelongsToFindCallbacks() {
);
$result2 = $Apple->find('all', array(
'fields' => array('Apple.id', 'Parent.id', 'Parent.name', 'Parent.mytime'),
- 'conditions' => array('Apple.id <' => '4')
+ 'conditions' => array('Apple.id <' => '4'),
+ 'order' => 'Apple.id ASC',
));
$this->assertEquals($expected2, $result2);
$Apple->Parent->Behaviors->disable('Test');
- $result = $Apple->find('all');
+ $result = $Apple->find('all', $conditions);
$this->assertEquals($expected, $result);
$Apple->Parent->Behaviors->attach('Test', array('after' => 'off'));
- $this->assertEquals($expected, $Apple->find('all'));
+ $this->assertEquals($expected, $Apple->find('all', $conditions));
$Apple->Parent->Behaviors->attach('Test', array('after' => 'test'));
- $this->assertEquals($expected, $Apple->find('all'));
+ $this->assertEquals($expected, $Apple->find('all', $conditions));
$Apple->Parent->Behaviors->attach('Test', array('after' => 'test2'));
- $this->assertEquals($expected, $Apple->find('all'));
+ $this->assertEquals($expected, $Apple->find('all', $conditions));
}
/**

0 comments on commit e0586da

Please sign in to comment.
Something went wrong with that request. Please try again.