diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-20 19:21:47 +0100 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-20 19:21:47 +0100 |
commit | 9c78fd8295f8e27cdb8fe8c4e10ffae650bc14d0 (patch) | |
tree | 5a9bf0d8e6c7044b85c93b95c044b6a1449197ce /tests | |
parent | 8f215ec03ba57e51dbbfef004069fb1e63c8fca1 (diff) |
added feedmaper
Diffstat (limited to 'tests')
-rw-r--r-- | tests/db/FeedMapperTest.php | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/tests/db/FeedMapperTest.php b/tests/db/FeedMapperTest.php index 9353365f5..c2dd6eced 100644 --- a/tests/db/FeedMapperTest.php +++ b/tests/db/FeedMapperTest.php @@ -77,7 +77,7 @@ class FeedMapperTest extends \OCA\AppFramework\Utility\MapperTestUtility { $this->setMapperResult($sql, array($id, $userId)); $this->setExpectedException('\OCA\AppFramework\Db\DoesNotExistException'); - $result = $this->itemMapper->find($id, $userId); + $result = $this->feedMapper->find($id, $userId); } @@ -85,8 +85,8 @@ class FeedMapperTest extends \OCA\AppFramework\Utility\MapperTestUtility { $userId = 'john'; $id = 3; $rows = array( - array('id' => $this->items[0]->getId()), - array('id' => $this->items[1]->getId()) + array('id' => $this->feeds[0]->getId()), + array('id' => $this->feeds[1]->getId()) ); $sql = 'SELECT * FROM `*dbprefix*news_feeds` ' . 'WHERE `id` = ? ' . @@ -95,8 +95,38 @@ class FeedMapperTest extends \OCA\AppFramework\Utility\MapperTestUtility { $this->setMapperResult($sql, array($id, $userId), $rows); $this->setExpectedException('\OCA\AppFramework\Db\MultipleObjectsReturnedException'); - $result = $this->itemMapper->find($id, $userId); + $result = $this->feedMapper->find($id, $userId); + } + + + public function testFindAll(){ + $userId = 'john'; + $rows = array( + array('id' => $this->feeds[0]->getId()), + array('id' => $this->feeds[1]->getId()) + ); + $sql = 'SELECT * FROM `*dbprefix*news_feeds`'; + + $this->setMapperResult($sql, array(), $rows); + + $result = $this->feedMapper->findAll(); + $this->assertEquals($this->feeds, $result); } + public function testFindAllFromUser(){ + $userId = 'john'; + $rows = array( + array('id' => $this->feeds[0]->getId()), + array('id' => $this->feeds[1]->getId()) + ); + $sql = 'SELECT * FROM `*dbprefix*news_feeds` ' . + 'AND `user_id` = ?'; + + $this->setMapperResult($sql, array($userId), $rows); + + $result = $this->feedMapper->findAllFromUser($userId); + $this->assertEquals($this->feeds, $result); + } + }
\ No newline at end of file |