diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-04-17 10:50:46 +0200 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-04-17 10:51:04 +0200 |
commit | 1fbcd35ac8f868e48228aafa375c5a305554a3c3 (patch) | |
tree | f3b40fa3e34f90774097bf78ceffc7f4527fa05b /tests/unit/controller | |
parent | 19b9456b6a96e8139d62a498fb31a96ed36fb442 (diff) |
always return the unreadcount when marking read to set update request as 0, dont create new feeds that only consist of unreadcount updates
Diffstat (limited to 'tests/unit/controller')
-rw-r--r-- | tests/unit/controller/FeedControllerTest.php | 12 | ||||
-rw-r--r-- | tests/unit/controller/ItemControllerTest.php | 9 |
2 files changed, 18 insertions, 3 deletions
diff --git a/tests/unit/controller/FeedControllerTest.php b/tests/unit/controller/FeedControllerTest.php index c7c69fb03..428ecc7d4 100644 --- a/tests/unit/controller/FeedControllerTest.php +++ b/tests/unit/controller/FeedControllerTest.php @@ -298,14 +298,20 @@ class FeedControllerTest extends ControllerTestUtility { public function testUpdate(){ + $feed = new Feed(); + $feed->setId(3); + $feed->setUnreadCount(44); $result = array( 'feeds' => array( - new Feed() + array( + 'id' => $feed->getId(), + 'unreadCount' => $feed->getUnreadCount() + ) ) ); $url = array( - 'feedId' => 4 + 'feedId' => 4 ); $this->controller = $this->getPostController(array(), $url); @@ -315,7 +321,7 @@ class FeedControllerTest extends ControllerTestUtility { $this->feedBusinessLayer->expects($this->once()) ->method('update') ->with($this->equalTo($url['feedId']), $this->equalTo($this->user)) - ->will($this->returnValue($result['feeds'][0])); + ->will($this->returnValue($feed)); $response = $this->controller->update(); diff --git a/tests/unit/controller/ItemControllerTest.php b/tests/unit/controller/ItemControllerTest.php index 953330855..417997d30 100644 --- a/tests/unit/controller/ItemControllerTest.php +++ b/tests/unit/controller/ItemControllerTest.php @@ -197,6 +197,14 @@ class ItemControllerTest extends ControllerTestUtility { 'highestItemId' => 5 ); $this->controller = $this->getPostController($post, $url); + $expected = array( + 'feeds' => array( + array( + 'id' => 4, + 'unreadCount' => 0 + ) + ) + ); $this->api->expects($this->once()) ->method('getUserId') @@ -207,6 +215,7 @@ class ItemControllerTest extends ControllerTestUtility { $response = $this->controller->readFeed(); $this->assertTrue($response instanceof JSONResponse); + $this->assertEquals($expected, $response->getParams()); } |