diff options
author | Sean Molenaar <SMillerDev@users.noreply.github.com> | 2018-10-02 14:45:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-02 14:45:36 +0200 |
commit | 21e6f5cd6e4d75655872c58d887d6457530b4b04 (patch) | |
tree | 4f80a00c6a3a0447d6a1375ed8d3ef501bf21109 /tests/Unit/Controller/ItemApiControllerTest.php | |
parent | 13fb06e5141e3433ab502565527324ad1e924d00 (diff) | |
parent | 3c3de1756854c95a386e5396cb90424853c4c6ac (diff) |
Merge pull request #283 from danopz/entity-methods
Entity setters + getters
Diffstat (limited to 'tests/Unit/Controller/ItemApiControllerTest.php')
-rw-r--r-- | tests/Unit/Controller/ItemApiControllerTest.php | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/tests/Unit/Controller/ItemApiControllerTest.php b/tests/Unit/Controller/ItemApiControllerTest.php index 916b85a36..1e6fde59b 100644 --- a/tests/Unit/Controller/ItemApiControllerTest.php +++ b/tests/Unit/Controller/ItemApiControllerTest.php @@ -77,7 +77,11 @@ class ItemApiControllerTest extends TestCase public function testIndex() { - $items = [new Item()]; + $item = new Item(); + $item->setId(5); + $item->setGuid('guid'); + $item->setGuidHash('guidhash'); + $item->setFeedId(123); $this->itemService->expects($this->once()) ->method('findAll') @@ -90,13 +94,13 @@ class ItemApiControllerTest extends TestCase $this->equalTo(true), $this->equalTo($this->user->getUID()) ) - ->will($this->returnValue($items)); + ->will($this->returnValue([$item])); $response = $this->itemAPI->index(1, 2, true, 30, 20, true); $this->assertEquals( [ - 'items' => [$items[0]->toApi()] + 'items' => [$item->toApi()] ], $response ); } @@ -104,7 +108,11 @@ class ItemApiControllerTest extends TestCase public function testIndexDefaultBatchSize() { - $items = [new Item()]; + $item = new Item(); + $item->setId(5); + $item->setGuid('guid'); + $item->setGuidHash('guidhash'); + $item->setFeedId(123); $this->itemService->expects($this->once()) ->method('findAll') @@ -117,13 +125,13 @@ class ItemApiControllerTest extends TestCase $this->equalTo(false), $this->equalTo($this->user->getUID()) ) - ->will($this->returnValue($items)); + ->will($this->returnValue([$item])); $response = $this->itemAPI->index(1, 2, false); $this->assertEquals( [ - 'items' => [$items[0]->toApi()] + 'items' => [$item->toApi()] ], $response ); } @@ -131,7 +139,11 @@ class ItemApiControllerTest extends TestCase public function testUpdated() { - $items = [new Item()]; + $item = new Item(); + $item->setId(5); + $item->setGuid('guid'); + $item->setGuidHash('guidhash'); + $item->setFeedId(123); $this->itemService->expects($this->once()) ->method('findAllNew') @@ -142,13 +154,13 @@ class ItemApiControllerTest extends TestCase $this->equalTo(true), $this->equalTo($this->user->getUID()) ) - ->will($this->returnValue($items)); + ->will($this->returnValue([$item])); $response = $this->itemAPI->updated(1, 2, 30); $this->assertEquals( [ - 'items' => [$items[0]->toApi()] + 'items' => [$item->toApi()] ], $response ); } |