diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-26 11:44:36 +0100 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-26 11:44:36 +0100 |
commit | b553ff390353a860195b61f5418847880f24410d (patch) | |
tree | 2040bb18fcc904bcc9cb0e758428c28b0c79db07 /tests/db/FeedMapperTest.php | |
parent | d0fde9dbce129b0dbb94d577d9685764c7d5ea4b (diff) |
fix referential integrity
Diffstat (limited to 'tests/db/FeedMapperTest.php')
-rw-r--r-- | tests/db/FeedMapperTest.php | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/db/FeedMapperTest.php b/tests/db/FeedMapperTest.php index 71f82a26b..27ea769d1 100644 --- a/tests/db/FeedMapperTest.php +++ b/tests/db/FeedMapperTest.php @@ -181,4 +181,44 @@ class FeedMapperTest extends \OCA\AppFramework\Utility\MapperTestUtility { } + public function testDelete(){ + $feed = new Feed(); + $feed->setId(3); + + $sql = 'DELETE FROM `*PREFIX*news_feeds` WHERE `id` = ?'; + $arguments = array($feed->getId()); + + $sql2 = 'DELETE FROM `*PREFIX*news_items` WHERE `feed_id` = ?'; + $arguments2 = array($feed->getId()); + + $pdoResult = $this->getMock('Result', + array('fetchRow')); + $pdoResult->expects($this->any()) + ->method('fetchRow'); + + $query = $this->getMock('Query', + array('execute')); + $query->expects($this->at(0)) + ->method('execute') + ->with($this->equalTo($arguments)) + ->will($this->returnValue($pdoResult)); + $this->api->expects($this->at(0)) + ->method('prepareQuery') + ->with($this->equalTo($sql)) + ->will(($this->returnValue($query))); + + $query->expects($this->at(1)) + ->method('execute') + ->with($this->equalTo($arguments2)) + ->will($this->returnValue($pdoResult)); + $this->api->expects($this->at(1)) + ->method('prepareQuery') + ->with($this->equalTo($sql2)) + ->will(($this->returnValue($query))); + + $this->mapper->delete($feed); + + } + + }
\ No newline at end of file |