summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-03-25 11:48:15 +0100
committerBernhard Posselt <nukeawhale@gmail.com>2013-03-25 11:48:15 +0100
commit77ec6f08aa4fb223fba859ca0f6060e84006da43 (patch)
tree169f5064f0f906bb8ff4fe6949b81151c44c10d5 /tests
parentdf07df3b29c1d08d0cadc6aa4b11ac82981d002b (diff)
updated backgroundjob
Diffstat (limited to 'tests')
-rw-r--r--tests/bl/FeedBlTest.php10
-rw-r--r--tests/controller/ItemControllerTest.php42
2 files changed, 20 insertions, 32 deletions
diff --git a/tests/bl/FeedBlTest.php b/tests/bl/FeedBlTest.php
index 3cf528722..15414a721 100644
--- a/tests/bl/FeedBlTest.php
+++ b/tests/bl/FeedBlTest.php
@@ -61,16 +61,6 @@ class FeedBlTest extends \OCA\AppFramework\Utility\TestUtility {
}
- public function testFindAll(){
- $this->mapper->expects($this->once())
- ->method('findAll')
- ->will($this->returnValue($this->response));
-
- $result = $this->bl->findAll();
- $this->assertEquals($this->response, $result);
- }
-
-
public function testFindAllFromUser(){
$this->mapper->expects($this->once())
->method('findAllFromUser')
diff --git a/tests/controller/ItemControllerTest.php b/tests/controller/ItemControllerTest.php
index fd1666812..0c9899d4f 100644
--- a/tests/controller/ItemControllerTest.php
+++ b/tests/controller/ItemControllerTest.php
@@ -213,18 +213,7 @@ class ItemControllerTest extends ControllerTestUtility {
- public function testItems(){
- $result = array(
- 'items' => array(new Item())
- );
- $post = array(
- 'limit' => 3,
- 'type' => FeedType::FEED,
- 'id' => 2,
- 'offset' => 0
- );
- $this->controller = $this->getPostController($post);
-
+ private function itemsApiExpects($id, $type){
$this->api->expects($this->once())
->method('getUserValue')
->with($this->equalTo($this->user),
@@ -237,13 +226,28 @@ class ItemControllerTest extends ControllerTestUtility {
->method('setUserValue')
->with($this->equalTo($this->user),
$this->equalTo('lastViewedFeedId'),
- $this->equalTo($post['id']));
+ $this->equalTo($id));
$this->api->expects($this->at(3))
->method('setUserValue')
->with($this->equalTo($this->user),
$this->equalTo('lastViewedFeedType'),
- $this->equalTo($post['type']));
+ $this->equalTo($type));
+ }
+
+
+ public function testItems(){
+ $result = array(
+ 'items' => array(new Item())
+ );
+ $post = array(
+ 'limit' => 3,
+ 'type' => FeedType::FEED,
+ 'id' => 2,
+ 'offset' => 0
+ );
+ $this->controller = $this->getPostController($post);
+ $this->itemsApiExpects($post['id'], $post['type']);
$this->bl->expects($this->once())
->method('findAll')
@@ -268,14 +272,8 @@ class ItemControllerTest extends ControllerTestUtility {
);
$this->controller = $this->getPostController($post);
- $this->api->expects($this->once())
- ->method('getUserValue')
- ->with($this->equalTo($this->user),
- $this->equalTo('showAll'))
- ->will($this->returnValue('true'));
- $this->api->expects($this->once())
- ->method('getUserId')
- ->will($this->returnValue($this->user));
+ $this->itemsApiExpects($post['id'], $post['type']);
+
$this->bl->expects($this->once())
->method('findAllNew')
->with($post['id'], $post['type'], $post['updatedSince'],