diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-27 13:47:53 +0100 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-27 13:47:53 +0100 |
commit | 78674ebc36cf9d24309799651c09a7e194d15ea4 (patch) | |
tree | 6cf02edf94e6dee0d7c0f05b3d817fc6f96ecf74 /tests | |
parent | 003ab9ca77a2df654bdd152a29f9cf8071d55b68 (diff) |
star by guid hash and feedid to also star an item if it has been updated in the meantime. read still only works on the current version of the item, that means if an item is updated on the server side and an older version is being read on the server it will not be marked as read
Diffstat (limited to 'tests')
-rw-r--r-- | tests/bl/ItemBlTest.php | 14 | ||||
-rw-r--r-- | tests/controller/ItemControllerTest.php | 18 |
2 files changed, 23 insertions, 9 deletions
diff --git a/tests/bl/ItemBlTest.php b/tests/bl/ItemBlTest.php index 225435b7d..dc8f46a2c 100644 --- a/tests/bl/ItemBlTest.php +++ b/tests/bl/ItemBlTest.php @@ -187,21 +187,25 @@ class ItemBlTest extends \OCA\AppFramework\Utility\TestUtility { public function testStar(){ - $itemId = 3; + $feedId = 3; + $guidHash = md5('hihi'); + $item = new Item(); $item->setStatus(128); - $item->setId($itemId); + $item->setId($feedId); $this->mapper->expects($this->once()) - ->method('find') - ->with($this->equalTo($itemId), $this->equalTo($this->user)) + ->method('findByGuidHash') + ->with($this->equalTo($feedId), + $this->equalTo($guidHash), + $this->equalTo($this->user)) ->will($this->returnValue($item)); $this->mapper->expects($this->once()) ->method('update') ->with($this->equalTo($item)); - $this->bl->star($itemId, false, $this->user); + $this->bl->star($feedId, $guidHash, false, $this->user); $this->assertTrue($item->isUnstarred()); } diff --git a/tests/controller/ItemControllerTest.php b/tests/controller/ItemControllerTest.php index 3ab3de145..6ec73f8b8 100644 --- a/tests/controller/ItemControllerTest.php +++ b/tests/controller/ItemControllerTest.php @@ -145,7 +145,8 @@ class ItemControllerTest extends ControllerTestUtility { public function testStar(){ $url = array( - 'itemId' => 4 + 'feedId' => 4, + 'guidHash' => md5('test') ); $this->controller = $this->getPostController(array(), $url); @@ -154,7 +155,11 @@ class ItemControllerTest extends ControllerTestUtility { ->will($this->returnValue($this->user)); $this->bl->expects($this->once()) ->method('star') - ->with($url['itemId'], true, $this->user); + ->with( + $this->equalTo($url['feedId']), + $this->equalTo($url['guidHash']), + $this->equalTo(true), + $this->equalTo($this->user)); $this->controller->star(); } @@ -162,7 +167,8 @@ class ItemControllerTest extends ControllerTestUtility { public function testUnstar(){ $url = array( - 'itemId' => 4 + 'feedId' => 4, + 'guidHash' => md5('test') ); $this->controller = $this->getPostController(array(), $url); @@ -171,7 +177,11 @@ class ItemControllerTest extends ControllerTestUtility { ->will($this->returnValue($this->user)); $this->bl->expects($this->once()) ->method('star') - ->with($url['itemId'], false, $this->user); + ->with( + $this->equalTo($url['feedId']), + $this->equalTo($url['guidHash']), + $this->equalTo(false), + $this->equalTo($this->user)); $this->controller->unstar(); } |