summaryrefslogtreecommitdiffstats
path: root/tests/unit/controller
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-10-21 18:19:23 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-10-21 18:19:23 +0200
commit66c73a96ac2dda076bcfe0dc0a1ca2a7e169149d (patch)
treedc0318fa459e4f313217ee38e4bc63524513d721 /tests/unit/controller
parentf5e64d35c05b14016eb4fffff7199386a97a9b43 (diff)
first try to set indention limit at 80 characters in php
Diffstat (limited to 'tests/unit/controller')
-rw-r--r--tests/unit/controller/ExportControllerTest.php5
-rw-r--r--tests/unit/controller/FeedApiControllerTest.php16
-rw-r--r--tests/unit/controller/FeedControllerTest.php21
-rw-r--r--tests/unit/controller/FolderApiControllerTest.php32
-rw-r--r--tests/unit/controller/FolderControllerTest.php14
-rw-r--r--tests/unit/controller/ItemApiControllerTest.php16
-rw-r--r--tests/unit/controller/ItemControllerTest.php2
-rw-r--r--tests/unit/controller/PageControllerTest.php8
-rw-r--r--tests/unit/controller/UtilityApiControllerTest.php5
9 files changed, 87 insertions, 32 deletions
diff --git a/tests/unit/controller/ExportControllerTest.php b/tests/unit/controller/ExportControllerTest.php
index 29760e6f4..635209041 100644
--- a/tests/unit/controller/ExportControllerTest.php
+++ b/tests/unit/controller/ExportControllerTest.php
@@ -113,7 +113,10 @@ class ExportControllerTest extends \PHPUnit_Framework_TestCase {
$return = $this->controller->articles();
$headers = $return->getHeaders();
- $this->assertEquals('attachment; filename="articles.json"', $headers ['Content-Disposition']);
+ $this->assertEquals(
+ 'attachment; filename="articles.json"',
+ $headers ['Content-Disposition']
+ );
$this->assertEquals('[{"guid":null,"url":null,"title":null,' .
'"author":null,"pubDate":null,"body":null,"enclosureMime":null,' .
diff --git a/tests/unit/controller/FeedApiControllerTest.php b/tests/unit/controller/FeedApiControllerTest.php
index d14782856..c73f49288 100644
--- a/tests/unit/controller/FeedApiControllerTest.php
+++ b/tests/unit/controller/FeedApiControllerTest.php
@@ -135,7 +135,9 @@ class FeedApiControllerTest extends \PHPUnit_Framework_TestCase {
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);
@@ -203,7 +205,9 @@ class FeedApiControllerTest extends \PHPUnit_Framework_TestCase {
->with($this->equalTo($this->user), $this->equalTo(false));
$this->feedService->expects($this->once())
->method('create')
- ->will($this->throwException(new ServiceConflictException($this->msg)));
+ ->will(
+ $this->throwException(new ServiceConflictException($this->msg))
+ );
$response = $this->feedAPI->create('ho', 3);
@@ -216,7 +220,9 @@ class FeedApiControllerTest extends \PHPUnit_Framework_TestCase {
public function testCreateError() {
$this->feedService->expects($this->once())
->method('create')
- ->will($this->throwException(new ServiceNotFoundException($this->msg)));
+ ->will(
+ $this->throwException(new ServiceNotFoundException($this->msg))
+ );
$response = $this->feedAPI->create('ho', 3);
@@ -253,7 +259,9 @@ class FeedApiControllerTest extends \PHPUnit_Framework_TestCase {
public function testMoveDoesNotExist() {
$this->feedService->expects($this->once())
->method('move')
- ->will($this->throwException(new ServiceNotFoundException($this->msg)));
+ ->will(
+ $this->throwException(new ServiceNotFoundException($this->msg))
+ );
$response = $this->feedAPI->move(3, 4);
diff --git a/tests/unit/controller/FeedControllerTest.php b/tests/unit/controller/FeedControllerTest.php
index 34b0a847b..e7f19a2b8 100644
--- a/tests/unit/controller/FeedControllerTest.php
+++ b/tests/unit/controller/FeedControllerTest.php
@@ -43,13 +43,16 @@ class FeedControllerTest extends \PHPUnit_Framework_TestCase {
'\OCP\IConfig')
->disableOriginalConstructor()
->getMock();
- $this->itemService = $this->getMockBuilder('\OCA\News\Service\ItemService')
+ $this->itemService = $this
+ ->getMockBuilder('\OCA\News\Service\ItemService')
->disableOriginalConstructor()
->getMock();
- $this->feedService = $this->getMockBuilder('\OCA\News\Service\FeedService')
+ $this->feedService = $this
+ ->getMockBuilder('\OCA\News\Service\FeedService')
->disableOriginalConstructor()
->getMock();
- $this->folderService = $this->getMockBuilder('\OCA\News\Service\FolderService')
+ $this->folderService = $this
+ ->getMockBuilder('\OCA\News\Service\FolderService')
->disableOriginalConstructor()
->getMock();
$this->request = $this->getMockBuilder(
@@ -276,7 +279,9 @@ class FeedControllerTest extends \PHPUnit_Framework_TestCase {
$params = json_decode($response->render(), true);
$this->assertEquals($msg, $params['message']);
- $this->assertEquals($response->getStatus(), Http::STATUS_UNPROCESSABLE_ENTITY);
+ $this->assertEquals(
+ $response->getStatus(), Http::STATUS_UNPROCESSABLE_ENTITY
+ );
}
@@ -427,7 +432,7 @@ class FeedControllerTest extends \PHPUnit_Framework_TestCase {
$this->feedService->expects($this->once())
->method('importArticles')
- ->with($this->equalTo(array('json')),
+ ->with($this->equalTo(['json']),
$this->equalTo($this->user))
->will($this->returnValue($feed));
@@ -436,7 +441,7 @@ class FeedControllerTest extends \PHPUnit_Framework_TestCase {
->with($this->equalTo($this->user))
->will($this->returnValue(3));
- $response = $this->controller->import(array('json'));
+ $response = $this->controller->import(['json']);
$this->assertEquals($expected, $response);
}
@@ -445,7 +450,7 @@ class FeedControllerTest extends \PHPUnit_Framework_TestCase {
public function testImportCreatesNoAdditionalFeed() {
$this->feedService->expects($this->once())
->method('importArticles')
- ->with($this->equalTo(array('json')),
+ ->with($this->equalTo(['json']),
$this->equalTo($this->user))
->will($this->returnValue(null));
@@ -454,7 +459,7 @@ class FeedControllerTest extends \PHPUnit_Framework_TestCase {
->with($this->equalTo($this->user))
->will($this->returnValue(3));
- $response = $this->controller->import(array('json'));
+ $response = $this->controller->import(['json']);
$this->assertEquals(['starred' => 3], $response);
}
diff --git a/tests/unit/controller/FolderApiControllerTest.php b/tests/unit/controller/FolderApiControllerTest.php
index c0371661a..550cd298c 100644
--- a/tests/unit/controller/FolderApiControllerTest.php
+++ b/tests/unit/controller/FolderApiControllerTest.php
@@ -130,7 +130,9 @@ class FolderApiControllerTest extends \PHPUnit_Framework_TestCase {
$data = $response->getData();
$this->assertEquals($msg, $data['message']);
- $this->assertEquals(Http::STATUS_UNPROCESSABLE_ENTITY, $response->getStatus());
+ $this->assertEquals(
+ Http::STATUS_UNPROCESSABLE_ENTITY, $response->getStatus()
+ );
}
@@ -149,7 +151,11 @@ class FolderApiControllerTest extends \PHPUnit_Framework_TestCase {
$this->folderService->expects($this->once())
->method('delete')
- ->will($this->throwException(new ServiceNotFoundException($this->msg)));
+ ->will(
+ $this->throwException(
+ new ServiceNotFoundException($this->msg)
+ )
+ );
$response = $this->folderAPI->delete($folderId);
@@ -178,7 +184,11 @@ class FolderApiControllerTest extends \PHPUnit_Framework_TestCase {
$this->folderService->expects($this->once())
->method('rename')
- ->will($this->throwException(new ServiceNotFoundException($this->msg)));
+ ->will(
+ $this->throwException(
+ new ServiceNotFoundException($this->msg)
+ )
+ );
$response = $this->folderAPI->update($folderId, $folderName);
@@ -194,7 +204,11 @@ class FolderApiControllerTest extends \PHPUnit_Framework_TestCase {
$this->folderService->expects($this->once())
->method('rename')
- ->will($this->throwException(new ServiceConflictException($this->msg)));
+ ->will(
+ $this->throwException(
+ new ServiceConflictException($this->msg)
+ )
+ );
$response = $this->folderAPI->update($folderId, $folderName);
@@ -210,13 +224,19 @@ class FolderApiControllerTest extends \PHPUnit_Framework_TestCase {
$this->folderService->expects($this->once())
->method('rename')
- ->will($this->throwException(new ServiceValidationException($this->msg)));
+ ->will(
+ $this->throwException(
+ new ServiceValidationException($this->msg)
+ )
+ );
$response = $this->folderAPI->update($folderId, $folderName);
$data = $response->getData();
$this->assertEquals($this->msg, $data['message']);
- $this->assertEquals(Http::STATUS_UNPROCESSABLE_ENTITY, $response->getStatus());
+ $this->assertEquals(
+ Http::STATUS_UNPROCESSABLE_ENTITY, $response->getStatus()
+ );
}
diff --git a/tests/unit/controller/FolderControllerTest.php b/tests/unit/controller/FolderControllerTest.php
index b06c97c79..5a5daff3d 100644
--- a/tests/unit/controller/FolderControllerTest.php
+++ b/tests/unit/controller/FolderControllerTest.php
@@ -91,7 +91,9 @@ class FolderControllerTest extends \PHPUnit_Framework_TestCase {
public function testOpenDoesNotExist(){
$this->folderService->expects($this->once())
->method('open')
- ->will($this->throwException(new ServiceNotFoundException($this->msg)));
+ ->will($this->throwException(
+ new ServiceNotFoundException($this->msg))
+ );
$response = $this->controller->open(5, true);
@@ -144,7 +146,8 @@ class FolderControllerTest extends \PHPUnit_Framework_TestCase {
$response = $this->controller->create('tech');
$params = json_decode($response->render(), true);
- $this->assertEquals($response->getStatus(), Http::STATUS_UNPROCESSABLE_ENTITY);
+ $this->assertEquals($response->getStatus(),
+ Http::STATUS_UNPROCESSABLE_ENTITY);
$this->assertEquals($msg, $params['message']);
}
@@ -217,7 +220,8 @@ class FolderControllerTest extends \PHPUnit_Framework_TestCase {
$response = $this->controller->rename('tech', 4);
$params = json_decode($response->render(), true);
- $this->assertEquals($response->getStatus(), Http::STATUS_UNPROCESSABLE_ENTITY);
+ $this->assertEquals($response->getStatus(),
+ Http::STATUS_UNPROCESSABLE_ENTITY);
$this->assertEquals($msg, $params['message']);
}
@@ -285,7 +289,9 @@ class FolderControllerTest extends \PHPUnit_Framework_TestCase {
public function testRestoreDoesNotExist(){
$this->folderService->expects($this->once())
->method('unmarkDeleted')
- ->will($this->throwException(new ServiceNotFoundException($this->msg)));
+ ->will(
+ $this->throwException(new ServiceNotFoundException($this->msg))
+ );
$response = $this->controller->restore(5);
diff --git a/tests/unit/controller/ItemApiControllerTest.php b/tests/unit/controller/ItemApiControllerTest.php
index 12b9d3225..8ab35010a 100644
--- a/tests/unit/controller/ItemApiControllerTest.php
+++ b/tests/unit/controller/ItemApiControllerTest.php
@@ -135,7 +135,9 @@ class ItemApiControllerTest extends \PHPUnit_Framework_TestCase {
public function testReadDoesNotExist() {
$this->itemService->expects($this->once())
->method('read')
- ->will($this->throwException(new ServiceNotFoundException($this->msg)));
+ ->will($this->throwException(
+ new ServiceNotFoundException($this->msg))
+ );
$response = $this->itemAPI->read(2);
@@ -161,7 +163,9 @@ class ItemApiControllerTest extends \PHPUnit_Framework_TestCase {
public function testUnreadDoesNotExist() {
$this->itemService->expects($this->once())
->method('read')
- ->will($this->throwException(new ServiceNotFoundException($this->msg)));
+ ->will($this->throwException(
+ new ServiceNotFoundException($this->msg))
+ );
$response = $this->itemAPI->unread(2);
@@ -188,7 +192,9 @@ class ItemApiControllerTest extends \PHPUnit_Framework_TestCase {
public function testStarDoesNotExist() {
$this->itemService->expects($this->once())
->method('star')
- ->will($this->throwException(new ServiceNotFoundException($this->msg)));
+ ->will($this->throwException(
+ new ServiceNotFoundException($this->msg))
+ );
$response = $this->itemAPI->star(2, 'test');
@@ -215,7 +221,9 @@ class ItemApiControllerTest extends \PHPUnit_Framework_TestCase {
public function testUnstarDoesNotExist() {
$this->itemService->expects($this->once())
->method('star')
- ->will($this->throwException(new ServiceNotFoundException($this->msg)));
+ ->will($this->throwException(
+ new ServiceNotFoundException($this->msg))
+ );
$response = $this->itemAPI->unstar(2, 'test');
diff --git a/tests/unit/controller/ItemControllerTest.php b/tests/unit/controller/ItemControllerTest.php
index fd0904ef7..88e49c690 100644
--- a/tests/unit/controller/ItemControllerTest.php
+++ b/tests/unit/controller/ItemControllerTest.php
@@ -134,7 +134,7 @@ class ItemControllerTest extends \PHPUnit_Framework_TestCase {
$this->itemService->expects($this->once())
->method('star')
- ->will($this->throwException(new ServiceNotFoundException($msg)));;
+ ->will($this->throwException(new ServiceNotFoundException($msg)));
$response = $this->controller->star(4, 'test', false);
$params = json_decode($response->render(), true);
diff --git a/tests/unit/controller/PageControllerTest.php b/tests/unit/controller/PageControllerTest.php
index 60ae8c66b..48af6860f 100644
--- a/tests/unit/controller/PageControllerTest.php
+++ b/tests/unit/controller/PageControllerTest.php
@@ -159,9 +159,13 @@ class PageControllerTest extends \PHPUnit_Framework_TestCase {
$result = $this->controller->manifest();
$this->assertEquals($this->configData['name'], $result['name']);
$this->assertEquals('web', $result['type']);
- $this->assertEquals($this->configData['description'], $result['description']);
+ $this->assertEquals(
+ $this->configData['description'], $result['description']
+ );
$this->assertEquals('de-DE', $result['default_locale']);
- $this->assertEquals($this->configData['homepage'], $result['developer']['url']);
+ $this->assertEquals(
+ $this->configData['homepage'], $result['developer']['url']
+ );
$this->assertEquals('john, test', $result['developer']['name']);
}
diff --git a/tests/unit/controller/UtilityApiControllerTest.php b/tests/unit/controller/UtilityApiControllerTest.php
index efff559d8..f4219fddf 100644
--- a/tests/unit/controller/UtilityApiControllerTest.php
+++ b/tests/unit/controller/UtilityApiControllerTest.php
@@ -36,8 +36,9 @@ class UtilityApiControllerTest extends \PHPUnit_Framework_TestCase {
'\OCA\News\Utility\Updater')
->disableOriginalConstructor()
->getMock();
- $this->newsAPI = new UtilityApiController($this->appName, $this->request,
- $this->updater, $this->settings);
+ $this->newsAPI = new UtilityApiController(
+ $this->appName, $this->request, $this->updater, $this->settings
+ );
}