From d67b77ac255974d2298bd858b636767e490a4e41 Mon Sep 17 00:00:00 2001 From: Davide Saurino Date: Thu, 13 Mar 2014 00:00:03 +0100 Subject: Test for renaming feed API feature --- tests/unit/api/FeedAPITest.php | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'tests') diff --git a/tests/unit/api/FeedAPITest.php b/tests/unit/api/FeedAPITest.php index e3b5b5587..6b2187657 100644 --- a/tests/unit/api/FeedAPITest.php +++ b/tests/unit/api/FeedAPITest.php @@ -437,6 +437,43 @@ class FeedAPITest extends ControllerTestUtility { } + public function testRename() { + $feedId = 3; + $feedTitle = 'test'; + + $request = new Request(array( + 'urlParams' => array( + 'feedId' => $feedId + ), + 'params' => array( + 'feedTitle' => $feedTitle + ) + )); + $this->feedAPI = new FeedAPI( + $this->api, + $request, + $this->folderBusinessLayer, + $this->feedBusinessLayer, + $this->itemBusinessLayer + ); + + $this->api->expects($this->once()) + ->method('getUserId') + ->will($this->returnValue($this->user)); + $this->feedBusinessLayer->expects($this->once()) + ->method('rename') + ->with( + $this->equalTo($feedId), + $this->equalTo($feedTitle), + $this->equalTo($this->user)); + + $response = $this->feedAPI->rename(); + + $this->assertEmpty($response->getData()); + $this->assertEquals(Http::STATUS_OK, $response->getStatus()); + } + + public function testMoveDoesNotExist() { $this->api->expects($this->once()) ->method('getUserId') -- cgit v1.2.3