From 89f2c7cfdba7dcc953a5bff807b7b290294ee516 Mon Sep 17 00:00:00 2001 From: Daniel Opitz Date: Sun, 16 Sep 2018 18:07:40 +0200 Subject: add setters + getters to Folder and Item entities, fixed unit tests, rearranged methods --- tests/Unit/Controller/ItemApiControllerTest.php | 30 +++++++++++++++++-------- 1 file changed, 21 insertions(+), 9 deletions(-) (limited to 'tests/Unit/Controller/ItemApiControllerTest.php') diff --git a/tests/Unit/Controller/ItemApiControllerTest.php b/tests/Unit/Controller/ItemApiControllerTest.php index ad2b323e7..e4aed96df 100644 --- a/tests/Unit/Controller/ItemApiControllerTest.php +++ b/tests/Unit/Controller/ItemApiControllerTest.php @@ -75,7 +75,11 @@ class ItemApiControllerTest extends \PHPUnit_Framework_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') @@ -88,13 +92,13 @@ class ItemApiControllerTest extends \PHPUnit_Framework_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 ); } @@ -102,7 +106,11 @@ class ItemApiControllerTest extends \PHPUnit_Framework_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') @@ -115,13 +123,13 @@ class ItemApiControllerTest extends \PHPUnit_Framework_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 ); } @@ -129,7 +137,11 @@ class ItemApiControllerTest extends \PHPUnit_Framework_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') @@ -140,13 +152,13 @@ class ItemApiControllerTest extends \PHPUnit_Framework_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 ); } -- cgit v1.2.3