summaryrefslogtreecommitdiffstats
path: root/tests/unit/controller/ItemControllerTest.php
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-05-09 12:57:35 +0200
committerBernhard Posselt <nukeawhale@gmail.com>2013-05-09 12:57:35 +0200
commitb8b4dfb4969e1baf84a14fb65a5dc153b0f5fae4 (patch)
tree27e211e26f442efd72a7f34903953ad57b1a9b76 /tests/unit/controller/ItemControllerTest.php
parentfe0de2ab84a88cb4c742f4f10fd43716934b7282 (diff)
only make one request for mark all read and mark folder read, fix #171, fix a bug that prevented readding of feeds when its folder was deleted, fix a bug that would not allow mark read for feeds when the app was started for the first time
Diffstat (limited to 'tests/unit/controller/ItemControllerTest.php')
-rw-r--r--tests/unit/controller/ItemControllerTest.php38
1 files changed, 17 insertions, 21 deletions
diff --git a/tests/unit/controller/ItemControllerTest.php b/tests/unit/controller/ItemControllerTest.php
index 16df210e0..e0e90af1e 100644
--- a/tests/unit/controller/ItemControllerTest.php
+++ b/tests/unit/controller/ItemControllerTest.php
@@ -62,7 +62,7 @@ class ItemControllerTest extends ControllerTestUtility {
->getMock();
$this->request = new Request();
$this->controller = new ItemController($this->api, $this->request,
- $this->itemBusinessLayer, $this->feedBusinessLayer);
+ $this->feedBusinessLayer, $this->itemBusinessLayer);
$this->user = 'jackob';
$this->newestItemId = 12312;
}
@@ -74,8 +74,8 @@ class ItemControllerTest extends ControllerTestUtility {
);
$request = $this->getRequest($post);
- return new ItemController($this->api, $request, $this->itemBusinessLayer,
- $this->feedBusinessLayer);
+ return new ItemController($this->api, $request,
+ $this->feedBusinessLayer, $this->itemBusinessLayer);
}
@@ -108,9 +108,8 @@ class ItemControllerTest extends ControllerTestUtility {
$this->assertItemControllerAnnotations('unread');
}
-
- public function testReadFeedAnnotations(){
- $this->assertItemControllerAnnotations('readFeed');
+ public function testReadAllAnnotations(){
+ $this->assertItemControllerAnnotations('readAll');
}
@@ -293,37 +292,34 @@ class ItemControllerTest extends ControllerTestUtility {
}
- public function testReadFeed(){
- $url = array(
- 'feedId' => 4
- );
+ public function testReadAll(){
+ $feed = new Feed();
$post = array(
'highestItemId' => 5
);
- $this->controller = $this->getPostController($post, $url);
+ $this->controller = $this->getPostController($post);
$expected = array(
- 'feeds' => array(
- array(
- 'id' => 4,
- 'unreadCount' => 0
- )
- )
+ 'feeds' => array($feed)
);
$this->api->expects($this->once())
->method('getUserId')
->will($this->returnValue($this->user));
$this->itemBusinessLayer->expects($this->once())
- ->method('readFeed')
- ->with($url['feedId'], $post['highestItemId'], $this->user);
+ ->method('readAll')
+ ->with($this->equalTo($post['highestItemId']),
+ $this->equalTo($this->user));
+ $this->feedBusinessLayer->expects($this->once())
+ ->method('findAll')
+ ->with($this->equalTo($this->user))
+ ->will($this->returnValue(array($feed)));
- $response = $this->controller->readFeed();
+ $response = $this->controller->readAll();
$this->assertTrue($response instanceof JSONResponse);
$this->assertEquals($expected, $response->getParams());
}
-
private function itemsApiExpects($id, $type){
$this->api->expects($this->once())
->method('getUserValue')