/** * testDependentExclusiveDelete method * * @return void */ public function testDependentExclusiveDelete() { $this->loadFixtures('Boat', 'Comment'); $TestModel = new Boat10(); $result = $TestModel->find('all'); $this->assertEquals(4, count($result[0]['Comment'])); $this->assertEquals(2, count($result[1]['Comment'])); $this->assertEquals(6, $TestModel->Comment->find('count')); $TestModel->delete(1); $this->assertEquals(2, $TestModel->Comment->find('count')); }
/** * test that calling unbindModel() with reset == true multiple times * leaves associations in the correct state. * * @return void */ public function testUnbindMultipleTimesResetCorrectly() { $this->loadFixtures('User', 'Comment', 'Boat'); $TestModel = new Boat10(); $TestModel->unbindModel(array('hasMany' => array('Comment'))); $TestModel->unbindModel(array('hasMany' => array('Comment'))); $TestModel->resetAssociations(); $this->assertTrue(isset($TestModel->hasMany['Comment']), 'Association permanently removed'); }