Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

  • Loading branch information...
commit 610213dd6c75ec010a42e5b696995863dc10fd50 1 parent 5886b25
@ADmad ADmad authored
Showing with 17 additions and 1 deletion.
  1. +17 −1 lib/Cake/Test/Case/Model/ModelDeleteTest.php
View
18 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);
}
/**
Please sign in to comment.
Something went wrong with that request. Please try again.