summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDavide Saurino <davide.saurino@alcacoop.it>2013-11-16 12:51:13 +0100
committerDavide Saurino <davide.saurino@alcacoop.it>2013-11-16 12:51:13 +0100
commit260beb6b12b8955fbc1e4bf1a4494a51851a819c (patch)
tree0bbde53d86ad8d8bdfd9a508adb9f7c5a0af846d /tests
parente7b94256e450a6c059aa5654236ae07096aeabf9 (diff)
Rename Feed: tests added
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/businesslayer/FeedBusinessLayerTest.php22
-rw-r--r--tests/unit/controller/FeedControllerTest.php24
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();