summaryrefslogtreecommitdiffstats
path: root/tests/unit/service/ItemServiceTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/service/ItemServiceTest.php')
-rw-r--r--tests/unit/service/ItemServiceTest.php33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/unit/service/ItemServiceTest.php b/tests/unit/service/ItemServiceTest.php
index 557d31816..d5947b406 100644
--- a/tests/unit/service/ItemServiceTest.php
+++ b/tests/unit/service/ItemServiceTest.php
@@ -210,6 +210,39 @@ class ItemServiceTest extends \PHPUnit_Framework_TestCase {
}
+ public function testUnstar(){
+ $itemId = 3;
+ $feedId = 5;
+ $guidHash = md5('hihi');
+
+ $item = new Item();
+ $item->setStatus(128);
+ $item->setId($itemId);
+ $item->setStarred();
+
+ $expectedItem = new Item();
+ $expectedItem->setStatus(128);
+ $expectedItem->setUnstarred();
+ $expectedItem->setId($itemId);
+ $expectedItem->setLastModified($this->time);
+
+ $this->mapper->expects($this->once())
+ ->method('findByGuidHash')
+ ->with(
+ $this->equalTo($guidHash),
+ $this->equalTo($feedId),
+ $this->equalTo($this->user))
+ ->will($this->returnValue($item));
+
+ $this->mapper->expects($this->once())
+ ->method('update')
+ ->with($this->equalTo($expectedItem));
+
+ $this->itemService->star($feedId, $guidHash, false, $this->user);
+
+ $this->assertTrue($item->isUnstarred());
+ }
+
public function testRead(){
$itemId = 3;
$item = new Item();