summaryrefslogtreecommitdiffstats
path: root/tests/Unit/Controller
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Unit/Controller')
-rw-r--r--tests/Unit/Controller/AdminControllerTest.php36
-rw-r--r--tests/Unit/Controller/EntityApiSerializerTest.php32
-rw-r--r--tests/Unit/Controller/ExportControllerTest.php41
-rw-r--r--tests/Unit/Controller/FeedApiControllerTest.php131
-rw-r--r--tests/Unit/Controller/FeedControllerTest.php144
-rw-r--r--tests/Unit/Controller/FolderApiControllerTest.php77
-rw-r--r--tests/Unit/Controller/FolderControllerTest.php50
-rw-r--r--tests/Unit/Controller/ItemApiControllerTest.php179
-rw-r--r--tests/Unit/Controller/ItemControllerTest.php160
-rw-r--r--tests/Unit/Controller/JSONHttpErrorTest.php17
-rw-r--r--tests/Unit/Controller/PageControllerTest.php194
-rw-r--r--tests/Unit/Controller/UserApiControllerTest.php56
-rw-r--r--tests/Unit/Controller/UtilityApiControllerTest.php44
13 files changed, 753 insertions, 408 deletions
diff --git a/tests/Unit/Controller/AdminControllerTest.php b/tests/Unit/Controller/AdminControllerTest.php
index 33926d0d2..a2b7f304a 100644
--- a/tests/Unit/Controller/AdminControllerTest.php
+++ b/tests/Unit/Controller/AdminControllerTest.php
@@ -5,18 +5,18 @@
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
- * @author Alessandro Cosentino <cosenal@gmail.com>
- * @author Bernhard Posselt <dev@bernhard-posselt.com>
- * @copyright Alessandro Cosentino 2012
- * @copyright Bernhard Posselt 2012, 2014
+ * @author Alessandro Cosentino <cosenal@gmail.com>
+ * @author Bernhard Posselt <dev@bernhard-posselt.com>
+ * @copyright 2012 Alessandro Cosentino
+ * @copyright 2012-2014 Bernhard Posselt
*/
namespace OCA\News\Tests\Unit\Controller;
-
use OCA\News\Controller\AdminController;
-class AdminControllerTest extends \PHPUnit_Framework_TestCase {
+class AdminControllerTest extends \PHPUnit_Framework_TestCase
+{
private $appName;
private $request;
@@ -28,28 +28,35 @@ class AdminControllerTest extends \PHPUnit_Framework_TestCase {
/**
* Gets run before each test
*/
- public function setUp(){
+ public function setUp()
+ {
$this->appName = 'news';
$this->request = $this->getMockBuilder(
- '\OCP\IRequest')
+ '\OCP\IRequest'
+ )
->disableOriginalConstructor()
->getMock();
$this->config = $this->getMockBuilder(
- '\OCA\News\Config\Config')
+ '\OCA\News\Config\Config'
+ )
->disableOriginalConstructor()
->getMock();
$this->itemService = $this->getMockBuilder(
- '\OCA\News\Service\ItemService')
+ '\OCA\News\Service\ItemService'
+ )
->disableOriginalConstructor()
->getMock();
$this->configPath = 'my.ini';
- $this->controller = new AdminController($this->appName, $this->request,
- $this->config, $this->itemService, $this->configPath);
+ $this->controller = new AdminController(
+ $this->appName, $this->request,
+ $this->config, $this->itemService, $this->configPath
+ );
}
- public function testIndex() {
+ public function testIndex()
+ {
$expected = [
'autoPurgeMinimumInterval' => 1,
'autoPurgeCount' => 2,
@@ -92,7 +99,8 @@ class AdminControllerTest extends \PHPUnit_Framework_TestCase {
}
- public function testUpdate() {
+ public function testUpdate()
+ {
$expected = [
'autoPurgeMinimumInterval' => 1,
'autoPurgeCount' => 2,
diff --git a/tests/Unit/Controller/EntityApiSerializerTest.php b/tests/Unit/Controller/EntityApiSerializerTest.php
index 261d5f7c4..49b7e0b8d 100644
--- a/tests/Unit/Controller/EntityApiSerializerTest.php
+++ b/tests/Unit/Controller/EntityApiSerializerTest.php
@@ -5,10 +5,10 @@
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
- * @author Alessandro Cosentino <cosenal@gmail.com>
- * @author Bernhard Posselt <dev@bernhard-posselt.com>
- * @copyright Alessandro Cosentino 2012
- * @copyright Bernhard Posselt 2012, 2014
+ * @author Alessandro Cosentino <cosenal@gmail.com>
+ * @author Bernhard Posselt <dev@bernhard-posselt.com>
+ * @copyright 2012 Alessandro Cosentino
+ * @copyright 2012-2014 Bernhard Posselt
*/
namespace OCA\News\Tests\Unit\Controller;
@@ -19,15 +19,18 @@ use \OCP\AppFramework\Db\Entity;
use \OCA\News\Db\Item;
-class TestEntity extends Entity {
+class TestEntity extends Entity
+{
}
-class EntityApiSerializerTest extends \PHPUnit_Framework_TestCase {
+class EntityApiSerializerTest extends \PHPUnit_Framework_TestCase
+{
- public function testSerializeSingle() {
+ public function testSerializeSingle()
+ {
$item = new Item();
$item->setUnread(true);
@@ -38,7 +41,8 @@ class EntityApiSerializerTest extends \PHPUnit_Framework_TestCase {
}
- public function testSerializeMultiple() {
+ public function testSerializeMultiple()
+ {
$item = new Item();
$item->setUnread(true);
@@ -54,7 +58,8 @@ class EntityApiSerializerTest extends \PHPUnit_Framework_TestCase {
}
- public function testResponseNoChange() {
+ public function testResponseNoChange()
+ {
$response = new Response();
$serializer = new EntityApiSerializer('items');
@@ -64,7 +69,8 @@ class EntityApiSerializerTest extends \PHPUnit_Framework_TestCase {
}
- public function testCompleteArraysTransformed() {
+ public function testCompleteArraysTransformed()
+ {
$item = new Item();
$item->setUnread(true);
@@ -86,7 +92,8 @@ class EntityApiSerializerTest extends \PHPUnit_Framework_TestCase {
}
- public function testNoEntityNoChange() {
+ public function testNoEntityNoChange()
+ {
$serializer = new EntityApiSerializer('items');
$in = [
@@ -102,7 +109,8 @@ class EntityApiSerializerTest extends \PHPUnit_Framework_TestCase {
}
- public function testEntitiesNoChange() {
+ public function testEntitiesNoChange()
+ {
$serializer = new EntityApiSerializer('items');
$in = [
diff --git a/tests/Unit/Controller/ExportControllerTest.php b/tests/Unit/Controller/ExportControllerTest.php
index 6701b38a6..592582b3a 100644
--- a/tests/Unit/Controller/ExportControllerTest.php
+++ b/tests/Unit/Controller/ExportControllerTest.php
@@ -5,10 +5,10 @@
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
- * @author Alessandro Cosentino <cosenal@gmail.com>
- * @author Bernhard Posselt <dev@bernhard-posselt.com>
- * @copyright Alessandro Cosentino 2012
- * @copyright Bernhard Posselt 2012, 2014
+ * @author Alessandro Cosentino <cosenal@gmail.com>
+ * @author Bernhard Posselt <dev@bernhard-posselt.com>
+ * @copyright 2012 Alessandro Cosentino
+ * @copyright 2012-2014 Bernhard Posselt
*/
namespace OCA\News\Tests\Unit\Controller;
@@ -22,7 +22,8 @@ use \OCA\News\Db\Item;
use \OCA\News\Db\Feed;
-class ExportControllerTest extends \PHPUnit_Framework_TestCase {
+class ExportControllerTest extends \PHPUnit_Framework_TestCase
+{
private $appName;
private $request;
@@ -36,32 +37,39 @@ class ExportControllerTest extends \PHPUnit_Framework_TestCase {
/**
* Gets run before each test
*/
- public function setUp(){
+ public function setUp()
+ {
$this->appName = 'news';
$this->user = 'john';
$this->itemService = $this->getMockBuilder(
- '\OCA\News\Service\ItemService')
+ '\OCA\News\Service\ItemService'
+ )
->disableOriginalConstructor()
->getMock();
$this->feedService = $this->getMockBuilder(
- '\OCA\News\Service\FeedService')
+ '\OCA\News\Service\FeedService'
+ )
->disableOriginalConstructor()
->getMock();
$this->folderService = $this->getMockBuilder(
- '\OCA\News\Service\FolderService')
+ '\OCA\News\Service\FolderService'
+ )
->disableOriginalConstructor()
->getMock();
$this->request = $this->getMockBuilder('\OCP\IRequest')
->disableOriginalConstructor()
->getMock();
$this->opmlExporter = new OPMLExporter();
- $this->controller = new ExportController($this->appName, $this->request,
+ $this->controller = new ExportController(
+ $this->appName, $this->request,
$this->folderService, $this->feedService,
- $this->itemService, $this->opmlExporter, $this->user);
+ $this->itemService, $this->opmlExporter, $this->user
+ );
}
- public function testOpmlExportNoFeeds(){
+ public function testOpmlExportNoFeeds()
+ {
$opml =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" .
"<opml version=\"2.0\">\n" .
@@ -86,7 +94,8 @@ class ExportControllerTest extends \PHPUnit_Framework_TestCase {
}
- public function testGetAllArticles(){
+ public function testGetAllArticles()
+ {
$item1 = new Item();
$item1->setFeedId(3);
$item2 = new Item();
@@ -119,14 +128,16 @@ class ExportControllerTest extends \PHPUnit_Framework_TestCase {
$headers ['Content-Disposition']
);
- $this->assertEquals('[{"guid":null,"url":null,"title":null,' .
+ $this->assertEquals(
+ '[{"guid":null,"url":null,"title":null,' .
'"author":null,"pubDate":null,"updatedDate":null,"body":null,"enclosureMime":null,' .
'"enclosureLink":null,"unread":false,"starred":false,' .
'"feedLink":"http:\/\/goo","rtl":null},{"guid":null,"url":null,' .
'"title":null,"author":null,"pubDate":null,"updatedDate":null,"body":null,' .
'"enclosureMime":null,"enclosureLink":null,"unread":false,' .
'"starred":false,"feedLink":"http:\/\/gee","rtl":null}]',
- $return->render());
+ $return->render()
+ );
}
}
diff --git a/tests/Unit/Controller/FeedApiControllerTest.php b/tests/Unit/Controller/FeedApiControllerTest.php
index 8c0b25873..bc91e1df8 100644
--- a/tests/Unit/Controller/FeedApiControllerTest.php
+++ b/tests/Unit/Controller/FeedApiControllerTest.php
@@ -5,10 +5,10 @@
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
- * @author Alessandro Cosentino <cosenal@gmail.com>
- * @author Bernhard Posselt <dev@bernhard-posselt.com>
- * @copyright Alessandro Cosentino 2012
- * @copyright Bernhard Posselt 2012, 2014
+ * @author Alessandro Cosentino <cosenal@gmail.com>
+ * @author Bernhard Posselt <dev@bernhard-posselt.com>
+ * @copyright 2012 Alessandro Cosentino
+ * @copyright 2012-2014 Bernhard Posselt
*/
namespace OCA\News\Tests\Unit\Controller;
@@ -23,7 +23,8 @@ use \OCA\News\Db\Feed;
use \OCA\News\Db\Item;
-class FeedApiControllerTest extends \PHPUnit_Framework_TestCase {
+class FeedApiControllerTest extends \PHPUnit_Framework_TestCase
+{
private $feedService;
private $itemService;
@@ -35,24 +36,29 @@ class FeedApiControllerTest extends \PHPUnit_Framework_TestCase {
private $logger;
private $loggerParams;
- protected function setUp() {
+ protected function setUp()
+ {
$this->user = 'tom';
$this->loggerParams = ['hi'];
$this->logger = $this->getMockBuilder(
- '\OCP\ILogger')
+ '\OCP\ILogger'
+ )
->disableOriginalConstructor()
->getMock();
$this->appName = 'news';
$this->request = $this->getMockBuilder(
- '\OCP\IRequest')
+ '\OCP\IRequest'
+ )
->disableOriginalConstructor()
->getMock();
$this->feedService = $this->getMockBuilder(
- '\OCA\News\Service\FeedService')
+ '\OCA\News\Service\FeedService'
+ )
->disableOriginalConstructor()
->getMock();
$this->itemService = $this->getMockBuilder(
- '\OCA\News\Service\ItemService')
+ '\OCA\News\Service\ItemService'
+ )
->disableOriginalConstructor()
->getMock();
$this->feedAPI = new FeedApiController(
@@ -68,7 +74,8 @@ class FeedApiControllerTest extends \PHPUnit_Framework_TestCase {
}
- public function testIndex() {
+ public function testIndex()
+ {
$feeds = [new Feed()];
$starredCount = 3;
$newestItemId = 2;
@@ -88,15 +95,18 @@ class FeedApiControllerTest extends \PHPUnit_Framework_TestCase {
$response = $this->feedAPI->index();
- $this->assertEquals([
+ $this->assertEquals(
+ [
'feeds' => [$feeds[0]->toAPI()],
'starredCount' => $starredCount,
'newestItemId' => $newestItemId
- ], $response);
+ ], $response
+ );
}
- public function testIndexNoNewestItemId() {
+ public function testIndexNoNewestItemId()
+ {
$feeds = [new Feed()];
$starredCount = 3;
@@ -115,29 +125,36 @@ class FeedApiControllerTest extends \PHPUnit_Framework_TestCase {
$response = $this->feedAPI->index();
- $this->assertEquals([
+ $this->assertEquals(
+ [
'feeds' => [$feeds[0]->toAPI()],
'starredCount' => $starredCount,
- ], $response);
+ ], $response
+ );
}
- public function testDelete() {
+ public function testDelete()
+ {
$this->feedService->expects($this->once())
->method('delete')
->with(
$this->equalTo(2),
- $this->equalTo($this->user));
+ $this->equalTo($this->user)
+ );
$this->feedAPI->delete(2);
}
- public function testDeleteDoesNotExist() {
+ public function testDeleteDoesNotExist()
+ {
$this->feedService->expects($this->once())
->method('delete')
- ->will($this->throwException(
- new ServiceNotFoundException($this->msg))
+ ->will(
+ $this->throwException(
+ new ServiceNotFoundException($this->msg)
+ )
);
$response = $this->feedAPI->delete(2);
@@ -148,7 +165,8 @@ class FeedApiControllerTest extends \PHPUnit_Framework_TestCase {
}
- public function testCreate() {
+ public function testCreate()
+ {
$feeds = [new Feed()];
$this->feedService->expects($this->once())
@@ -159,7 +177,8 @@ class FeedApiControllerTest extends \PHPUnit_Framework_TestCase {
->with(
$this->equalTo('url'),
$this->equalTo(3),
- $this->equalTo($this->user))
+ $this->equalTo($this->user)
+ )
->will($this->returnValue($feeds[0]));
$this->itemService->expects($this->once())
->method('getNewestItemId')
@@ -167,14 +186,17 @@ class FeedApiControllerTest extends \PHPUnit_Framework_TestCase {
$response = $this->feedAPI->create('url', 3);
- $this->assertEquals([
+ $this->assertEquals(
+ [
'feeds' => [$feeds[0]->toAPI()],
'newestItemId' => 3
- ], $response);
+ ], $response
+ );
}
- public function testCreateNoItems() {
+ public function testCreateNoItems()
+ {
$feeds = [new Feed()];
$this->feedService->expects($this->once())
@@ -185,7 +207,8 @@ class FeedApiControllerTest extends \PHPUnit_Framework_TestCase {
->with(
$this->equalTo('ho'),
$this->equalTo(3),
- $this->equalTo($this->user))
+ $this->equalTo($this->user)
+ )
->will($this->returnValue($feeds[0]));
$this->itemService->expects($this->once())
->method('getNewestItemId')
@@ -193,14 +216,17 @@ class FeedApiControllerTest extends \PHPUnit_Framework_TestCase {
$response = $this->feedAPI->create('ho', 3);
- $this->assertEquals([
+ $this->assertEquals(
+ [
'feeds' => [$feeds[0]->toAPI()]
- ], $response);
+ ], $response
+ );
}
- public function testCreateExists() {
+ public function testCreateExists()
+ {
$this->feedService->expects($this->once())
->method('purgeDeleted')
->with($this->equalTo($this->user), $this->equalTo(false));
@@ -218,7 +244,8 @@ class FeedApiControllerTest extends \PHPUnit_Framework_TestCase {
}
- public function testCreateError() {
+ public function testCreateError()
+ {
$this->feedService->expects($this->once())
->method('create')
->will(
@@ -233,31 +260,36 @@ class FeedApiControllerTest extends \PHPUnit_Framework_TestCase {
}
- public function testRead() {
+ public function testRead()
+ {
$this->itemService->expects($this->once())
->method('readFeed')
->with(
$this->equalTo(3),
$this->equalTo(30),
- $this->equalTo($this->user));
+ $this->equalTo($this->user)
+ );
$this->feedAPI->read(3, 30);
}
- public function testMove() {
+ public function testMove()
+ {
$this->feedService->expects($this->once())
->method('patch')
->with(
$this->equalTo(3),
$this->equalTo($this->user),
- $this->equalTo(['folderId' => 30]));
+ $this->equalTo(['folderId' => 30])
+ );
$this->feedAPI->move(3, 30);
}
- public function testMoveDoesNotExist() {
+ public function testMoveDoesNotExist()
+ {
$this->feedService->expects($this->once())
->method('patch')
->will(
@@ -272,7 +304,8 @@ class FeedApiControllerTest extends \PHPUnit_Framework_TestCase {
}
- public function testRename() {
+ public function testRename()
+ {
$feedId = 3;
$feedTitle = 'test';
@@ -281,13 +314,15 @@ class FeedApiControllerTest extends \PHPUnit_Framework_TestCase {
->with(
$this->equalTo($feedId),
$this->equalTo($this->user),
- $this->equalTo(['title' => $feedTitle]));
+ $this->equalTo(['title' => $feedTitle])
+ );
$this->feedAPI->rename($feedId, $feedTitle);
}
- public function testRenameError() {
+ public function testRenameError()
+ {
$feedId = 3;
$feedTitle = 'test';
@@ -296,7 +331,8 @@ class FeedApiControllerTest extends \PHPUnit_Framework_TestCase {
->with(
$this->equalTo($feedId),
$this->equalTo($this->user),
- $this->equalTo(['title' => $feedTitle]))
+ $this->equalTo(['title' => $feedTitle])
+ )
->will($this->throwException(new ServiceNotFoundException('hi')));
$result = $this->feedAPI->rename($feedId, $feedTitle);
@@ -308,7 +344,8 @@ class FeedApiControllerTest extends \PHPUnit_Framework_TestCase {
}
- public function testfromAllUsers(){
+ public function testfromAllUsers()
+ {
$feed = new Feed();
$feed->setUrl(3);
$feed->setId(1);
@@ -322,7 +359,8 @@ class FeedApiControllerTest extends \PHPUnit_Framework_TestCase {
}
- public function testUpdate() {
+ public function testUpdate()
+ {
$feedId = 3;
$userId = 'hi';
@@ -334,7 +372,8 @@ class FeedApiControllerTest extends \PHPUnit_Framework_TestCase {
}
- public function testUpdateError() {
+ public function testUpdateError()
+ {
$feedId = 3;
$userId = 'hi';
$this->feedService->expects($this->once())
@@ -342,8 +381,10 @@ class FeedApiControllerTest extends \PHPUnit_Framework_TestCase {
->will($this->throwException(new \Exception($this->msg)));
$this->logger->expects($this->once())
->method('debug')
- ->with($this->equalTo('Could not update feed ' . $this->msg),
- $this->equalTo($this->loggerParams));
+ ->with(
+ $this->equalTo('Could not update feed ' . $this->msg),
+ $this->equalTo($this->loggerParams)
+ );
$this->feedAPI->update($userId, $feedId);
diff --git a/tests/Unit/Controller/FeedControllerTest.php b/tests/Unit/Controller/FeedControllerTest.php
index 4018e2174..8bff9b2eb 100644
--- a/tests/Unit/Controller/FeedControllerTest.php
+++ b/tests/Unit/Controller/FeedControllerTest.php
@@ -5,10 +5,10 @@
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
- * @author Alessandro Cosentino <cosenal@gmail.com>
- * @author Bernhard Posselt <dev@bernhard-posselt.com>
- * @copyright Alessandro Cosentino 2012
- * @copyright Bernhard Posselt 2012, 2014
+ * @author Alessandro Cosentino <cosenal@gmail.com>
+ * @author Bernhard Posselt <dev@bernhard-posselt.com>
+ * @copyright 2012 Alessandro Cosentino
+ * @copyright 2012-2014 Bernhard Posselt
*/
namespace OCA\News\Tests\Unit\Controller;
@@ -22,7 +22,8 @@ use OCA\News\Service\ServiceNotFoundException;
use OCA\News\Service\ServiceConflictException;
-class FeedControllerTest extends \PHPUnit_Framework_TestCase {
+class FeedControllerTest extends \PHPUnit_Framework_TestCase
+{
private $appName;
private $feedService;
@@ -38,11 +39,13 @@ class FeedControllerTest extends \PHPUnit_Framework_TestCase {
/**
* Gets run before each test
*/
- public function setUp(){
+ public function setUp()
+ {
$this->appName = 'news';
$this->user = 'jack';
$this->settings = $this->getMockBuilder(
- '\OCP\IConfig')
+ '\OCP\IConfig'
+ )
->disableOriginalConstructor()
->getMock();
$this->itemService = $this
@@ -58,15 +61,18 @@ class FeedControllerTest extends \PHPUnit_Framework_TestCase {
->disableOriginalConstructor()
->getMock();
$this->request = $this->getMockBuilder(
- '\OCP\IRequest')
+ '\OCP\IRequest'
+ )
->disableOriginalConstructor()
->getMock();
- $this->controller = new FeedController($this->appName, $this->request,
- $this->folderService,
- $this->feedService,
- $this->itemService,
- $this->settings,
- $this->user);
+ $this->controller = new FeedController(
+ $this->appName, $this->request,
+ $this->folderService,
+ $this->feedService,
+ $this->itemService,
+ $this->settings,
+ $this->user
+ );
$this->exampleResult = [
'activeFeed' => [
'id' => 0,
@@ -76,7 +82,8 @@ class FeedControllerTest extends \PHPUnit_Framework_TestCase {
}
- public function testIndex(){
+ public function testIndex()
+ {
$result = [
'feeds' => [
['a feed'],
@@ -102,7 +109,8 @@ class FeedControllerTest extends \PHPUnit_Framework_TestCase {
}
- public function testIndexHighestItemIdExists(){
+ public function testIndexHighestItemIdExists()
+ {
$result = [
'feeds' => [
['a feed'],
@@ -130,23 +138,29 @@ class FeedControllerTest extends \PHPUnit_Framework_TestCase {
- private function activeInitMocks($id, $type){
+ private function activeInitMocks($id, $type)
+ {
$this->settings->expects($this->at(0))
->method('getUserValue')
- ->with($this->equalTo($this->user),
+ ->with(
+ $this->equalTo($this->user),
$this->equalTo($this->appName),
- $this->equalTo('lastViewedFeedId'))
+ $this->equalTo('lastViewedFeedId')
+ )
->will($this->returnValue($id));
$this->settings->expects($this->at(1))
->method('getUserValue')
- ->with($this->equalTo($this->user),
+ ->with(
+ $this->equalTo($this->user),
$this->equalTo($this->appName),
- $this->equalTo('lastViewedFeedType'))
+ $this->equalTo('lastViewedFeedType')
+ )
->will($this->returnValue($type));
}
- public function testActive(){
+ public function testActive()
+ {
$id = 3;
$type = FeedType::STARRED;
$result = [
@@ -164,7 +178,8 @@ class FeedControllerTest extends \PHPUnit_Framework_TestCase {
}
- public function testActiveFeedDoesNotExist(){
+ public function testActiveFeedDoesNotExist()
+ {
$id = 3;
$type = FeedType::FEED;
$ex = new ServiceNotFoundException('hiu');
@@ -183,7 +198,8 @@ class FeedControllerTest extends \PHPUnit_Framework_TestCase {
}
- public function testActiveFolderDoesNotExist(){
+ public function testActiveFolderDoesNotExist()
+ {
$id = 3;
$type = FeedType::FOLDER;
$ex = new ServiceNotFoundException('hiu');
@@ -202,7 +218,8 @@ class FeedControllerTest extends \PHPUnit_Framework_TestCase {
}
- public function testActiveActiveIsNull(){
+ public function testActiveActiveIsNull()
+ {
$id = 3;
$type = null;
$result = $this->exampleResult;
@@ -216,7 +233,8 @@ class FeedControllerTest extends \PHPUnit_Framework_TestCase {
}
- public function testCreate(){
+ public function testCreate()
+ {
$result = [
'feeds' => [new Feed()],
'newestItemId' => 3
@@ -230,10 +248,12 @@ class FeedControllerTest extends \PHPUnit_Framework_TestCase {
->with($this->equalTo($this->user), $this->equalTo(false));
$this->feedService->expects($this->once())
->method('create')
- ->with($this->equalTo('hi'),
+ ->with(
+ $this->equalTo('hi'),
$this->equalTo(4),
$this->equalTo($this->user),
- $this->equalTo('yo'))
+ $this->equalTo('yo')
+ )
->will($this->returnValue($result['feeds'][0]));
$response = $this->controller->create('hi', 4, 'yo');
@@ -242,7 +262,8 @@ class FeedControllerTest extends \PHPUnit_Framework_TestCase {
}
- public function testCreateNoItems(){
+ public function testCreateNoItems()
+ {
$result = ['feeds' => [new Feed()]];
$this->feedService->expects($this->once())
@@ -255,10 +276,12 @@ class FeedControllerTest extends \PHPUnit_Framework_TestCase {
$this->feedService->expects($this->once())
->method('create')
- ->with($this->equalTo('hi'),
+ ->with(
+ $this->equalTo('hi'),
$this->equalTo(4),
$this->equalTo($this->user),
- $this->equalTo('yo'))
+ $this->equalTo('yo')
+ )
->will($this->returnValue($result['feeds'][0]));
$response = $this->controller->create('hi', 4, 'yo');
@@ -267,7 +290,8 @@ class FeedControllerTest extends \PHPUnit_Framework_TestCase {
}
- public function testCreateReturnsErrorForInvalidCreate(){
+ public function testCreateReturnsErrorForInvalidCreate()
+ {
$msg = 'except';
$ex = new ServiceNotFoundException($msg);
$this->feedService->expects($this->once())
@@ -287,7 +311,8 @@ class FeedControllerTest extends \PHPUnit_Framework_TestCase {
}
- public function testCreateReturnsErrorForDuplicateCreate(){
+ public function testCreateReturnsErrorForDuplicateCreate()
+ {
$msg = 'except';
$ex = new ServiceConflictException($msg);
$this->feedService->expects($this->once())
@@ -305,7 +330,8 @@ class FeedControllerTest extends \PHPUnit_Framework_TestCase {
}
- public function testDelete(){
+ public function testDelete()
+ {
$this->feedService->expects($this->once())
->method('markDeleted')
->with($this->equalTo(4));
@@ -314,7 +340,8 @@ class FeedControllerTest extends \PHPUnit_Framework_TestCase {
}
- public function testDeleteDoesNotExist(){
+ public function testDeleteDoesNotExist()
+ {
$msg = 'hehe';
$this->feedService->expects($this->once())
@@ -329,7 +356,8 @@ class FeedControllerTest extends \PHPUnit_Framework_TestCase {
}
- public function testUpdate(){
+ public function testUpdate()
+ {
$feed = new Feed();
$feed->setId(3);
$feed->setUnreadCount(44);
@@ -353,7 +381,8 @@ class FeedControllerTest extends \PHPUnit_Framework_TestCase {
}
- public function testUpdateReturnsJSONError(){
+ public function testUpdateReturnsJSONError()
+ {
$this->feedService->expects($this->once())
->method('update')
->with($this->equalTo(4), $this->equalTo($this->user))
@@ -367,7 +396,8 @@ class F