Fix failing test.

This commit is contained in:
mark_story 2012-01-07 20:24:33 -05:00
parent beced84d2d
commit 9a67a70703

View file

@ -208,11 +208,11 @@ class ModelIntegrationTest extends BaseModelTest {
public function testDynamicBehaviorAttachment() { public function testDynamicBehaviorAttachment() {
$this->loadFixtures('Apple', 'Sample', 'Author'); $this->loadFixtures('Apple', 'Sample', 'Author');
$TestModel = new Apple(); $TestModel = new Apple();
$this->assertEquals($TestModel->Behaviors->attached(), array()); $this->assertEquals(array(), $TestModel->Behaviors->attached());
$TestModel->Behaviors->attach('Tree', array('left' => 'left_field', 'right' => 'right_field')); $TestModel->Behaviors->attach('Tree', array('left' => 'left_field', 'right' => 'right_field'));
$this->assertTrue(is_object($TestModel->Behaviors->Tree)); $this->assertTrue(is_object($TestModel->Behaviors->Tree));
$this->assertEquals($TestModel->Behaviors->attached(), array('Tree')); $this->assertEquals(array('Tree'), $TestModel->Behaviors->attached());
$expected = array( $expected = array(
'parent' => 'parent_id', 'parent' => 'parent_id',
@ -223,16 +223,14 @@ class ModelIntegrationTest extends BaseModelTest {
'__parentChange' => false, '__parentChange' => false,
'recursive' => -1 'recursive' => -1
); );
$this->assertEquals($expected, $TestModel->Behaviors->Tree->settings['Apple']);
$this->assertEquals($TestModel->Behaviors->Tree->settings['Apple'], $expected);
$expected['enabled'] = false;
$TestModel->Behaviors->attach('Tree', array('enabled' => false)); $TestModel->Behaviors->attach('Tree', array('enabled' => false));
$this->assertEquals($TestModel->Behaviors->Tree->settings['Apple'], $expected); $this->assertEquals($expected, $TestModel->Behaviors->Tree->settings['Apple']);
$this->assertEquals($TestModel->Behaviors->attached(), array('Tree')); $this->assertEquals(array('Tree'), $TestModel->Behaviors->attached());
$TestModel->Behaviors->detach('Tree'); $TestModel->Behaviors->detach('Tree');
$this->assertEquals($TestModel->Behaviors->attached(), array()); $this->assertEquals(array(), $TestModel->Behaviors->attached());
$this->assertFalse(isset($TestModel->Behaviors->Tree)); $this->assertFalse(isset($TestModel->Behaviors->Tree));
} }