diff options
author | Davide Saurino <davide.saurino@alcacoop.it> | 2013-11-16 12:51:13 +0100 |
---|---|---|
committer | Davide Saurino <davide.saurino@alcacoop.it> | 2013-11-16 12:51:13 +0100 |
commit | 260beb6b12b8955fbc1e4bf1a4494a51851a819c (patch) | |
tree | 0bbde53d86ad8d8bdfd9a508adb9f7c5a0af846d /tests/unit | |
parent | e7b94256e450a6c059aa5654236ae07096aeabf9 (diff) |
Rename Feed: tests added
Diffstat (limited to 'tests/unit')
-rw-r--r-- | tests/unit/businesslayer/FeedBusinessLayerTest.php | 22 | ||||
-rw-r--r-- | tests/unit/controller/FeedControllerTest.php | 24 |
2 files changed, 46 insertions, 0 deletions
diff --git a/tests/unit/businesslayer/FeedBusinessLayerTest.php b/tests/unit/businesslayer/FeedBusinessLayerTest.php index 5e379525d..454a4966e 100644 --- a/tests/unit/businesslayer/FeedBusinessLayerTest.php +++ b/tests/unit/businesslayer/FeedBusinessLayerTest.php @@ -459,6 +459,28 @@ class FeedBusinessLayerTest extends \OCA\AppFramework\Utility\TestUtility { } + public function testRenameFeed(){ + $feedId = 3; + $feedTitle = "New Feed Title"; + $feed = new Feed(); + $feed->setTitle("Feed Title"); + $feed->setId($feedId); + + $this->feedMapper->expects($this->once()) + ->method('find') + ->with($this->equalTo($feedId), $this->equalTo($this->user)) + ->will($this->returnValue($feed)); + + $this->feedMapper->expects($this->once()) + ->method('update') + ->with($this->equalTo($feed)); + + $this->feedBusinessLayer->rename($feedId, $feedTitle, $this->user); + + $this->assertEquals($feedTitle, $feed->getTitle()); + } + + public function testImportArticles(){ $url = 'http://owncloud/nofeed'; diff --git a/tests/unit/controller/FeedControllerTest.php b/tests/unit/controller/FeedControllerTest.php index e3204517b..296f87b22 100644 --- a/tests/unit/controller/FeedControllerTest.php +++ b/tests/unit/controller/FeedControllerTest.php @@ -543,6 +543,30 @@ class FeedControllerTest extends ControllerTestUtility { } + public function testRename(){ + $post = array( + 'feedTitle' => "New Feed Title" + ); + $url = array( + 'feedId' => 4 + ); + $this->controller = $this->getPostController($post, $url); + + $this->api->expects($this->once()) + ->method('getUserId') + ->will($this->returnValue($this->user)); + $this->feedBusinessLayer->expects($this->once()) + ->method('rename') + ->with($this->equalTo($url['feedId']), + $this->equalTo($post['feedTitle']), + $this->equalTo($this->user)); + + $response = $this->controller->rename(); + + $this->assertTrue($response instanceof JSONResponse); + } + + public function testImportArticles() { $feed = new Feed(); |