aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/AppFramework
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/AppFramework')
-rw-r--r--tests/lib/AppFramework/AppTest.php2
-rw-r--r--tests/lib/AppFramework/Controller/ApiControllerTest.php4
-rw-r--r--tests/lib/AppFramework/Controller/ControllerTest.php3
-rw-r--r--tests/lib/AppFramework/Controller/OCSControllerTest.php3
-rw-r--r--tests/lib/AppFramework/Controller/PublicShareControllerTest.php1
-rw-r--r--tests/lib/AppFramework/Db/EntityTest.php1
-rw-r--r--tests/lib/AppFramework/Db/MapperTest.php24
-rw-r--r--tests/lib/AppFramework/Db/MapperTestUtility.php20
-rw-r--r--tests/lib/AppFramework/Db/QBMapperTest.php2
-rw-r--r--tests/lib/AppFramework/DependencyInjection/DIIntergrationTests.php9
-rw-r--r--tests/lib/AppFramework/Http/DataResponseTest.php2
-rw-r--r--tests/lib/AppFramework/Http/DispatcherTest.php11
-rw-r--r--tests/lib/AppFramework/Http/DownloadResponseTest.php3
-rw-r--r--tests/lib/AppFramework/Http/HttpTest.php2
-rw-r--r--tests/lib/AppFramework/Http/JSONResponseTest.php1
-rw-r--r--tests/lib/AppFramework/Http/OCSResponseTest.php5
-rw-r--r--tests/lib/AppFramework/Http/PublicTemplateResponseTest.php2
-rw-r--r--tests/lib/AppFramework/Http/RedirectResponseTest.php2
-rw-r--r--tests/lib/AppFramework/Http/RequestStream.php22
-rw-r--r--tests/lib/AppFramework/Http/RequestTest.php4
-rw-r--r--tests/lib/AppFramework/Http/ResponseTest.php1
-rw-r--r--tests/lib/AppFramework/Http/StreamResponseTest.php1
-rw-r--r--tests/lib/AppFramework/Http/TemplateResponseTest.php1
-rw-r--r--tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php3
-rw-r--r--tests/lib/AppFramework/Middleware/MiddlewareTest.php5
-rw-r--r--tests/lib/AppFramework/Middleware/OCSMiddlewareTest.php1
-rw-r--r--tests/lib/AppFramework/Middleware/PublicShare/PublicShareMiddlewareTest.php2
-rw-r--r--tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php1
-rw-r--r--tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php5
-rw-r--r--tests/lib/AppFramework/Middleware/SessionMiddlewareTest.php1
-rw-r--r--tests/lib/AppFramework/OCS/BaseResponseTest.php2
-rw-r--r--tests/lib/AppFramework/Routing/RoutingTest.php55
-rw-r--r--tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php30
-rw-r--r--tests/lib/AppFramework/Utility/SimpleContainerTest.php12
34 files changed, 97 insertions, 146 deletions
diff --git a/tests/lib/AppFramework/AppTest.php b/tests/lib/AppFramework/AppTest.php
index 6b4cd656a89..595a556a9a8 100644
--- a/tests/lib/AppFramework/AppTest.php
+++ b/tests/lib/AppFramework/AppTest.php
@@ -43,7 +43,6 @@ function rrmdir($directory) {
class AppTest extends \Test\TestCase {
-
private $container;
private $io;
private $api;
@@ -231,5 +230,4 @@ class AppTest extends \Test\TestCase {
App::main('Foo', $this->controllerMethod, $this->container);
}
-
}
diff --git a/tests/lib/AppFramework/Controller/ApiControllerTest.php b/tests/lib/AppFramework/Controller/ApiControllerTest.php
index ccc44b97764..71eb97b94da 100644
--- a/tests/lib/AppFramework/Controller/ApiControllerTest.php
+++ b/tests/lib/AppFramework/Controller/ApiControllerTest.php
@@ -27,7 +27,8 @@ use OC\AppFramework\Http\Request;
use OCP\AppFramework\ApiController;
use OCP\IConfig;
-class ChildApiController extends ApiController {};
+class ChildApiController extends ApiController {
+};
class ApiControllerTest extends \Test\TestCase {
@@ -57,5 +58,4 @@ class ApiControllerTest extends \Test\TestCase {
$this->assertEquals('false', $headers['Access-Control-Allow-Credentials']);
$this->assertEquals(100, $headers['Access-Control-Max-Age']);
}
-
}
diff --git a/tests/lib/AppFramework/Controller/ControllerTest.php b/tests/lib/AppFramework/Controller/ControllerTest.php
index f15d178df28..e07089e0c82 100644
--- a/tests/lib/AppFramework/Controller/ControllerTest.php
+++ b/tests/lib/AppFramework/Controller/ControllerTest.php
@@ -30,7 +30,6 @@ use OCP\AppFramework\Http\JSONResponse;
use OCP\IConfig;
class ChildController extends Controller {
-
public function __construct($appName, $request) {
parent::__construct($appName, $request);
$this->registerResponder('tom', function ($respone) {
@@ -157,6 +156,4 @@ class ControllerTest extends \Test\TestCase {
$this->assertEquals('tom', $responder);
}
-
-
}
diff --git a/tests/lib/AppFramework/Controller/OCSControllerTest.php b/tests/lib/AppFramework/Controller/OCSControllerTest.php
index 85f2a7f6463..91a61047871 100644
--- a/tests/lib/AppFramework/Controller/OCSControllerTest.php
+++ b/tests/lib/AppFramework/Controller/OCSControllerTest.php
@@ -30,7 +30,8 @@ use OCP\AppFramework\OCSController;
use OCP\IConfig;
use OCP\Security\ISecureRandom;
-class ChildOCSController extends OCSController {}
+class ChildOCSController extends OCSController {
+}
class OCSControllerTest extends \Test\TestCase {
diff --git a/tests/lib/AppFramework/Controller/PublicShareControllerTest.php b/tests/lib/AppFramework/Controller/PublicShareControllerTest.php
index 388d5fbeef2..521c45e47c6 100644
--- a/tests/lib/AppFramework/Controller/PublicShareControllerTest.php
+++ b/tests/lib/AppFramework/Controller/PublicShareControllerTest.php
@@ -89,5 +89,4 @@ class PublicShareControllerTest extends \Test\TestCase {
$this->assertEquals($expected, $this->controller->isAuthenticated());
}
-
}
diff --git a/tests/lib/AppFramework/Db/EntityTest.php b/tests/lib/AppFramework/Db/EntityTest.php
index faff2649bc6..73138749a33 100644
--- a/tests/lib/AppFramework/Db/EntityTest.php
+++ b/tests/lib/AppFramework/Db/EntityTest.php
@@ -62,7 +62,6 @@ class TestEntity extends Entity {
class EntityTest extends \Test\TestCase {
-
private $entity;
protected function setUp(): void {
diff --git a/tests/lib/AppFramework/Db/MapperTest.php b/tests/lib/AppFramework/Db/MapperTest.php
index 4509b1b80c7..e5a4b63b7a3 100644
--- a/tests/lib/AppFramework/Db/MapperTest.php
+++ b/tests/lib/AppFramework/Db/MapperTest.php
@@ -44,12 +44,24 @@ class Example extends Entity {
class ExampleMapper extends Mapper {
- public function __construct(IDBConnection $db) { parent::__construct($db, 'table'); }
- public function find($table, $id) { return $this->findOneQuery($table, $id); }
- public function findOneEntity($table, $id) { return $this->findEntity($table, $id); }
- public function findAllEntities($table) { return $this->findEntities($table); }
- public function mapRow($row) { return $this->mapRowToEntity($row); }
- public function execSql($sql, $params) { return $this->execute($sql, $params); }
+ public function __construct(IDBConnection $db) {
+ parent::__construct($db, 'table');
+ }
+ public function find($table, $id) {
+ return $this->findOneQuery($table, $id);
+ }
+ public function findOneEntity($table, $id) {
+ return $this->findEntity($table, $id);
+ }
+ public function findAllEntities($table) {
+ return $this->findEntities($table);
+ }
+ public function mapRow($row) {
+ return $this->mapRowToEntity($row);
+ }
+ public function execSql($sql, $params) {
+ return $this->execute($sql, $params);
+ }
}
diff --git a/tests/lib/AppFramework/Db/MapperTestUtility.php b/tests/lib/AppFramework/Db/MapperTestUtility.php
index 9ee83e5a161..1224e6d24ed 100644
--- a/tests/lib/AppFramework/Db/MapperTestUtility.php
+++ b/tests/lib/AppFramework/Db/MapperTestUtility.php
@@ -90,24 +90,24 @@ abstract class MapperTestUtility extends \Test\TestCase {
*/
protected function setMapperResult($sql, $arguments=[], $returnRows=[],
$limit=null, $offset=null, $expectClose=false) {
- if($limit === null && $offset === null) {
+ if ($limit === null && $offset === null) {
$this->db->expects($this->at($this->prepareAt))
->method('prepare')
->with($this->equalTo($sql))
->will(($this->returnValue($this->query)));
- } elseif($limit !== null && $offset === null) {
+ } elseif ($limit !== null && $offset === null) {
$this->db->expects($this->at($this->prepareAt))
->method('prepare')
->with($this->equalTo($sql), $this->equalTo($limit))
->will(($this->returnValue($this->query)));
- } elseif($limit === null && $offset !== null) {
+ } elseif ($limit === null && $offset !== null) {
$this->db->expects($this->at($this->prepareAt))
->method('prepare')
->with($this->equalTo($sql),
$this->equalTo(null),
$this->equalTo($offset))
->will(($this->returnValue($this->query)));
- } else {
+ } else {
$this->db->expects($this->at($this->prepareAt))
->method('prepare')
->with($this->equalTo($sql),
@@ -128,7 +128,7 @@ abstract class MapperTestUtility extends \Test\TestCase {
$iterator = $iterators[$fetchAt];
$result = $iterator->next();
- if($result === false) {
+ if ($result === false) {
$fetchAt++;
}
@@ -139,7 +139,7 @@ abstract class MapperTestUtility extends \Test\TestCase {
);
if ($this->isAssocArray($arguments)) {
- foreach($arguments as $key => $argument) {
+ foreach ($arguments as $key => $argument) {
$pdoConstant = $this->getPDOType($argument);
$this->query->expects($this->at($this->queryAt))
->method('bindValue')
@@ -150,7 +150,7 @@ abstract class MapperTestUtility extends \Test\TestCase {
}
} else {
$index = 1;
- foreach($arguments as $argument) {
+ foreach ($arguments as $argument) {
$pdoConstant = $this->getPDOType($argument);
$this->query->expects($this->at($this->queryAt))
->method('bindValue')
@@ -165,7 +165,6 @@ abstract class MapperTestUtility extends \Test\TestCase {
$this->query->expects($this->at($this->queryAt))
->method('execute')
->willReturnCallback(function ($sql, $p=null, $o=null, $s=null) {
-
});
$this->queryAt++;
@@ -182,13 +181,10 @@ abstract class MapperTestUtility extends \Test\TestCase {
$this->prepareAt++;
$this->fetchAt++;
}
-
-
}
class ArgumentIterator {
-
private $arguments;
public function __construct($arguments) {
@@ -197,7 +193,7 @@ class ArgumentIterator {
public function next() {
$result = array_shift($this->arguments);
- if($result === null){
+ if ($result === null) {
return false;
} else {
return $result;
diff --git a/tests/lib/AppFramework/Db/QBMapperTest.php b/tests/lib/AppFramework/Db/QBMapperTest.php
index 6fa0fe10d88..7865979ef41 100644
--- a/tests/lib/AppFramework/Db/QBMapperTest.php
+++ b/tests/lib/AppFramework/Db/QBMapperTest.php
@@ -42,7 +42,6 @@ use OCP\IDBConnection;
* @method void setIntegerProp(integer $integerProp)
*/
class QBTestEntity extends Entity {
-
protected $intProp;
protected $boolProp;
protected $stringProp;
@@ -106,7 +105,6 @@ class QBMapperTest extends \Test\TestCase {
* @throws \ReflectionException
*/
protected function setUp(): void {
-
$this->db = $this->getMockBuilder(IDBConnection::class)
->disableOriginalConstructor()
->getMock();
diff --git a/tests/lib/AppFramework/DependencyInjection/DIIntergrationTests.php b/tests/lib/AppFramework/DependencyInjection/DIIntergrationTests.php
index 669063f4d18..78a1d40bea6 100644
--- a/tests/lib/AppFramework/DependencyInjection/DIIntergrationTests.php
+++ b/tests/lib/AppFramework/DependencyInjection/DIIntergrationTests.php
@@ -28,11 +28,14 @@ use OC\AppFramework\Utility\SimpleContainer;
use OC\ServerContainer;
use Test\TestCase;
-interface Interface1 {}
+interface Interface1 {
+}
-class ClassA1 implements Interface1 {}
+class ClassA1 implements Interface1 {
+}
-class ClassA2 implements Interface1 {}
+class ClassA2 implements Interface1 {
+}
class ClassB {
/** @var Interface1 */
diff --git a/tests/lib/AppFramework/Http/DataResponseTest.php b/tests/lib/AppFramework/Http/DataResponseTest.php
index cd7b64a1caa..e7624c92d7e 100644
--- a/tests/lib/AppFramework/Http/DataResponseTest.php
+++ b/tests/lib/AppFramework/Http/DataResponseTest.php
@@ -84,6 +84,4 @@ class DataResponseTest extends \Test\TestCase {
$this->assertEquals(Http::STATUS_NOT_FOUND, $this->response->getStatus());
$this->assertEquals(['hi', 'yo'], $this->response->getData());
}
-
-
}
diff --git a/tests/lib/AppFramework/Http/DispatcherTest.php b/tests/lib/AppFramework/Http/DispatcherTest.php
index bb6f68c40bb..74dbf68c28a 100644
--- a/tests/lib/AppFramework/Http/DispatcherTest.php
+++ b/tests/lib/AppFramework/Http/DispatcherTest.php
@@ -70,7 +70,6 @@ class TestController extends Controller {
'text' => [$int, $bool, $test, $test2]
]);
}
-
}
@@ -142,15 +141,14 @@ class DispatcherTest extends \Test\TestCase {
private function setMiddlewareExpectations($out=null,
$httpHeaders=null, $responseHeaders=[],
$ex=false, $catchEx=true) {
-
- if($ex) {
+ if ($ex) {
$exception = new \Exception();
$this->middlewareDispatcher->expects($this->once())
->method('beforeController')
->with($this->equalTo($this->controller),
$this->equalTo($this->controllerMethod))
->will($this->throwException($exception));
- if($catchEx) {
+ if ($catchEx) {
$this->middlewareDispatcher->expects($this->once())
->method('afterException')
->with($this->equalTo($this->controller),
@@ -272,7 +270,6 @@ class DispatcherTest extends \Test\TestCase {
$this->controller,
$this->controllerMethod
);
-
}
@@ -488,8 +485,4 @@ class DispatcherTest extends \Test\TestCase {
$this->assertEquals('{"text":[3,true,4,1]}', $response[3]);
}
-
-
-
-
}
diff --git a/tests/lib/AppFramework/Http/DownloadResponseTest.php b/tests/lib/AppFramework/Http/DownloadResponseTest.php
index b3437a351f9..1ad53f5db13 100644
--- a/tests/lib/AppFramework/Http/DownloadResponseTest.php
+++ b/tests/lib/AppFramework/Http/DownloadResponseTest.php
@@ -26,7 +26,6 @@ namespace Test\AppFramework\Http;
use OCP\AppFramework\Http\DownloadResponse;
class ChildDownloadResponse extends DownloadResponse {
-
};
@@ -49,6 +48,4 @@ class DownloadResponseTest extends \Test\TestCase {
$this->assertContains('attachment; filename="file"', $headers['Content-Disposition']);
$this->assertContains('content', $headers['Content-Type']);
}
-
-
}
diff --git a/tests/lib/AppFramework/Http/HttpTest.php b/tests/lib/AppFramework/Http/HttpTest.php
index 14097a2a581..009bb39260d 100644
--- a/tests/lib/AppFramework/Http/HttpTest.php
+++ b/tests/lib/AppFramework/Http/HttpTest.php
@@ -26,7 +26,6 @@ namespace Test\AppFramework\Http;
use OC\AppFramework\Http;
class HttpTest extends \Test\TestCase {
-
private $server;
/**
@@ -93,5 +92,4 @@ class HttpTest extends \Test\TestCase {
$this->assertEquals('HTTP/1.0 302 Found', $header);
}
// TODO: write unittests for http codes
-
}
diff --git a/tests/lib/AppFramework/Http/JSONResponseTest.php b/tests/lib/AppFramework/Http/JSONResponseTest.php
index 56e6d43096d..504876b2d88 100644
--- a/tests/lib/AppFramework/Http/JSONResponseTest.php
+++ b/tests/lib/AppFramework/Http/JSONResponseTest.php
@@ -116,5 +116,4 @@ class JSONResponseTest extends \Test\TestCase {
$this->assertEquals(Http::STATUS_NOT_FOUND, $this->json->getStatus());
$this->assertEquals(['hi', 'yo'], $this->json->getData());
}
-
}
diff --git a/tests/lib/AppFramework/Http/OCSResponseTest.php b/tests/lib/AppFramework/Http/OCSResponseTest.php
index ec1b422ddd9..e33f1399b84 100644
--- a/tests/lib/AppFramework/Http/OCSResponseTest.php
+++ b/tests/lib/AppFramework/Http/OCSResponseTest.php
@@ -26,8 +26,6 @@ namespace Test\AppFramework\Http;
use OCP\AppFramework\Http\OCSResponse;
class OCSResponseTest extends \Test\TestCase {
-
-
public function testHeadersJSON() {
$response = new OCSResponse('json', 1, 2, 3);
$type = $response->getHeaders()['Content-Type'];
@@ -62,8 +60,5 @@ class OCSResponseTest extends \Test\TestCase {
"</ocs>\n";
$this->assertEquals($expected, $out);
-
}
-
-
}
diff --git a/tests/lib/AppFramework/Http/PublicTemplateResponseTest.php b/tests/lib/AppFramework/Http/PublicTemplateResponseTest.php
index 90fb8cceca1..cbf8f8303c3 100644
--- a/tests/lib/AppFramework/Http/PublicTemplateResponseTest.php
+++ b/tests/lib/AppFramework/Http/PublicTemplateResponseTest.php
@@ -29,7 +29,6 @@ use OCP\AppFramework\Http\Template\PublicTemplateResponse;
use Test\TestCase;
class PublicTemplateResponseTest extends TestCase {
-
public function testSetParamsConstructor() {
$template = new PublicTemplateResponse('app', 'home', ['key' => 'value']);
$this->assertContains('core/js/public/publicpage', \OC_Util::$scripts);
@@ -79,5 +78,4 @@ class PublicTemplateResponseTest extends TestCase {
$this->assertEquals(['key' => 'value'], $template->getParams());
$this->assertEquals('public', $template->getRenderAs());
}
-
}
diff --git a/tests/lib/AppFramework/Http/RedirectResponseTest.php b/tests/lib/AppFramework/Http/RedirectResponseTest.php
index 3c210092ca8..5130d36937f 100644
--- a/tests/lib/AppFramework/Http/RedirectResponseTest.php
+++ b/tests/lib/AppFramework/Http/RedirectResponseTest.php
@@ -50,6 +50,4 @@ class RedirectResponseTest extends \Test\TestCase {
public function testGetRedirectUrl() {
$this->assertEquals('/url', $this->response->getRedirectUrl());
}
-
-
}
diff --git a/tests/lib/AppFramework/Http/RequestStream.php b/tests/lib/AppFramework/Http/RequestStream.php
index 97951ea4b9f..1dcfbce46d1 100644
--- a/tests/lib/AppFramework/Http/RequestStream.php
+++ b/tests/lib/AppFramework/Http/RequestStream.php
@@ -44,28 +44,28 @@ class RequestStream {
switch ($whence) {
case SEEK_SET:
if ($offset < strlen($GLOBALS[$this->varname]) && $offset >= 0) {
- $this->position = $offset;
- return true;
+ $this->position = $offset;
+ return true;
} else {
- return false;
+ return false;
}
break;
case SEEK_CUR:
if ($offset >= 0) {
- $this->position += $offset;
- return true;
+ $this->position += $offset;
+ return true;
} else {
- return false;
+ return false;
}
break;
case SEEK_END:
if (strlen($GLOBALS[$this->varname]) + $offset >= 0) {
- $this->position = strlen($GLOBALS[$this->varname]) + $offset;
- return true;
+ $this->position = strlen($GLOBALS[$this->varname]) + $offset;
+ return true;
} else {
- return false;
+ return false;
}
break;
@@ -97,10 +97,10 @@ class RequestStream {
}
function stream_metadata($path, $option, $var) {
- if($option == STREAM_META_TOUCH) {
+ if ($option == STREAM_META_TOUCH) {
$url = parse_url($path);
$varname = $url["host"];
- if(!isset($GLOBALS[$varname])) {
+ if (!isset($GLOBALS[$varname])) {
$GLOBALS[$varname] = '';
}
return true;
diff --git a/tests/lib/AppFramework/Http/RequestTest.php b/tests/lib/AppFramework/Http/RequestTest.php
index 819eb666d7b..2004bd2e6b5 100644
--- a/tests/lib/AppFramework/Http/RequestTest.php
+++ b/tests/lib/AppFramework/Http/RequestTest.php
@@ -77,7 +77,6 @@ class RequestTest extends \Test\TestCase {
$this->assertSame('Joey', $request->get['nickname']);
// Always returns null if variable not set.
$this->assertSame(null, $request->{'flickname'});
-
}
// urlParams has precedence over POST which has precedence over GET
@@ -326,11 +325,10 @@ class RequestTest extends \Test\TestCase {
try {
$resource = $request->put;
- } catch(\LogicException $e) {
+ } catch (\LogicException $e) {
return;
}
$this->fail('Expected LogicException.');
-
}
diff --git a/tests/lib/AppFramework/Http/ResponseTest.php b/tests/lib/AppFramework/Http/ResponseTest.php
index 7ff12b7fa67..3978326d130 100644
--- a/tests/lib/AppFramework/Http/ResponseTest.php
+++ b/tests/lib/AppFramework/Http/ResponseTest.php
@@ -269,7 +269,6 @@ class ResponseTest extends \Test\TestCase {
$this->assertEquals('Thu, 01 Jan 1970 00:00:01 +0000', $headers['Last-Modified']);
$this->assertEquals('max-age=33, must-revalidate',
$headers['Cache-Control']);
-
}
public function testThrottle() {
diff --git a/tests/lib/AppFramework/Http/StreamResponseTest.php b/tests/lib/AppFramework/Http/StreamResponseTest.php
index fb4eb5dc91c..97aced01506 100644
--- a/tests/lib/AppFramework/Http/StreamResponseTest.php
+++ b/tests/lib/AppFramework/Http/StreamResponseTest.php
@@ -95,5 +95,4 @@ class StreamResponseTest extends \Test\TestCase {
$response->callback($this->output);
}
-
}
diff --git a/tests/lib/AppFramework/Http/TemplateResponseTest.php b/tests/lib/AppFramework/Http/TemplateResponseTest.php
index 0faa78998cb..6cbf112494e 100644
--- a/tests/lib/AppFramework/Http/TemplateResponseTest.php
+++ b/tests/lib/AppFramework/Http/TemplateResponseTest.php
@@ -82,5 +82,4 @@ class TemplateResponseTest extends \Test\TestCase {
$this->assertEquals(Http::STATUS_NOT_FOUND, $this->tpl->getStatus());
$this->assertEquals(['hi' => 'yo'], $this->tpl->getParams());
}
-
}
diff --git a/tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php b/tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php
index 5f0517016dd..25cfa32dc7c 100644
--- a/tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php
+++ b/tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php
@@ -65,7 +65,7 @@ class TestMiddleware extends Middleware {
$this->beforeControllerOrder = self::$beforeControllerCalled;
$this->controller = $controller;
$this->methodName = $methodName;
- if($this->beforeControllerThrowsEx){
+ if ($this->beforeControllerThrowsEx) {
throw new \Exception();
}
}
@@ -100,7 +100,6 @@ class TestMiddleware extends Middleware {
class MiddlewareDispatcherTest extends \Test\TestCase {
-
public $exception;
public $response;
private $out;
diff --git a/tests/lib/AppFramework/Middleware/MiddlewareTest.php b/tests/lib/AppFramework/Middleware/MiddlewareTest.php
index 4ac6fa647f7..42e38bbd999 100644
--- a/tests/lib/AppFramework/Middleware/MiddlewareTest.php
+++ b/tests/lib/AppFramework/Middleware/MiddlewareTest.php
@@ -28,7 +28,8 @@ use OCP\AppFramework\Http\Response;
use OCP\AppFramework\Middleware;
use OCP\IConfig;
-class ChildMiddleware extends Middleware {};
+class ChildMiddleware extends Middleware {
+};
class MiddlewareTest extends \Test\TestCase {
@@ -91,6 +92,4 @@ class MiddlewareTest extends \Test\TestCase {
$this->assertEquals('test', $output);
}
-
-
}
diff --git a/tests/lib/AppFramework/Middleware/OCSMiddlewareTest.php b/tests/lib/AppFramework/Middleware/OCSMiddlewareTest.php
index e001e48acd2..834cd39185c 100644
--- a/tests/lib/AppFramework/Middleware/OCSMiddlewareTest.php
+++ b/tests/lib/AppFramework/Middleware/OCSMiddlewareTest.php
@@ -238,5 +238,4 @@ class OCSMiddlewareTest extends \Test\TestCase {
$this->assertSame(Http::STATUS_UNAUTHORIZED, $newResponse->getStatus());
}
}
-
}
diff --git a/tests/lib/AppFramework/Middleware/PublicShare/PublicShareMiddlewareTest.php b/tests/lib/AppFramework/Middleware/PublicShare/PublicShareMiddlewareTest.php
index 82f354d127d..ed6d06d4bf5 100644
--- a/tests/lib/AppFramework/Middleware/PublicShare/PublicShareMiddlewareTest.php
+++ b/tests/lib/AppFramework/Middleware/PublicShare/PublicShareMiddlewareTest.php
@@ -282,6 +282,4 @@ class PublicShareMiddlewareTest extends \Test\TestCase {
$result = $this->middleware->afterException($controller, 'method', $exception);
$this->assertInstanceOf(RedirectResponse::class, $result);
}
-
-
}
diff --git a/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php
index 691553a13d8..a7bf2b14271 100644
--- a/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php
+++ b/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php
@@ -270,5 +270,4 @@ class CORSMiddlewareTest extends \Test\TestCase {
$middleware = new CORSMiddleware($request, $this->reflector, $this->session, $this->throttler);
$middleware->afterException($this->controller, __FUNCTION__, new \Exception('A regular exception'));
}
-
}
diff --git a/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php
index 422087241f6..306ee9f841c 100644
--- a/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php
+++ b/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php
@@ -86,7 +86,6 @@ class SecurityMiddlewareTest extends \Test\TestCase {
}
private function getMiddleware(bool $isLoggedIn, bool $isAdminUser, bool $isSubAdmin, bool $isAppEnabledForUser = true): SecurityMiddleware {
-
$this->appManager = $this->createMock(IAppManager::class);
$this->appManager->expects($this->any())
->method('isEnabledForUser')
@@ -140,7 +139,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
try {
$this->reader->reflect(__CLASS__, $method);
$sec->beforeController($this->controller, $method);
- } catch (SecurityException $ex){
+ } catch (SecurityException $ex) {
$this->assertEquals($status, $ex->getCode());
}
@@ -236,7 +235,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
$sec = $this->getMiddleware($isLoggedIn, $isAdminUser, false);
- if($shouldFail) {
+ if ($shouldFail) {
$this->expectException(SecurityException::class);
} else {
$this->addToAssertionCount(1);
diff --git a/tests/lib/AppFramework/Middleware/SessionMiddlewareTest.php b/tests/lib/AppFramework/Middleware/SessionMiddlewareTest.php
index 940112311c3..f9739044465 100644
--- a/tests/lib/AppFramework/Middleware/SessionMiddlewareTest.php
+++ b/tests/lib/AppFramework/Middleware/SessionMiddlewareTest.php
@@ -81,5 +81,4 @@ class SessionMiddlewareTest extends \Test\TestCase {
->method('close');
return $session;
}
-
}
diff --git a/tests/lib/AppFramework/OCS/BaseResponseTest.php b/tests/lib/AppFramework/OCS/BaseResponseTest.php
index 18a85788af2..aca8c355f41 100644
--- a/tests/lib/AppFramework/OCS/BaseResponseTest.php
+++ b/tests/lib/AppFramework/OCS/BaseResponseTest.php
@@ -29,7 +29,6 @@ namespace Test\AppFramework\Middleware;
use OC\AppFramework\OCS\BaseResponse;
class BaseResponseTest extends \Test\TestCase {
-
public function testToXml(): void {
/** @var BaseResponse $response */
@@ -57,5 +56,4 @@ class BaseResponseTest extends \Test\TestCase {
$writer->outputMemory(true)
);
}
-
}
diff --git a/tests/lib/AppFramework/Routing/RoutingTest.php b/tests/lib/AppFramework/Routing/RoutingTest.php
index 5e0604263fc..1aef757720b 100644
--- a/tests/lib/AppFramework/Routing/RoutingTest.php
+++ b/tests/lib/AppFramework/Routing/RoutingTest.php
@@ -10,11 +10,8 @@ use OCP\ILogger;
use OCP\Route\IRouter;
use PHPUnit\Framework\MockObject\MockObject;
-class RoutingTest extends \Test\TestCase
-{
-
- public function testSimpleRoute()
- {
+class RoutingTest extends \Test\TestCase {
+ public function testSimpleRoute() {
$routes = ['routes' => [
['name' => 'folders#open', 'url' => '/folders/{folderId}/open', 'verb' => 'GET']
]];
@@ -31,8 +28,7 @@ class RoutingTest extends \Test\TestCase
$this->assertSimpleOCSRoute($routes, 'folders.open', 'GET', '/apps/app1/folders/{folderId}/open', 'FoldersController', 'open');
}
- public function testSimpleRouteWithMissingVerb()
- {
+ public function testSimpleRouteWithMissingVerb() {
$routes = ['routes' => [
['name' => 'folders#open', 'url' => '/folders/{folderId}/open']
]];
@@ -49,8 +45,7 @@ class RoutingTest extends \Test\TestCase
$this->assertSimpleOCSRoute($routes, 'folders.open', 'GET', '/apps/app1/folders/{folderId}/open', 'FoldersController', 'open');
}
- public function testSimpleRouteWithLowercaseVerb()
- {
+ public function testSimpleRouteWithLowercaseVerb() {
$routes = ['routes' => [
['name' => 'folders#open', 'url' => '/folders/{folderId}/open', 'verb' => 'delete']
]];
@@ -67,8 +62,7 @@ class RoutingTest extends \Test\TestCase
$this->assertSimpleOCSRoute($routes, 'folders.open', 'DELETE', '/apps/app1/folders/{folderId}/open', 'FoldersController', 'open');
}
- public function testSimpleRouteWithRequirements()
- {
+ public function testSimpleRouteWithRequirements() {
$routes = ['routes' => [
['name' => 'folders#open', 'url' => '/folders/{folderId}/open', 'verb' => 'delete', 'requirements' => ['something']]
]];
@@ -85,8 +79,7 @@ class RoutingTest extends \Test\TestCase
$this->assertSimpleOCSRoute($routes, 'folders.open', 'DELETE', '/apps/app1/folders/{folderId}/open', 'FoldersController', 'open', ['something']);
}
- public function testSimpleRouteWithDefaults()
- {
+ public function testSimpleRouteWithDefaults() {
$routes = ['routes' => [
['name' => 'folders#open', 'url' => '/folders/{folderId}/open', 'verb' => 'delete', [], 'defaults' => ['param' => 'foobar']]
]];
@@ -104,8 +97,7 @@ class RoutingTest extends \Test\TestCase
$this->assertSimpleOCSRoute($routes, 'folders.open', 'DELETE', '/apps/app1/folders/{folderId}/open', 'FoldersController', 'open', [], ['param' => 'foobar']);
}
- public function testSimpleRouteWithPostfix()
- {
+ public function testSimpleRouteWithPostfix() {
$routes = ['routes' => [
['name' => 'folders#open', 'url' => '/folders/{folderId}/open', 'verb' => 'delete', 'postfix' => '_something']
]];
@@ -123,8 +115,7 @@ class RoutingTest extends \Test\TestCase
}
- public function testSimpleRouteWithBrokenName()
- {
+ public function testSimpleRouteWithBrokenName() {
$this->expectException(\UnexpectedValueException::class);
$routes = ['routes' => [
@@ -165,8 +156,7 @@ class RoutingTest extends \Test\TestCase
$config->register();
}
- public function testSimpleRouteWithUnderScoreNames()
- {
+ public function testSimpleRouteWithUnderScoreNames() {
$routes = ['routes' => [
['name' => 'admin_folders#open_current', 'url' => '/folders/{folderId}/open', 'verb' => 'delete']
]];
@@ -182,36 +172,31 @@ class RoutingTest extends \Test\TestCase
$this->assertSimpleOCSRoute($routes, 'admin_folders.open_current', 'DELETE', '/apps/app1/folders/{folderId}/open', 'AdminFoldersController', 'openCurrent');
}
- public function testOCSResource()
- {
+ public function testOCSResource() {
$routes = ['ocs-resources' => ['account' => ['url' => '/accounts']]];
$this->assertOCSResource($routes, 'account', '/apps/app1/accounts', 'AccountController', 'id');
}
- public function testOCSResourceWithUnderScoreName()
- {
+ public function testOCSResourceWithUnderScoreName() {
$routes = ['ocs-resources' => ['admin_accounts' => ['url' => '/admin/accounts']]];
$this->assertOCSResource($routes, 'admin_accounts', '/apps/app1/admin/accounts', 'AdminAccountsController', 'id');
}
- public function testOCSResourceWithRoot()
- {
+ public function testOCSResourceWithRoot() {
$routes = ['ocs-resources' => ['admin_accounts' => ['url' => '/admin/accounts', 'root' => '/core/endpoint']]];
$this->assertOCSResource($routes, 'admin_accounts', '/core/endpoint/admin/accounts', 'AdminAccountsController', 'id');
}
- public function testResource()
- {
+ public function testResource() {
$routes = ['resources' => ['account' => ['url' => '/accounts']]];
$this->assertResource($routes, 'account', '/accounts', 'AccountController', 'id');
}
- public function testResourceWithUnderScoreName()
- {
+ public function testResourceWithUnderScoreName() {
$routes = ['resources' => ['admin_accounts' => ['url' => '/admin/accounts']]];
$this->assertResource($routes, 'admin_accounts', '/admin/accounts', 'AdminAccountsController', 'id');
@@ -224,8 +209,7 @@ class RoutingTest extends \Test\TestCase
* @param string $controllerName
* @param string $actionName
*/
- private function assertSimpleRoute($routes, $name, $verb, $url, $controllerName, $actionName, array $requirements=[], array $defaults=[], $postfix='')
- {
+ private function assertSimpleRoute($routes, $name, $verb, $url, $controllerName, $actionName, array $requirements=[], array $defaults=[], $postfix='') {
if ($postfix) {
$name .= $postfix;
}
@@ -272,8 +256,7 @@ class RoutingTest extends \Test\TestCase
$actionName,
array $requirements=[],
array $defaults=[],
- $postfix='')
- {
+ $postfix='') {
if ($postfix) {
$name .= $postfix;
}
@@ -368,8 +351,7 @@ class RoutingTest extends \Test\TestCase
* @param string $controllerName
* @param string $paramName
*/
- private function assertResource($yaml, $resourceName, $url, $controllerName, $paramName)
- {
+ private function assertResource($yaml, $resourceName, $url, $controllerName, $paramName) {
// router mock
$router = $this->getMockBuilder('\OC\Route\Router')
->setMethods(['create'])
@@ -456,7 +438,7 @@ class RoutingTest extends \Test\TestCase
->with($this->equalTo(new RouteActionHandler($container, $controllerName, $actionName)))
->willReturn($route);
- if(count($requirements) > 0) {
+ if (count($requirements) > 0) {
$route
->expects($this->exactly(1))
->method('requirements')
@@ -474,7 +456,6 @@ class RoutingTest extends \Test\TestCase
return $route;
}
-
}
/*
diff --git a/tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php b/tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php
index 2d20578efab..990ad44adf3 100644
--- a/tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php
+++ b/tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php
@@ -30,18 +30,20 @@ class BaseController {
/**
* @Annotation
*/
- public function test() {}
+ public function test() {
+ }
/**
* @Annotation
*/
- public function test2() {}
+ public function test2() {
+ }
/**
* @Annotation
*/
- public function test3() {}
-
+ public function test3() {
+ }
}
class MiddleController extends BaseController {
@@ -49,13 +51,15 @@ class MiddleController extends BaseController {
/**
* @NoAnnotation
*/
- public function test2() {}
-
- public function test3() {}
+ public function test2() {
+ }
+ public function test3() {
+ }
}
-class EndController extends MiddleController {}
+class EndController extends MiddleController {
+}
class ControllerMethodReflectorTest extends \Test\TestCase {
@@ -136,7 +140,8 @@ class ControllerMethodReflectorTest extends \Test\TestCase {
* @param int $a
* @param int $b
*/
- public function arguments3($a, float $b, int $c, $d) {}
+ public function arguments3($a, float $b, int $c, $d) {
+ }
/**
* @requires PHP 7
@@ -184,7 +189,8 @@ class ControllerMethodReflectorTest extends \Test\TestCase {
}
- public function arguments($arg, $arg2='hi') {}
+ public function arguments($arg, $arg2='hi') {
+ }
public function testReflectParameters() {
$reader = new ControllerMethodReflector();
$reader->reflect(
@@ -196,7 +202,8 @@ class ControllerMethodReflectorTest extends \Test\TestCase {
}
- public function arguments2($arg) {}
+ public function arguments2($arg) {
+ }
public function testReflectParameters2() {
$reader = new ControllerMethodReflector();
$reader->reflect(
@@ -231,5 +238,4 @@ class ControllerMethodReflectorTest extends \Test\TestCase {
$this->assertFalse($reader->hasAnnotation('Annotation'));
}
-
}
diff --git a/tests/lib/AppFramework/Utility/SimpleContainerTest.php b/tests/lib/AppFramework/Utility/SimpleContainerTest.php
index 52908ed8839..f8a43058305 100644
--- a/tests/lib/AppFramework/Utility/SimpleContainerTest.php
+++ b/tests/lib/AppFramework/Utility/SimpleContainerTest.php
@@ -25,9 +25,11 @@ namespace Test\AppFramework\Utility;
use OC\AppFramework\Utility\SimpleContainer;
-interface TestInterface {}
+interface TestInterface {
+}
-class ClassEmptyConstructor implements IInterfaceConstructor {}
+class ClassEmptyConstructor implements IInterfaceConstructor {
+}
class ClassSimpleConstructor implements IInterfaceConstructor {
public $test;
@@ -45,7 +47,8 @@ class ClassComplexConstructor {
}
}
-interface IInterfaceConstructor {}
+interface IInterfaceConstructor {
+}
class ClassInterfaceConstructor {
public $class;
public $test;
@@ -57,8 +60,6 @@ class ClassInterfaceConstructor {
class SimpleContainerTest extends \Test\TestCase {
-
-
private $container;
protected function setUp(): void {
@@ -218,5 +219,4 @@ class SimpleContainerTest extends \Test\TestCase {
$this->assertNotSame(
$this->container->query('test'), $this->container->query('test1'));
}
-
}