/**
  * test that calling unbindModel() with reset == true multiple times
  * leaves associations in the correct state.
  *
  * @return void
  */
 public function testUnbindMultipleTimesResetCorrectly()
 {
     $this->loadFixtures('User', 'Comment', 'Article');
     $TestModel = new Article10();
     $TestModel->unbindModel(array('hasMany' => array('Comment')));
     $TestModel->unbindModel(array('hasMany' => array('Comment')));
     $TestModel->resetAssociations();
     $this->assertTrue(isset($TestModel->hasMany['Comment']), 'Association permanently removed');
 }
예제 #2
0
 /**
  * testDependentExclusiveDelete method
  *
  * @return void
  */
 public function testDependentExclusiveDelete()
 {
     $this->loadFixtures('Article', 'Comment');
     $TestModel = new Article10();
     $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'));
 }