summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-05-09 13:44:16 +0200
committerBernhard Posselt <nukeawhale@gmail.com>2013-05-09 13:44:16 +0200
commit59069e85a26dd72bb1798e0ee517d607f6021443 (patch)
treebc91a247e034747e13c0f51fe9a52fa6c23eadb3 /tests
parentc89457778121b31e1db388219b1321dc1a7df221 (diff)
also send newest item id when creating a feed from the api
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/external/FeedAPITest.php44
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/unit/external/FeedAPITest.php b/tests/unit/external/FeedAPITest.php
index b83940832..8e0d78731 100644
--- a/tests/unit/external/FeedAPITest.php
+++ b/tests/unit/external/FeedAPITest.php
@@ -217,6 +217,49 @@ class FeedAPITest extends \PHPUnit_Framework_TestCase {
$this->equalTo(3),
$this->equalTo($this->user))
->will($this->returnValue($feeds[0]));
+ $this->itemBusinessLayer->expects($this->once())
+ ->method('getNewestItemId')
+ ->will($this->returnValue(3));
+
+ $response = $this->feedAPI->create();
+
+ $this->assertEquals(array(
+ 'feeds' => array($feeds[0]->toAPI()),
+ 'newestItemId' => 3
+ ), $response->getData());
+
+ $this->assertNull($response->getMessage());
+ $this->assertEquals(NewsAPIResult::OK, $response->getStatusCode());
+ }
+
+
+ public function testCreateNoItems() {
+ $feeds = array(
+ new Feed()
+ );
+ $request = new Request(array('params' => array(
+ 'url' => 'ho',
+ 'folderId' => 3
+ )));
+ $this->feedAPI = new FeedAPI(
+ $this->api,
+ $request,
+ $this->folderBusinessLayer,
+ $this->feedBusinessLayer,
+ $this->itemBusinessLayer
+ );
+
+
+ $this->feedBusinessLayer->expects($this->once())
+ ->method('create')
+ ->with(
+ $this->equalTo('ho'),
+ $this->equalTo(3),
+ $this->equalTo($this->user))
+ ->will($this->returnValue($feeds[0]));
+ $this->itemBusinessLayer->expects($this->once())
+ ->method('getNewestItemId')
+ ->will($this->throwException(new BusinessLayerException('')));
$response = $this->feedAPI->create();
@@ -229,6 +272,7 @@ class FeedAPITest extends \PHPUnit_Framework_TestCase {
}
+
public function testCreateExists() {
$this->feedBusinessLayer->expects($this->once())
->method('create')