diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2015-11-01 17:16:15 +0300 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2015-11-01 17:16:15 +0300 |
commit | a42da9a97c7fc84af09e01f3d6f3ee80a46b763b (patch) | |
tree | cf4b58d55c0f4e46db3dbea1bd3bd93f155d107c /tests | |
parent | cc5dd4231b11f87a7b0d0e66a7d00e62d11f7fb9 (diff) |
clean up feed api
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/controller/FeedApiControllerTest.php | 20 | ||||
-rw-r--r-- | tests/unit/controller/FeedControllerTest.php | 57 | ||||
-rw-r--r-- | tests/unit/service/FeedServiceTest.php | 4 |
3 files changed, 12 insertions, 69 deletions
diff --git a/tests/unit/controller/FeedApiControllerTest.php b/tests/unit/controller/FeedApiControllerTest.php index c73f49288..f13e96660 100644 --- a/tests/unit/controller/FeedApiControllerTest.php +++ b/tests/unit/controller/FeedApiControllerTest.php @@ -246,11 +246,11 @@ class FeedApiControllerTest extends \PHPUnit_Framework_TestCase { public function testMove() { $this->feedService->expects($this->once()) - ->method('move') + ->method('patch') ->with( $this->equalTo(3), - $this->equalTo(30), - $this->equalTo($this->user)); + $this->equalTo($this->user), + $this->equalTo(['folderId' => 30])); $this->feedAPI->move(3, 30); } @@ -258,7 +258,7 @@ class FeedApiControllerTest extends \PHPUnit_Framework_TestCase { public function testMoveDoesNotExist() { $this->feedService->expects($this->once()) - ->method('move') + ->method('patch') ->will( $this->throwException(new ServiceNotFoundException($this->msg)) ); @@ -276,11 +276,11 @@ class FeedApiControllerTest extends \PHPUnit_Framework_TestCase { $feedTitle = 'test'; $this->feedService->expects($this->once()) - ->method('rename') + ->method('patch') ->with( $this->equalTo($feedId), - $this->equalTo($feedTitle), - $this->equalTo($this->user)); + $this->equalTo($this->user), + $this->equalTo(['title' => $feedTitle])); $this->feedAPI->rename($feedId, $feedTitle); } @@ -291,11 +291,11 @@ class FeedApiControllerTest extends \PHPUnit_Framework_TestCase { $feedTitle = 'test'; $this->feedService->expects($this->once()) - ->method('rename') + ->method('patch') ->with( $this->equalTo($feedId), - $this->equalTo($feedTitle), - $this->equalTo($this->user)) + $this->equalTo($this->user), + $this->equalTo(['title' => $feedTitle])) ->will($this->throwException(new ServiceNotFoundException('hi'))); $result = $this->feedAPI->rename($feedId, $feedTitle); diff --git a/tests/unit/controller/FeedControllerTest.php b/tests/unit/controller/FeedControllerTest.php index f821fde02..3630ad2f8 100644 --- a/tests/unit/controller/FeedControllerTest.php +++ b/tests/unit/controller/FeedControllerTest.php @@ -365,63 +365,6 @@ class FeedControllerTest extends \PHPUnit_Framework_TestCase { } - public function testMove(){ - $this->feedService->expects($this->once()) - ->method('move') - ->with($this->equalTo(4), - $this->equalTo(3), - $this->equalTo($this->user)); - - $this->controller->move(4, 3); - - } - - - public function testMoveDoesNotExist(){ - $msg = 'john'; - - $this->feedService->expects($this->once()) - ->method('move') - ->will($this->throwException(new ServiceNotFoundException($msg))); - - $response = $this->controller->move(4, 3); - $params = json_decode($response->render(), true); - - $this->assertEquals($msg, $params['message']); - $this->assertEquals($response->getStatus(), Http::STATUS_NOT_FOUND); - } - - - public function testRename(){ - $this->feedService->expects($this->once()) - ->method('rename') - ->with($this->equalTo(4), - $this->equalTo('title'), - $this->equalTo($this->user)); - - $this->controller->rename(4, 'title'); - } - - - public function testRenameDoesNotExist(){ - $msg = 'hi'; - - $this->feedService->expects($this->once()) - ->method('rename') - ->with($this->equalTo(4), - $this->equalTo('title'), - $this->equalTo($this->user)) - ->will($this->throwException(new ServiceNotFoundException($msg))); - - $response = $this->controller->rename(4, 'title'); - - $params = $response->getData(); - - $this->assertEquals($msg, $params['message']); - $this->assertEquals($response->getStatus(), Http::STATUS_NOT_FOUND); - } - - public function testImport() { $feed = new Feed(); diff --git a/tests/unit/service/FeedServiceTest.php b/tests/unit/service/FeedServiceTest.php index a61b9929c..a74208c29 100644 --- a/tests/unit/service/FeedServiceTest.php +++ b/tests/unit/service/FeedServiceTest.php @@ -687,7 +687,7 @@ class FeedServiceTest extends \PHPUnit_Framework_TestCase { ->method('update') ->with($this->equalTo($feed)); - $this->feedService->move($feedId, $folderId, $this->user); + $this->feedService->patch($feedId, $this->user, ['folderId' => $folderId]); $this->assertEquals($folderId, $feed->getFolderId()); } @@ -709,7 +709,7 @@ class FeedServiceTest extends \PHPUnit_Framework_TestCase { ->method('update') ->with($this->equalTo($feed)); - $this->feedService->rename($feedId, $feedTitle, $this->user); + $this->feedService->patch($feedId, $this->user, ['title' => $feedTitle]); $this->assertEquals($feedTitle, $feed->getTitle()); } |