diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-04-04 03:09:17 +0200 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-04-04 03:09:26 +0200 |
commit | 57e61031877e1f921e7b4446471c61e4c5ac1b13 (patch) | |
tree | 7128e8d03cddd191113e0e8e447dcee5437d37d4 /tests | |
parent | 8eedcfa1446fb6589cf57ec19ef5b5163b38b5b3 (diff) |
register hooks for deleting feeds, folders and items if a user is deleted, fix #468
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/businesslayer/FeedBusinessLayerTest.php | 9 | ||||
-rw-r--r-- | tests/unit/businesslayer/FolderBusinessLayerTest.php | 11 | ||||
-rw-r--r-- | tests/unit/businesslayer/ItemBusinessLayerTest.php | 12 | ||||
-rw-r--r-- | tests/unit/db/FeedMapperTest.php | 12 | ||||
-rw-r--r-- | tests/unit/db/FolderMapperTest.php | 11 | ||||
-rw-r--r-- | tests/unit/db/ItemMapperTest.php | 15 |
6 files changed, 70 insertions, 0 deletions
diff --git a/tests/unit/businesslayer/FeedBusinessLayerTest.php b/tests/unit/businesslayer/FeedBusinessLayerTest.php index 357ee73eb..40b1fa883 100644 --- a/tests/unit/businesslayer/FeedBusinessLayerTest.php +++ b/tests/unit/businesslayer/FeedBusinessLayerTest.php @@ -733,5 +733,14 @@ class FeedBusinessLayerTest extends \OCA\AppFramework\Utility\TestUtility { } + public function testDeleteUser() { + $this->feedMapper->expects($this->once()) + ->method('deleteUser') + ->will($this->returnValue($this->user)); + + $this->feedBusinessLayer->deleteUser($this->user); + } + + } diff --git a/tests/unit/businesslayer/FolderBusinessLayerTest.php b/tests/unit/businesslayer/FolderBusinessLayerTest.php index 7f512920e..b473e5dea 100644 --- a/tests/unit/businesslayer/FolderBusinessLayerTest.php +++ b/tests/unit/businesslayer/FolderBusinessLayerTest.php @@ -285,4 +285,15 @@ class FolderBusinessLayerTest extends \OCA\AppFramework\Utility\TestUtility { $this->folderBusinessLayer->purgeDeleted($this->user, false); } + + + public function testDeleteUser() { + $this->folderMapper->expects($this->once()) + ->method('deleteUser') + ->will($this->returnValue($this->user)); + + $this->folderBusinessLayer->deleteUser($this->user); + } + + } diff --git a/tests/unit/businesslayer/ItemBusinessLayerTest.php b/tests/unit/businesslayer/ItemBusinessLayerTest.php index 5dc6c9895..c120b753d 100644 --- a/tests/unit/businesslayer/ItemBusinessLayerTest.php +++ b/tests/unit/businesslayer/ItemBusinessLayerTest.php @@ -360,6 +360,18 @@ class ItemBusinessLayerTest extends \OCA\AppFramework\Utility\TestUtility { $this->assertEquals($star, $result); } + + + public function testDeleteUser() { + $this->mapper->expects($this->once()) + ->method('deleteUser') + ->will($this->returnValue($this->user)); + + $this->itemBusinessLayer->deleteUser($this->user); + } + + + } diff --git a/tests/unit/db/FeedMapperTest.php b/tests/unit/db/FeedMapperTest.php index 005f17a03..b7d095861 100644 --- a/tests/unit/db/FeedMapperTest.php +++ b/tests/unit/db/FeedMapperTest.php @@ -356,4 +356,16 @@ class FeedMapperTest extends \OCA\AppFramework\Utility\MapperTestUtility { $this->assertEquals($this->feeds, $result); } + + + public function testDeleteFromUser(){ + $userId = 'john'; + $sql = 'DELETE FROM `*PREFIX*news_feeds` WHERE `user_id` = ?'; + + $this->setMapperResult($sql, array($userId)); + + $this->mapper->deleteUser($userId); + } + + } diff --git a/tests/unit/db/FolderMapperTest.php b/tests/unit/db/FolderMapperTest.php index 082931c25..989f7a339 100644 --- a/tests/unit/db/FolderMapperTest.php +++ b/tests/unit/db/FolderMapperTest.php @@ -237,4 +237,15 @@ class FolderMapperTest extends \OCA\AppFramework\Utility\MapperTestUtility { $this->assertEquals($this->folders, $result); } + + public function testDeleteFromUser(){ + $userId = 'john'; + $sql = 'DELETE FROM `*PREFIX*news_folders` WHERE `user_id` = ?'; + + $this->setMapperResult($sql, array($userId)); + + $this->folderMapper->deleteUser($userId); + } + + }
\ No newline at end of file diff --git a/tests/unit/db/ItemMapperTest.php b/tests/unit/db/ItemMapperTest.php index fb7489f3d..a2df2178a 100644 --- a/tests/unit/db/ItemMapperTest.php +++ b/tests/unit/db/ItemMapperTest.php @@ -435,4 +435,19 @@ class ItemMapperTest extends \OCA\AppFramework\Utility\MapperTestUtility { $result = $this->mapper->getNewestItemId($this->user); } + + public function testDeleteFromUser(){ + $userId = 'john'; + $sql = 'DELETE FROM `*PREFIX*news_items` `items` ' . + 'WHERE `items`.`feed_id` IN (' . + 'SELECT `feeds`.`id` FROM `*PREFIX*news_feeds` `feeds` ' . + 'WHERE `feeds`.`user_id` = ?' . + ')'; + + $this->setMapperResult($sql, array($userId)); + + $this->mapper->deleteUser($userId); + } + + } |