summaryrefslogtreecommitdiffstats
path: root/tests/bl
diff options
context:
space:
mode:
Diffstat (limited to 'tests/bl')
-rw-r--r--tests/bl/FeedBlTest.php21
-rw-r--r--tests/bl/ItemBlTest.php23
2 files changed, 23 insertions, 21 deletions
diff --git a/tests/bl/FeedBlTest.php b/tests/bl/FeedBlTest.php
index 5ad02e789..ae0414614 100644
--- a/tests/bl/FeedBlTest.php
+++ b/tests/bl/FeedBlTest.php
@@ -50,7 +50,6 @@ class FeedBlTest extends \OCA\AppFramework\Utility\TestUtility {
private $threshold;
protected function setUp(){
- $this->threshold = 2;
$this->api = $this->getAPIMock();
$this->mapper = $this->getMockBuilder('\OCA\News\Db\FeedMapper')
->disableOriginalConstructor()
@@ -62,8 +61,7 @@ class FeedBlTest extends \OCA\AppFramework\Utility\TestUtility {
->disableOriginalConstructor()
->getMock();
$this->bl = new FeedBl($this->mapper,
- $this->fetcher, $this->itemMapper, $this->api,
- $this->threshold);
+ $this->fetcher, $this->itemMapper, $this->api);
$this->user = 'jack';
$response = 'hi';
@@ -305,23 +303,6 @@ class FeedBlTest extends \OCA\AppFramework\Utility\TestUtility {
}
- public function testAutoPurgeOldWillPurgeOld(){
- $feed = new Feed();
- $feed->setId(3);
- $unread = array(
- new Feed(), $feed
- );
- $this->mapper->expects($this->once())
- ->method('getReadOlderThanThreshold')
- ->with($this->equalTo($this->threshold))
- ->will($this->returnValue($unread));
- $this->mapper->expects($this->once())
- ->method('deleteReadOlderThanId')
- ->with($this->equalTo($feed->getId()));
-
- $result = $this->bl->autoPurgeOld();
-
- }
}
diff --git a/tests/bl/ItemBlTest.php b/tests/bl/ItemBlTest.php
index dc8f46a2c..40d922528 100644
--- a/tests/bl/ItemBlTest.php
+++ b/tests/bl/ItemBlTest.php
@@ -55,7 +55,8 @@ class ItemBlTest extends \OCA\AppFramework\Utility\TestUtility {
$statusFlag->expects($this->any())
->method('typeToStatus')
->will($this->returnValue($this->status));
- $this->bl = new ItemBl($this->mapper, $statusFlag);
+ $this->threshold = 2;
+ $this->bl = new ItemBl($this->mapper, $statusFlag, $this->threshold);
$this->user = 'jack';
$response = 'hi';
$this->id = 3;
@@ -245,6 +246,26 @@ class ItemBlTest extends \OCA\AppFramework\Utility\TestUtility {
$this->bl->readFeed($feedId, $highestItemId, $this->user);
}
+
+ public function testAutoPurgeOldWillPurgeOld(){
+ $item = new Item();
+ $item->setId(3);
+ $unread = array(
+ new Item(), $item
+ );
+ $this->mapper->expects($this->once())
+ ->method('getReadOlderThanThreshold')
+ ->with($this->equalTo($this->threshold))
+ ->will($this->returnValue($unread));
+ $this->mapper->expects($this->once())
+ ->method('deleteReadOlderThanId')
+ ->with($this->equalTo($item->getId()));
+
+ $result = $this->bl->autoPurgeOld();
+
+ }
+
+
}