diff options
Diffstat (limited to 'tests/integration/db')
-rw-r--r-- | tests/integration/db/FeedMapperTest.php | 46 | ||||
-rw-r--r-- | tests/integration/db/FolderMapperTest.php | 42 | ||||
-rw-r--r-- | tests/integration/db/ItemMapperTest.php | 151 |
3 files changed, 239 insertions, 0 deletions
diff --git a/tests/integration/db/FeedMapperTest.php b/tests/integration/db/FeedMapperTest.php new file mode 100644 index 000000000..c8de68281 --- /dev/null +++ b/tests/integration/db/FeedMapperTest.php @@ -0,0 +1,46 @@ +<?php + +namespace OCA\News\Db; + +use \OCA\News\Tests\Integration\NewsIntegrationTest; + +class FeedMapperTest extends NewsIntegrationTest { + + + public function testFind () { + + } + + + /* TBD + public function testFindAll () { + + } + + + public function testFindAllFromUser () { + + } + + + public function testFindByUrlHash () { + + } + + + public function testDelete () { + + } + + + public function testGetToDelete () { + + } + + + public function testDeleteUser () { + + }*/ + + +}
\ No newline at end of file diff --git a/tests/integration/db/FolderMapperTest.php b/tests/integration/db/FolderMapperTest.php new file mode 100644 index 000000000..1af862340 --- /dev/null +++ b/tests/integration/db/FolderMapperTest.php @@ -0,0 +1,42 @@ +<?php + +namespace OCA\News\Db; + +use \OCA\News\Tests\Integration\NewsIntegrationTest; + +class FolderMapperTest extends NewsIntegrationTest { + + + public function testFind () { + + } + + + /* TBD + public function testFindByName () { + + } + + + public function testFindAllFromUser () { + + } + + + public function testDelete () { + + } + + + public function testGetToDelete () { + + } + + + public function testDeleteUser () { + + }*/ + + + +}
\ No newline at end of file diff --git a/tests/integration/db/ItemMapperTest.php b/tests/integration/db/ItemMapperTest.php index b0b979f8f..20ded2ead 100644 --- a/tests/integration/db/ItemMapperTest.php +++ b/tests/integration/db/ItemMapperTest.php @@ -79,4 +79,155 @@ class ItemMapperTest extends NewsIntegrationTest { } + public function testStarredCount () { + $count = $this->itemMapper->starredCount($this->userId); + $this->assertEquals(2, $count); + } + + + public function testReadAll () { + $this->itemMapper->readAll(PHP_INT_MAX, 10, $this->userId); + + $status = StatusFlag::UNREAD; + $items = $this->itemMapper->findAll( + 30, 0, $status, false, $this->userId + ); + + $this->assertEquals(0, count($items)); + + $item = $this->items['a title1']; + $item = $this->itemMapper->find($item->getId(), $this->userId); + + $this->assertEquals(10, $item->getLastModified()); + + $item = $this->items['a title3']; + $item = $this->itemMapper->find($item->getId(), $this->userId); + + $this->assertEquals(10, $item->getLastModified()); + + $item = $this->items['a title9']; + $item = $this->itemMapper->find($item->getId(), $this->userId); + + $this->assertEquals(10, $item->getLastModified()); + } + + + public function testReadFolder () { + $folderId = $this->folders['first folder']->getId(); + $this->itemMapper->readFolder( + $folderId, PHP_INT_MAX, 10, $this->userId + ); + + $status = StatusFlag::UNREAD; + $items = $this->itemMapper->findAll( + 30, 0, $status, false, $this->userId + ); + + $this->assertEquals(1, count($items)); + + $item = $this->items['a title1']; + $item = $this->itemMapper->find($item->getId(), $this->userId); + + $this->assertEquals(10, $item->getLastModified()); + + $item = $this->items['a title3']; + $item = $this->itemMapper->find($item->getId(), $this->userId); + + $this->assertEquals(10, $item->getLastModified()); + + $item = $this->items['a title9']; + $item = $this->itemMapper->find($item->getId(), $this->userId); + + $this->assertTrue($item->isUnread()); + } + + + public function testReadFeed () { + $feedId = $this->feeds['third feed']->getId(); + $this->itemMapper->readFeed( + $feedId, PHP_INT_MAX, 10, $this->userId + ); + + $status = StatusFlag::UNREAD; + $items = $this->itemMapper->findAll( + 30, 0, $status, false, $this->userId + ); + + $this->assertEquals(2, count($items)); + + $item = $this->items['a title9']; + $item = $this->itemMapper->find($item->getId(), $this->userId); + + $this->assertEquals(10, $item->getLastModified()); + + $item = $this->items['a title3']; + $item = $this->itemMapper->find($item->getId(), $this->userId); + $this->assertTrue($item->isUnread()); + + + $item = $this->items['a title1']; + $item = $this->itemMapper->find($item->getId(), $this->userId); + $this->assertTrue($item->isUnread()); + } + + + public function testDeleteUser () { + $this->itemMapper->deleteUser($this->userId); + $id = $this->itemMapper->getNewestItemId(); + + $this->assertEquals(0, $id); + } + + + public function testGetNewestItemId () { + $id = $this->itemMapper->getNewestItemId($this->userId); + + $item = $this->items['no folder']; + $this->assertEquals($item->getId(), $id); + } + + + public function testFindByGuidHash () { + $item = $this->items['no folder']; + + $fetchedItem = $this->itemMapper->findByGuidHash( + 'no folder', $item->getFeedId(), $this->userId + ); + + $this->assertEquals($item->getId(), $fetchedItem->getId()); + } + + + public function testFindAllUnreadOrStarred () { + $items = $this->itemMapper->findAllUnreadOrStarred($this->userId); + $this->assertEquals(4, count($items)); + } + + + /* TBD + public function testFindAllFolder () { + + } + + + public function testFindAllFeed () { + + } + + + public function testFindAllNew () { + + } + + + public function testFindAllNewFolder () { + + } + + + public function testFindAllNewFeed () { + + } + + */ }
\ No newline at end of file |