From 643fa4624dd7ba2db1349f16131bf330aeee3387 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Wed, 9 Apr 2014 16:10:48 +0200 Subject: port to internal controller, some routes are still broken --- tests/unit/businesslayer/FeedBusinessLayerTest.php | 15 ++++++++++----- tests/unit/businesslayer/FolderBusinessLayerTest.php | 14 +++++++++----- tests/unit/businesslayer/ItemBusinessLayerTest.php | 14 +++++++++----- 3 files changed, 28 insertions(+), 15 deletions(-) (limited to 'tests/unit/businesslayer') diff --git a/tests/unit/businesslayer/FeedBusinessLayerTest.php b/tests/unit/businesslayer/FeedBusinessLayerTest.php index 4e35326d6..19ff7da7f 100644 --- a/tests/unit/businesslayer/FeedBusinessLayerTest.php +++ b/tests/unit/businesslayer/FeedBusinessLayerTest.php @@ -53,10 +53,7 @@ class FeedBusinessLayerTest extends \OCA\News\Utility\TestUtility { $this->api = $this->getAPIMock(); $this->time = 222; $this->autoPurgeMinimumInterval = 10; - $timeFactory = $this->getMockBuilder( - '\OCA\News\Utility\TimeFactory') - ->disableOriginalConstructor() - ->getMock(); + $timeFactory = $this->getMock('TimeFactory', array('getTime')); $timeFactory->expects($this->any()) ->method('getTime') ->will($this->returnValue($this->time)); @@ -73,9 +70,17 @@ class FeedBusinessLayerTest extends \OCA\News\Utility\TestUtility { ->disableOriginalConstructor() ->getMock(); $this->purifier = $this->getMock('purifier', array('purify')); + $config = $this->getMockBuilder( + '\OCA\News\Utility\Config') + ->disableOriginalConstructor() + ->getMock(); + $config->expects($this->any()) + ->method('getAutoPurgeMinimumInterval') + ->will($this->returnValue($this->autoPurgeMinimumInterval)); + $this->feedBusinessLayer = new FeedBusinessLayer($this->feedMapper, $this->fetcher, $this->itemMapper, $this->api, - $timeFactory, $this->autoPurgeMinimumInterval, + $timeFactory, $config, $this->enhancer, $this->purifier); $this->user = 'jack'; $response = 'hi'; diff --git a/tests/unit/businesslayer/FolderBusinessLayerTest.php b/tests/unit/businesslayer/FolderBusinessLayerTest.php index c68d0e768..17eb1b8ae 100644 --- a/tests/unit/businesslayer/FolderBusinessLayerTest.php +++ b/tests/unit/businesslayer/FolderBusinessLayerTest.php @@ -42,10 +42,7 @@ class FolderBusinessLayerTest extends \OCA\News\Utility\TestUtility { protected function setUp(){ $this->api = $this->getAPIMock(); $this->time = 222; - $timeFactory = $this->getMockBuilder( - '\OCA\News\Utility\TimeFactory') - ->disableOriginalConstructor() - ->getMock(); + $timeFactory = $this->getMock('TimeFactory', array('getTime')); $timeFactory->expects($this->any()) ->method('getTime') ->will($this->returnValue($this->time)); @@ -54,9 +51,16 @@ class FolderBusinessLayerTest extends \OCA\News\Utility\TestUtility { ->disableOriginalConstructor() ->getMock(); $this->autoPurgeMinimumInterval = 10; + $config = $this->getMockBuilder( + '\OCA\News\Utility\Config') + ->disableOriginalConstructor() + ->getMock(); + $config->expects($this->any()) + ->method('getAutoPurgeMinimumInterval') + ->will($this->returnValue($this->autoPurgeMinimumInterval)); $this->folderBusinessLayer = new FolderBusinessLayer( $this->folderMapper, $this->api, $timeFactory, - $this->autoPurgeMinimumInterval); + $config); $this->user = 'hi'; } diff --git a/tests/unit/businesslayer/ItemBusinessLayerTest.php b/tests/unit/businesslayer/ItemBusinessLayerTest.php index 349ad865c..a3e7f7a14 100644 --- a/tests/unit/businesslayer/ItemBusinessLayerTest.php +++ b/tests/unit/businesslayer/ItemBusinessLayerTest.php @@ -47,10 +47,7 @@ class ItemBusinessLayerTest extends \OCA\News\Utility\TestUtility { protected function setUp(){ $this->time = 222; - $timeFactory = $this->getMockBuilder( - '\OCA\News\Utility\TimeFactory') - ->disableOriginalConstructor() - ->getMock(); + $timeFactory = $this->getMock('TimeFactory', array('getTime')); $timeFactory->expects($this->any()) ->method('getTime') ->will($this->returnValue($this->time)); @@ -66,8 +63,15 @@ class ItemBusinessLayerTest extends \OCA\News\Utility\TestUtility { ->method('typeToStatus') ->will($this->returnValue($this->status)); $this->threshold = 2; + $config = $this->getMockBuilder( + '\OCA\News\Utility\Config') + ->disableOriginalConstructor() + ->getMock(); + $config->expects($this->any()) + ->method('getAutoPurgeCount') + ->will($this->returnValue($this->threshold)); $this->itemBusinessLayer = new ItemBusinessLayer($this->mapper, - $statusFlag, $timeFactory, $this->threshold); + $statusFlag, $timeFactory, $config); $this->user = 'jack'; $response = 'hi'; $this->id = 3; -- cgit v1.2.3