summaryrefslogtreecommitdiffstats
path: root/tests/unit/controller/ItemControllerTest.php
diff options
context:
space:
mode:
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')