diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-04-12 12:25:58 +0200 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-04-12 12:25:58 +0200 |
commit | e8767f75116ff7ef2b7a349480151c9f66bbade0 (patch) | |
tree | 5879fe01fa8113a299daaba4d2c6cfa84769a104 /tests | |
parent | e9eaa93826c75097d95d21a556e1b1aae6610bcd (diff) |
implement clientside update requests, fix #27
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/bl/FeedBlTest.php | 44 |
1 files changed, 36 insertions, 8 deletions
diff --git a/tests/unit/bl/FeedBlTest.php b/tests/unit/bl/FeedBlTest.php index b1c5ba3c8..0fadf2c24 100644 --- a/tests/unit/bl/FeedBlTest.php +++ b/tests/unit/bl/FeedBlTest.php @@ -164,7 +164,7 @@ class FeedBlTest extends \OCA\AppFramework\Utility\TestUtility { $fetchReturn = array($feed, $items); - $this->mapper->expects($this->once()) + $this->mapper->expects($this->at(0)) ->method('find') ->with($this->equalTo($feed->getId()), $this->equalTo($this->user)) @@ -182,7 +182,14 @@ class FeedBlTest extends \OCA\AppFramework\Utility\TestUtility { ->method('insert') ->with($this->equalTo($items[0])); - $this->bl->update($feed->getId(), $this->user); + $this->mapper->expects($this->at(1)) + ->method('find') + ->with($feed->getId(), $this->user) + ->will($this->returnValue($feed)); + + $return = $this->bl->update($feed->getId(), $this->user); + + $this->assertEquals($return, $feed); } @@ -200,7 +207,7 @@ class FeedBlTest extends \OCA\AppFramework\Utility\TestUtility { $fetchReturn = array($feed, $items); - $this->mapper->expects($this->once()) + $this->mapper->expects($this->at(0)) ->method('find') ->with($this->equalTo($feed->getId()), $this->equalTo($this->user)) @@ -219,7 +226,14 @@ class FeedBlTest extends \OCA\AppFramework\Utility\TestUtility { $this->itemMapper->expects($this->never()) ->method('delete'); - $this->bl->update($feed->getId(), $this->user); + $this->mapper->expects($this->at(1)) + ->method('find') + ->with($feed->getId(), $this->user) + ->will($this->returnValue($feed)); + + $return = $this->bl->update($feed->getId(), $this->user); + + $this->assertEquals($return, $feed); } @@ -241,7 +255,7 @@ class FeedBlTest extends \OCA\AppFramework\Utility\TestUtility { $fetchReturn = array($feed, $items); - $this->mapper->expects($this->once()) + $this->mapper->expects($this->at(0)) ->method('find') ->with($this->equalTo($feed->getId()), $this->equalTo($this->user)) @@ -262,7 +276,14 @@ class FeedBlTest extends \OCA\AppFramework\Utility\TestUtility { ->method('insert') ->with($this->equalTo($item)); - $this->bl->update($feed->getId(), $this->user); + $this->mapper->expects($this->at(1)) + ->method('find') + ->with($feed->getId(), $this->user) + ->will($this->returnValue($feed)); + + $return = $this->bl->update($feed->getId(), $this->user); + + $this->assertEquals($return, $feed); $this->assertTrue($item->isUnread()); } @@ -273,7 +294,7 @@ class FeedBlTest extends \OCA\AppFramework\Utility\TestUtility { $feed->getUrl('test'); $ex = new FetcherException(''); - $this->mapper->expects($this->once()) + $this->mapper->expects($this->at(0)) ->method('find') ->with($this->equalTo($feed->getId()), $this->equalTo($this->user)) @@ -284,7 +305,14 @@ class FeedBlTest extends \OCA\AppFramework\Utility\TestUtility { $this->api->expects($this->once()) ->method('log'); - $this->bl->update($feed->getId(), $this->user); + $this->mapper->expects($this->at(1)) + ->method('find') + ->with($feed->getId(), $this->user) + ->will($this->returnValue($feed)); + + $return = $this->bl->update($feed->getId(), $this->user); + + $this->assertEquals($return, $feed); } public function testMove(){ |