diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-19 19:49:25 +0100 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-19 19:49:25 +0100 |
commit | 966af078df176fc96d1e37696d4725115ad9639f (patch) | |
tree | 1f98e44ab2a5e991252cf0c82a5973451803ce46 /tests/db | |
parent | 4e077697a1fd0cf15a6eac22cb6e3d6ec4b10ff2 (diff) |
added mapper spec
Diffstat (limited to 'tests/db')
-rw-r--r-- | tests/db/ItemMapperTest.php | 26 |
1 files changed, 4 insertions, 22 deletions
diff --git a/tests/db/ItemMapperTest.php b/tests/db/ItemMapperTest.php index d5068d1f8..ab7cfa043 100644 --- a/tests/db/ItemMapperTest.php +++ b/tests/db/ItemMapperTest.php @@ -28,16 +28,14 @@ namespace OCA\News\Db; require_once(__DIR__ . "/../classloader.php"); -class Test extends \PHPUnit_Framework_TestCase { +class Test extends \OCA\AppFramework\Utility\MapperTestUtility { private $itemMapper; - private $api; private $items; protected function setUp(){ - $this->api = $this->getMock('\OCA\AppFramework\Core\API', - array('prepareQuery'), - array('a')); + $this->beforeEach(); + $this->itemMapper = new ItemMapper($this->api); // create mock items @@ -65,23 +63,7 @@ class Test extends \PHPUnit_Framework_TestCase { WHERE user_id = ? AND feed_id = ?'; - $pdoResult = $this->getMock('Result', - array('fetchRow')); - $pdoResult->expects($this->once()) - ->method('fetchRow') - ->will($this->returnValue($rows)); - - $query = $this->getMock('Query', - array('execute')); - $query->expects($this->once()) - ->method('execute') - ->with($this->equalTo(array($feedId, $userId))) - ->will($this->returnValue($pdoResult)); - - $this->api->expects($this->once()) - ->method('prepareQuery') - ->with($this->equalTo($sql)) - ->will(($this->returnValue($query))); + $this->setMapperResult($sql, array($feedId, $userId), $rows); $result = $this->itemMapper->findAllFromFeed($feedId, $userId); |