From 70ff47a9b77797e75137ba02f0b7df9bc2745f56 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Sun, 6 Sep 2015 15:42:51 +0200 Subject: fix # 848 --- tests/unit/controller/FeedControllerTest.php | 13 +++++++++++++ tests/unit/db/FeedTest.php | 5 ++++- tests/unit/service/FeedServiceTest.php | 16 ++++++++++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/unit/controller/FeedControllerTest.php b/tests/unit/controller/FeedControllerTest.php index ceed1c0b2..80f2c805f 100644 --- a/tests/unit/controller/FeedControllerTest.php +++ b/tests/unit/controller/FeedControllerTest.php @@ -530,6 +530,19 @@ class FeedControllerTest extends \PHPUnit_Framework_TestCase { $this->controller->enableFullText(4, true); } + + public function testPinned() { + $this->feedService->expects($this->once()) + ->method('setPinned') + ->with($this->equalTo(4), + $this->equalTo(true), + $this->equalTo($this->user)) + ->will($this->returnValue(1)); + + $this->controller->pinned(4, true); + } + + public function testOrderingDoesNotExist(){ $msg = 'hehe'; diff --git a/tests/unit/db/FeedTest.php b/tests/unit/db/FeedTest.php index f1fd408b6..1185203fd 100644 --- a/tests/unit/db/FeedTest.php +++ b/tests/unit/db/FeedTest.php @@ -32,6 +32,7 @@ class FeedTest extends \PHPUnit_Framework_TestCase { $feed->setLocation('http://google.at'); $feed->setOrdering(2); $feed->setFullTextEnabled(true); + $feed->setPinned(true); return $feed; } @@ -47,6 +48,7 @@ class FeedTest extends \PHPUnit_Framework_TestCase { 'folderId' => 1, 'unreadCount' => 321, 'ordering' => 2, + 'pinned' => true, 'link' => 'https://www.google.com/some/weird/path', ], $feed->toAPI()); } @@ -72,7 +74,8 @@ class FeedTest extends \PHPUnit_Framework_TestCase { 'cssClass' => 'custom-google-com', 'location' => 'http://google.at', 'ordering' => 2, - 'fullTextEnabled' => true + 'fullTextEnabled' => true, + 'pinned' => true ], $feed->jsonSerialize()); } diff --git a/tests/unit/service/FeedServiceTest.php b/tests/unit/service/FeedServiceTest.php index 697a95efe..001d69adf 100644 --- a/tests/unit/service/FeedServiceTest.php +++ b/tests/unit/service/FeedServiceTest.php @@ -907,5 +907,21 @@ class FeedServiceTest extends \PHPUnit_Framework_TestCase { } + public function testSetPinned () { + $feed = Feed::fromRow(['id' => 3, 'pinned' => false]); + $this->feedMapper->expects($this->once()) + ->method('find') + ->with($this->equalTo($feed->getId()), + $this->equalTo($this->user)) + ->will($this->returnValue($feed)); + + $feed->setPinned(true); + $this->feedMapper->expects($this->once()) + ->method('update') + ->with($this->equalTo($feed)); + + $this->feedService->setPinned(3, true, $this->user); + } + } -- cgit v1.2.3