diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-04-19 13:20:54 +0200 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-04-19 13:21:11 +0200 |
commit | 517e4ca5435106ab5304849248cbea4e9dffd4b0 (patch) | |
tree | 0f00076f012791b39c710994f695abf723546062 /tests/unit/businesslayer/FolderBusinessLayerTest.php | |
parent | bd35b98d2c130f058b182f726636ee971625823b (diff) |
split up api class for easier testing and clearer code
Diffstat (limited to 'tests/unit/businesslayer/FolderBusinessLayerTest.php')
-rw-r--r-- | tests/unit/businesslayer/FolderBusinessLayerTest.php | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/tests/unit/businesslayer/FolderBusinessLayerTest.php b/tests/unit/businesslayer/FolderBusinessLayerTest.php index 17eb1b8ae..22b9e53d0 100644 --- a/tests/unit/businesslayer/FolderBusinessLayerTest.php +++ b/tests/unit/businesslayer/FolderBusinessLayerTest.php @@ -31,16 +31,17 @@ require_once(__DIR__ . "/../../classloader.php"); use \OCA\News\Db\Folder; -class FolderBusinessLayerTest extends \OCA\News\Utility\TestUtility { +class FolderBusinessLayerTest extends \PHPUnit_Framework_TestCase { private $folderMapper; private $folderBusinessLayer; private $time; private $user; private $autoPurgeMinimumInterval; + private $l10n; protected function setUp(){ - $this->api = $this->getAPIMock(); + $this->l10n = $this->getMock('L10N', array('t')); $this->time = 222; $timeFactory = $this->getMock('TimeFactory', array('getTime')); $timeFactory->expects($this->any()) @@ -59,7 +60,7 @@ class FolderBusinessLayerTest extends \OCA\News\Utility\TestUtility { ->method('getAutoPurgeMinimumInterval') ->will($this->returnValue($this->autoPurgeMinimumInterval)); $this->folderBusinessLayer = new FolderBusinessLayer( - $this->folderMapper, $this->api, $timeFactory, + $this->folderMapper, $this->l10n, $timeFactory, $config); $this->user = 'hi'; } @@ -103,12 +104,8 @@ class FolderBusinessLayerTest extends \OCA\News\Utility\TestUtility { array('id' => 1) ); - $trans = $this->getMock('Trans', array('t')); - $trans->expects($this->once()) + $this->l10n->expects($this->once()) ->method('t'); - $this->api->expects($this->once()) - ->method('getTrans') - ->will($this->returnValue($trans)); $this->folderMapper->expects($this->once()) ->method('findByName') ->with($this->equalTo($folderName)) @@ -179,12 +176,8 @@ class FolderBusinessLayerTest extends \OCA\News\Utility\TestUtility { array('id' => 1) ); - $trans = $this->getMock('Trans', array('t')); - $trans->expects($this->once()) + $this->l10n->expects($this->once()) ->method('t'); - $this->api->expects($this->once()) - ->method('getTrans') - ->will($this->returnValue($trans)); $this->folderMapper->expects($this->once()) ->method('findByName') ->with($this->equalTo($folderName)) |