Skip to content
Permalink
Browse files

Added test for deleting dependent hasMany associated records. Refs #2553

  • Loading branch information...
ADmad committed Feb 6, 2012
1 parent 5886b25 commit 610213dd6c75ec010a42e5b696995863dc10fd50
Showing with 17 additions and 1 deletion.
  1. +17 −1 lib/Cake/Test/Case/Model/ModelDeleteTest.php
@@ -555,7 +555,9 @@ public function testDeleteLinksWithPLuginJoinModel() {
* @return void
*/
public function testDeleteDependent() {
$this->loadFixtures('Bidding', 'BiddingMessage');
$this->loadFixtures('Bidding', 'BiddingMessage', 'Article',
'ArticlesTag', 'Comment', 'User', 'Attachment'
);
$Bidding = new Bidding();
$result = $Bidding->find('all');
$expected = array(
@@ -626,6 +628,20 @@ public function testDeleteDependent() {
),
);
$this->assertEquals($expected, $result);
$Article = new Article();
$result = $Article->Comment->find('count', array(
'conditions' => array('Comment.article_id' => 1)
));
$this->assertEquals(4, $result);
$result = $Article->delete(1, true);
$this->assertIdentical(true, true);
$result = $Article->Comment->find('count', array(
'conditions' => array('Comment.article_id' => 1)
));
$this->assertEquals(0, $result);
}
/**

0 comments on commit 610213d

Please sign in to comment.
You can’t perform that action at this time.