diff options
Diffstat (limited to 'tests/integration')
-rw-r--r-- | tests/integration/bootstrap.php | 10 | ||||
-rw-r--r-- | tests/integration/db/ItemMapperTest.php | 34 | ||||
-rw-r--r-- | tests/integration/fixtures/feeds.json | 2 |
3 files changed, 27 insertions, 19 deletions
diff --git a/tests/integration/bootstrap.php b/tests/integration/bootstrap.php index 815913e3a..c8d7cc719 100644 --- a/tests/integration/bootstrap.php +++ b/tests/integration/bootstrap.php @@ -24,7 +24,6 @@ class NewsIntegrationTest extends \PHPUnit_Framework_TestCase { protected function setUp() { $this->ownCloudVersion = \OCP\Util::getVersion(); $this->cleanUp(); - $this->setupUser($this->userId, $this->userPassword); $app = new Application(); $this->container = $app->getContainer(); @@ -67,13 +66,13 @@ class NewsIntegrationTest extends \PHPUnit_Framework_TestCase { // feeds in folders foreach($folders as $folder) { $newFolder = $this->createFolder($folder); - $this->folders[$newFolder->getName()] = $newFolder; + $this->folders[$folder['name']] = $newFolder; if (array_key_exists($folder['name'], $feeds)) { foreach ($feeds[$folder['name']] as $feed) { $feed['folderId'] = $newFolder->getId(); $newFeed = $this->createFeed($feed); - $this->feeds[$newFeed->getTitle()] = $newFeed; + $this->feeds[$feed['title']] = $newFeed; if (array_key_exists($feed['title'], $items)) { foreach ($items[$feed['title']] as $item) { @@ -159,7 +158,7 @@ class NewsIntegrationTest extends \PHPUnit_Framework_TestCase { } - protected function setupUser($user='test', $password='test') { + protected function setupUser($user, $password) { $userManager = \OC::$server->getUserManager(); if ($userManager->userExists($user)) { @@ -176,13 +175,16 @@ class NewsIntegrationTest extends \PHPUnit_Framework_TestCase { $session->login($user, $password); } + private function cleanUp() { + $this->setupUser($this->userId, $this->userPassword); $this->clearNewsDatabase($this->userId); $this->folders = []; $this->feeds = []; $this->items = []; } + protected function tearDown() { $this->cleanUp(); } diff --git a/tests/integration/db/ItemMapperTest.php b/tests/integration/db/ItemMapperTest.php index c86112d46..5e6452398 100644 --- a/tests/integration/db/ItemMapperTest.php +++ b/tests/integration/db/ItemMapperTest.php @@ -47,20 +47,28 @@ class ItemMapperTest extends NewsIntegrationTest { } - public function testDeleteOlderThanThreshold() { + private function deleteReadOlderThanThreshold() { $this->itemMapper->deleteReadOlderThanThreshold(1); - $item1 = $this->items['del1']; - $item2 = $this->items['del2']; - $item3 = $this->items['del3']; - $item4 = $this->items['del4']; - - $this->itemMapper->find($item3->getId(), $this->userId); - $this->itemMapper->find($item4->getId(), $this->userId); - - //$this->setExpectedException( - // 'OCP\AppFramework\Db\DoesNotExistException'); - $this->itemMapper->find($item1->getId(), $this->userId); - $this->itemMapper->find($item2->getId(), $this->userId); + + $this->itemMapper->find($this->items['del3']->getId(), $this->userId); + $this->itemMapper->find($this->items['del4']->getId(), $this->userId); + } + + + public function testDeleteOlderThanThresholdOne() { + $this->deleteReadOlderThanThreshold(); + + $this->setExpectedException( + 'OCP\AppFramework\Db\DoesNotExistException'); + $this->itemMapper->find($this->items['del1']->getId(), $this->userId); + } + + + public function testDeleteOlderThanThresholdTwo() { + $this->deleteReadOlderThanThreshold(); + $this->setExpectedException( + 'OCP\AppFramework\Db\DoesNotExistException'); + $this->itemMapper->find($this->items['del2']->getId(), $this->userId); } diff --git a/tests/integration/fixtures/feeds.json b/tests/integration/fixtures/feeds.json index b1696a9eb..685a75396 100644 --- a/tests/integration/fixtures/feeds.json +++ b/tests/integration/fixtures/feeds.json @@ -2,7 +2,6 @@ "first folder": [ { "title": "first feed", - "folderName": "first folder", "url": "http://google.de", "deletedAt": 0, "location": "http://feed.com/rss", @@ -16,7 +15,6 @@ }, { "title": "second feed", - "folderName": "first folder", "url": "http://golem.de", "deletedAt": 0, "location": "http://feed.com/rss", |