summaryrefslogtreecommitdiffstats
path: root/tests/lib/AppFramework
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/AppFramework')
-rw-r--r--tests/lib/AppFramework/AppTest.php6
-rw-r--r--tests/lib/AppFramework/Controller/AuthPublicShareControllerTest.php2
-rw-r--r--tests/lib/AppFramework/Db/EntityTest.php30
-rw-r--r--tests/lib/AppFramework/Db/MapperTest.php46
-rw-r--r--tests/lib/AppFramework/Db/MapperTestUtility.php10
-rw-r--r--tests/lib/AppFramework/DependencyInjection/DIContainerTest.php10
-rw-r--r--tests/lib/AppFramework/Http/DispatcherTest.php8
-rw-r--r--tests/lib/AppFramework/Http/RedirectResponseTest.php2
-rw-r--r--tests/lib/AppFramework/Http/RequestTest.php24
-rw-r--r--tests/lib/AppFramework/Http/ResponseTest.php8
-rw-r--r--tests/lib/AppFramework/Http/StreamResponseTest.php8
-rw-r--r--tests/lib/AppFramework/Http/TemplateResponseTest.php10
-rw-r--r--tests/lib/AppFramework/Middleware/AdditionalScriptsMiddlewareTest.php6
-rw-r--r--tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php34
-rw-r--r--tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php32
-rw-r--r--tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php20
-rw-r--r--tests/lib/AppFramework/Utility/SimpleContainerTest.php8
17 files changed, 132 insertions, 132 deletions
diff --git a/tests/lib/AppFramework/AppTest.php b/tests/lib/AppFramework/AppTest.php
index bf856b3b89f..6b4cd656a89 100644
--- a/tests/lib/AppFramework/AppTest.php
+++ b/tests/lib/AppFramework/AppTest.php
@@ -87,7 +87,7 @@ class AppTest extends \Test\TestCase {
}
- public function testControllerNameAndMethodAreBeingPassed(){
+ public function testControllerNameAndMethodAreBeingPassed() {
$return = ['HTTP/2.0 200 OK', [], [], null, new Response()];
$this->dispatcher->expects($this->once())
->method('dispatch')
@@ -127,7 +127,7 @@ class AppTest extends \Test\TestCase {
}
- public function testOutputIsPrinted(){
+ public function testOutputIsPrinted() {
$return = ['HTTP/2.0 200 OK', [], [], $this->output, new Response()];
$this->dispatcher->expects($this->once())
->method('dispatch')
@@ -166,7 +166,7 @@ class AppTest extends \Test\TestCase {
}
- public function testCallbackIsCalled(){
+ public function testCallbackIsCalled() {
$mock = $this->getMockBuilder('OCP\AppFramework\Http\ICallbackResponse')
->getMock();
diff --git a/tests/lib/AppFramework/Controller/AuthPublicShareControllerTest.php b/tests/lib/AppFramework/Controller/AuthPublicShareControllerTest.php
index 8259ec930fd..4c79adcb4a7 100644
--- a/tests/lib/AppFramework/Controller/AuthPublicShareControllerTest.php
+++ b/tests/lib/AppFramework/Controller/AuthPublicShareControllerTest.php
@@ -129,7 +129,7 @@ class AuthPublicShareControllerTest extends \Test\TestCase {
$hashSet = false;
$this->session
->method('set')
- ->willReturnCallback(function($key, $value) use (&$tokenSet, &$hashSet) {
+ ->willReturnCallback(function ($key, $value) use (&$tokenSet, &$hashSet) {
if ($key === 'public_link_authenticated_token' && $value === 'token') {
$tokenSet = true;
return true;
diff --git a/tests/lib/AppFramework/Db/EntityTest.php b/tests/lib/AppFramework/Db/EntityTest.php
index b2113789810..faff2649bc6 100644
--- a/tests/lib/AppFramework/Db/EntityTest.php
+++ b/tests/lib/AppFramework/Db/EntityTest.php
@@ -71,7 +71,7 @@ class EntityTest extends \Test\TestCase {
}
- public function testResetUpdatedFields(){
+ public function testResetUpdatedFields() {
$entity = new TestEntity();
$entity->setId(3);
$entity->resetUpdatedFields();
@@ -80,7 +80,7 @@ class EntityTest extends \Test\TestCase {
}
- public function testFromRow(){
+ public function testFromRow() {
$row = [
'pre_name' => 'john',
'email' => 'john@something.com'
@@ -92,7 +92,7 @@ class EntityTest extends \Test\TestCase {
}
- public function testGetSetId(){
+ public function testGetSetId() {
$id = 3;
$this->entity->setId(3);
@@ -100,28 +100,28 @@ class EntityTest extends \Test\TestCase {
}
- public function testColumnToPropertyNoReplacement(){
+ public function testColumnToPropertyNoReplacement() {
$column = 'my';
$this->assertEquals('my',
$this->entity->columnToProperty($column));
}
- public function testColumnToProperty(){
+ public function testColumnToProperty() {
$column = 'my_attribute';
$this->assertEquals('myAttribute',
$this->entity->columnToProperty($column));
}
- public function testPropertyToColumnNoReplacement(){
+ public function testPropertyToColumnNoReplacement() {
$property = 'my';
$this->assertEquals('my',
$this->entity->propertyToColumn($property));
}
- public function testSetterMarksFieldUpdated(){
+ public function testSetterMarksFieldUpdated() {
$this->entity->setId(3);
$this->assertContains('id', $this->entity->getUpdatedFields());
@@ -129,7 +129,7 @@ class EntityTest extends \Test\TestCase {
- public function testCallShouldOnlyWorkForGetterSetter(){
+ public function testCallShouldOnlyWorkForGetterSetter() {
$this->expectException(\BadFunctionCallException::class);
$this->entity->something();
@@ -137,21 +137,21 @@ class EntityTest extends \Test\TestCase {
- public function testGetterShouldFailIfAttributeNotDefined(){
+ public function testGetterShouldFailIfAttributeNotDefined() {
$this->expectException(\BadFunctionCallException::class);
$this->entity->getTest();
}
- public function testSetterShouldFailIfAttributeNotDefined(){
+ public function testSetterShouldFailIfAttributeNotDefined() {
$this->expectException(\BadFunctionCallException::class);
$this->entity->setTest();
}
- public function testFromRowShouldNotAssignEmptyArray(){
+ public function testFromRowShouldNotAssignEmptyArray() {
$row = [];
$entity2 = new TestEntity();
@@ -160,7 +160,7 @@ class EntityTest extends \Test\TestCase {
}
- public function testIdGetsConvertedToInt(){
+ public function testIdGetsConvertedToInt() {
$row = ['id' => '4'];
$this->entity = TestEntity::fromRow($row);
@@ -168,7 +168,7 @@ class EntityTest extends \Test\TestCase {
}
- public function testSetType(){
+ public function testSetType() {
$row = ['testId' => '4'];
$this->entity = TestEntity::fromRow($row);
@@ -176,7 +176,7 @@ class EntityTest extends \Test\TestCase {
}
- public function testFromParams(){
+ public function testFromParams() {
$params = [
'testId' => 4,
'email' => 'john@doe'
@@ -189,7 +189,7 @@ class EntityTest extends \Test\TestCase {
$this->assertTrue($entity instanceof TestEntity);
}
- public function testSlugify(){
+ public function testSlugify() {
$entity = new TestEntity();
$entity->setName('Slugify this!');
$this->assertEquals('slugify-this', $entity->slugify('name'));
diff --git a/tests/lib/AppFramework/Db/MapperTest.php b/tests/lib/AppFramework/Db/MapperTest.php
index 79a9a1884e0..4509b1b80c7 100644
--- a/tests/lib/AppFramework/Db/MapperTest.php
+++ b/tests/lib/AppFramework/Db/MapperTest.php
@@ -44,12 +44,12 @@ 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); }
}
@@ -66,12 +66,12 @@ class MapperTest extends MapperTestUtility {
}
- public function testMapperShouldSetTableName(){
+ public function testMapperShouldSetTableName() {
$this->assertEquals('*PREFIX*table', $this->mapper->getTableName());
}
- public function testFindQuery(){
+ public function testFindQuery() {
$sql = 'hi';
$params = ['jo'];
$rows = [
@@ -81,7 +81,7 @@ class MapperTest extends MapperTestUtility {
$this->mapper->find($sql, $params);
}
- public function testFindEntity(){
+ public function testFindEntity() {
$sql = 'hi';
$params = ['jo'];
$rows = [
@@ -91,7 +91,7 @@ class MapperTest extends MapperTestUtility {
$this->mapper->findOneEntity($sql, $params);
}
- public function testFindNotFound(){
+ public function testFindNotFound() {
$sql = 'hi';
$params = ['jo'];
$rows = [];
@@ -100,7 +100,7 @@ class MapperTest extends MapperTestUtility {
$this->mapper->find($sql, $params);
}
- public function testFindEntityNotFound(){
+ public function testFindEntityNotFound() {
$sql = 'hi';
$params = ['jo'];
$rows = [];
@@ -109,7 +109,7 @@ class MapperTest extends MapperTestUtility {
$this->mapper->findOneEntity($sql, $params);
}
- public function testFindMultiple(){
+ public function testFindMultiple() {
$sql = 'hi';
$params = ['jo'];
$rows = [
@@ -120,7 +120,7 @@ class MapperTest extends MapperTestUtility {
$this->mapper->find($sql, $params);
}
- public function testFindEntityMultiple(){
+ public function testFindEntityMultiple() {
$sql = 'hi';
$params = ['jo'];
$rows = [
@@ -132,7 +132,7 @@ class MapperTest extends MapperTestUtility {
}
- public function testDelete(){
+ public function testDelete() {
$sql = 'DELETE FROM `*PREFIX*table` WHERE `id` = ?';
$params = [2];
@@ -144,7 +144,7 @@ class MapperTest extends MapperTestUtility {
}
- public function testCreate(){
+ public function testCreate() {
$this->db->expects($this->once())
->method('lastInsertId')
->with($this->equalTo('*PREFIX*table'))
@@ -164,7 +164,7 @@ class MapperTest extends MapperTestUtility {
}
- public function testCreateShouldReturnItemWithCorrectInsertId(){
+ public function testCreateShouldReturnItemWithCorrectInsertId() {
$this->db->expects($this->once())
->method('lastInsertId')
->with($this->equalTo('*PREFIX*table'))
@@ -195,7 +195,7 @@ class MapperTest extends MapperTestUtility {
}
- public function testUpdate(){
+ public function testUpdate() {
$sql = 'UPDATE `*PREFIX*table` ' .
'SET ' .
'`pre_name` = ?,'.
@@ -214,7 +214,7 @@ class MapperTest extends MapperTestUtility {
}
- public function testUpdateNoId(){
+ public function testUpdateNoId() {
$params = ['john', 'my@email'];
$entity = new Example();
$entity->setPreName($params[0]);
@@ -226,7 +226,7 @@ class MapperTest extends MapperTestUtility {
}
- public function testUpdateNothingChangedNoQuery(){
+ public function testUpdateNothingChangedNoQuery() {
$params = ['john', 'my@email'];
$entity = new Example();
$entity->setId(3);
@@ -240,7 +240,7 @@ class MapperTest extends MapperTestUtility {
}
- public function testMapRowToEntity(){
+ public function testMapRowToEntity() {
$entity1 = $this->mapper->mapRow(['pre_name' => 'test1', 'email' => 'test2']);
$entity2 = new Example();
$entity2->setPreName('test1');
@@ -249,7 +249,7 @@ class MapperTest extends MapperTestUtility {
$this->assertEquals($entity2, $entity1);
}
- public function testFindEntities(){
+ public function testFindEntities() {
$sql = 'hi';
$rows = [
['pre_name' => 'hi']
@@ -262,7 +262,7 @@ class MapperTest extends MapperTestUtility {
$this->assertEquals([$entity], $result);
}
- public function testFindEntitiesNotFound(){
+ public function testFindEntitiesNotFound() {
$sql = 'hi';
$rows = [];
$this->setMapperResult($sql, [], $rows);
@@ -270,7 +270,7 @@ class MapperTest extends MapperTestUtility {
$this->assertEquals([], $result);
}
- public function testFindEntitiesMultiple(){
+ public function testFindEntitiesMultiple() {
$sql = 'hi';
$rows = [
['pre_name' => 'jo'], ['email' => 'ho']
diff --git a/tests/lib/AppFramework/Db/MapperTestUtility.php b/tests/lib/AppFramework/Db/MapperTestUtility.php
index ebcc4a11e26..9ee83e5a161 100644
--- a/tests/lib/AppFramework/Db/MapperTestUtility.php
+++ b/tests/lib/AppFramework/Db/MapperTestUtility.php
@@ -89,7 +89,7 @@ abstract class MapperTestUtility extends \Test\TestCase {
* will be called on the result
*/
protected function setMapperResult($sql, $arguments=[], $returnRows=[],
- $limit=null, $offset=null, $expectClose=false){
+ $limit=null, $offset=null, $expectClose=false) {
if($limit === null && $offset === null) {
$this->db->expects($this->at($this->prepareAt))
->method('prepare')
@@ -124,7 +124,7 @@ abstract class MapperTestUtility extends \Test\TestCase {
$this->query->expects($this->any())
->method('fetch')
->willReturnCallback(
- function() use ($iterators, $fetchAt){
+ function () use ($iterators, $fetchAt) {
$iterator = $iterators[$fetchAt];
$result = $iterator->next();
@@ -164,7 +164,7 @@ abstract class MapperTestUtility extends \Test\TestCase {
$this->query->expects($this->at($this->queryAt))
->method('execute')
- ->willReturnCallback(function($sql, $p=null, $o=null, $s=null) {
+ ->willReturnCallback(function ($sql, $p=null, $o=null, $s=null) {
});
$this->queryAt++;
@@ -191,11 +191,11 @@ class ArgumentIterator {
private $arguments;
- public function __construct($arguments){
+ public function __construct($arguments) {
$this->arguments = $arguments;
}
- public function next(){
+ public function next() {
$result = array_shift($this->arguments);
if($result === null){
return false;
diff --git a/tests/lib/AppFramework/DependencyInjection/DIContainerTest.php b/tests/lib/AppFramework/DependencyInjection/DIContainerTest.php
index b8cf35dfb6e..ba114433a4c 100644
--- a/tests/lib/AppFramework/DependencyInjection/DIContainerTest.php
+++ b/tests/lib/AppFramework/DependencyInjection/DIContainerTest.php
@@ -49,24 +49,24 @@ class DIContainerTest extends \Test\TestCase {
}
- public function testProvidesRequest(){
+ public function testProvidesRequest() {
$this->assertTrue(isset($this->container['Request']));
}
- public function testProvidesMiddlewareDispatcher(){
+ public function testProvidesMiddlewareDispatcher() {
$this->assertTrue(isset($this->container['MiddlewareDispatcher']));
}
- public function testProvidesAppName(){
+ public function testProvidesAppName() {
$this->assertTrue(isset($this->container['AppName']));
}
- public function testAppNameIsSetCorrectly(){
+ public function testAppNameIsSetCorrectly() {
$this->assertEquals('name', $this->container['AppName']);
}
- public function testMiddlewareDispatcherIncludesSecurityMiddleware(){
+ public function testMiddlewareDispatcherIncludesSecurityMiddleware() {
$this->container['Request'] = new Request(
['method' => 'GET'],
$this->createMock(ISecureRandom::class),
diff --git a/tests/lib/AppFramework/Http/DispatcherTest.php b/tests/lib/AppFramework/Http/DispatcherTest.php
index d6af034e95e..bb6f68c40bb 100644
--- a/tests/lib/AppFramework/Http/DispatcherTest.php
+++ b/tests/lib/AppFramework/Http/DispatcherTest.php
@@ -51,7 +51,7 @@ class TestController extends Controller {
* @return array
*/
public function exec($int, $bool, $test=4, $test2=1) {
- $this->registerResponder('text', function($in) {
+ $this->registerResponder('text', function ($in) {
return new JSONResponse(['text' => $in]);
});
return [$int, $bool, $test, $test2];
@@ -231,7 +231,7 @@ class DispatcherTest extends \Test\TestCase {
}
- public function testHeadersAndOutputAreReturned(){
+ public function testHeadersAndOutputAreReturned() {
$out = 'yo';
$httpHeaders = 'Http';
$responseHeaders = ['hell' => 'yeah'];
@@ -281,12 +281,12 @@ class DispatcherTest extends \Test\TestCase {
->method('beforeController');
$this->middlewareDispatcher->expects($this->once())
->method('afterController')
- ->willReturnCallback(function($a, $b, $in) {
+ ->willReturnCallback(function ($a, $b, $in) {
return $in;
});
$this->middlewareDispatcher->expects($this->once())
->method('beforeOutput')
- ->willReturnCallback(function($a, $b, $in) {
+ ->willReturnCallback(function ($a, $b, $in) {
return $in;
});
}
diff --git a/tests/lib/AppFramework/Http/RedirectResponseTest.php b/tests/lib/AppFramework/Http/RedirectResponseTest.php
index fc24f323c6a..b211df1846e 100644
--- a/tests/lib/AppFramework/Http/RedirectResponseTest.php
+++ b/tests/lib/AppFramework/Http/RedirectResponseTest.php
@@ -47,7 +47,7 @@ class RedirectResponseTest extends \Test\TestCase {
}
- public function testGetRedirectUrl(){
+ public function testGetRedirectUrl() {
$this->assertEquals('/url', $this->response->getRedirectUrl());
}
diff --git a/tests/lib/AppFramework/Http/RequestTest.php b/tests/lib/AppFramework/Http/RequestTest.php
index 8f7c26cc952..e5a3e88d98e 100644
--- a/tests/lib/AppFramework/Http/RequestTest.php
+++ b/tests/lib/AppFramework/Http/RequestTest.php
@@ -716,7 +716,7 @@ class RequestTest extends \Test\TestCase {
public function testGetServerProtocolWithProtoValid() {
$this->config
->method('getSystemValue')
- ->willReturnCallback(function($key, $default) {
+ ->willReturnCallback(function ($key, $default) {
if ($key === 'trusted_proxies') {
return ['1.2.3.4'];
}
@@ -757,7 +757,7 @@ class RequestTest extends \Test\TestCase {
public function testGetServerProtocolWithHttpsServerValueOn() {
$this->config
->method('getSystemValue')
- ->willReturnCallback(function($key, $default) {
+ ->willReturnCallback(function ($key, $default) {
return $default;
});
@@ -778,7 +778,7 @@ class RequestTest extends \Test\TestCase {
public function testGetServerProtocolWithHttpsServerValueOff() {
$this->config
->method('getSystemValue')
- ->willReturnCallback(function($key, $default) {
+ ->willReturnCallback(function ($key, $default) {
return $default;
});
@@ -799,7 +799,7 @@ class RequestTest extends \Test\TestCase {
public function testGetServerProtocolWithHttpsServerValueEmpty() {
$this->config
->method('getSystemValue')
- ->willReturnCallback(function($key, $default) {
+ ->willReturnCallback(function ($key, $default) {
return $default;
});
@@ -820,7 +820,7 @@ class RequestTest extends \Test\TestCase {
public function testGetServerProtocolDefault() {
$this->config
->method('getSystemValue')
- ->willReturnCallback(function($key, $default) {
+ ->willReturnCallback(function ($key, $default) {
return $default;
});
@@ -837,7 +837,7 @@ class RequestTest extends \Test\TestCase {
public function testGetServerProtocolBehindLoadBalancers() {
$this->config
->method('getSystemValue')
- ->willReturnCallback(function($key, $default) {
+ ->willReturnCallback(function ($key, $default) {
if ($key === 'trusted_proxies') {
return ['1.2.3.4'];
}
@@ -1059,7 +1059,7 @@ class RequestTest extends \Test\TestCase {
public function testInsecureServerHostHttpFromForwardedHeaderSingle() {
$this->config
->method('getSystemValue')
- ->willReturnCallback(function($key, $default) {
+ ->willReturnCallback(function ($key, $default) {
if ($key === 'trusted_proxies') {
return ['1.2.3.4'];
}
@@ -1088,7 +1088,7 @@ class RequestTest extends \Test\TestCase {
public function testInsecureServerHostHttpFromForwardedHeaderStacked() {
$this->config
->method('getSystemValue')
- ->willReturnCallback(function($key, $default) {
+ ->willReturnCallback(function ($key, $default) {
if ($key === 'trusted_proxies') {
return ['1.2.3.4'];
}
@@ -1117,7 +1117,7 @@ class RequestTest extends \Test\TestCase {
public function testGetServerHostWithOverwriteHost() {
$this->config
->method('getSystemValue')
- ->willReturnCallback(function($key, $default) {
+ ->willReturnCallback(function ($key, $default) {
if ($key === 'overwritecondaddr') {
return '';
} else if ($key === 'overwritehost') {
@@ -1141,7 +1141,7 @@ class RequestTest extends \Test\TestCase {
public function testGetServerHostWithTrustedDomain() {
$this->config
->method('getSystemValue')
- ->willReturnCallback(function($key, $default) {
+ ->willReturnCallback(function ($key, $default) {
if ($key === 'trusted_proxies') {
return ['1.2.3.4'];
} else if ($key === 'trusted_domains') {
@@ -1170,7 +1170,7 @@ class RequestTest extends \Test\TestCase {
public function testGetServerHostWithUntrustedDomain() {
$this->config
->method('getSystemValue')
- ->willReturnCallback(function($key, $default) {
+ ->willReturnCallback(function ($key, $default) {
if ($key === 'trusted_proxies') {
return ['1.2.3.4'];
} else if ($key === 'trusted_domains') {
@@ -1199,7 +1199,7 @@ class RequestTest extends \Test\TestCase {
public function testGetServerHostWithNoTrustedDomain() {
$this->config
->method('getSystemValue')
- ->willReturnCallback(function($key, $default) {
+ ->willReturnCallback(function ($key, $default) {
if ($key === 'trusted_proxies') {
return ['1.2.3.4'];
}
diff --git a/tests/lib/AppFramework/Http/ResponseTest.php b/tests/lib/AppFramework/Http/ResponseTest.php
index 0a2dc84d411..7ff12b7fa67 100644
--- a/tests/lib/AppFramework/Http/ResponseTest.php
+++ b/tests/lib/AppFramework/Http/ResponseTest.php
@@ -40,7 +40,7 @@ class ResponseTest extends \Test\TestCase {
}
- public function testAddHeader(){
+ public function testAddHeader() {
$this->childResponse->addHeader(' hello ', 'world');
$headers = $this->childResponse->getHeaders();
$this->assertEquals('world', $headers['hello']);
@@ -87,14 +87,14 @@ class ResponseTest extends \Test\TestCase {
$this->assertEquals(new Http\EmptyContentSecurityPolicy(), $this->childResponse->getContentSecurityPolicy());
}
- public function testAddHeaderValueNullDeletesIt(){
+ public function testAddHeaderValueNullDeletesIt() {
$this->childResponse->addHeader('hello', 'world');
$this->childResponse->addHeader('hello', null);
$this->assertEquals(3, count($this->childResponse->getHeaders()));
}
- public function testCacheHeadersAreDisabledByDefault(){
+ public function testCacheHeadersAreDisabledByDefault() {
$headers = $this->childResponse->getHeaders();
$this->assertEquals('no-cache, no-store, must-revalidate', $headers['Cache-Control']);
}
@@ -186,7 +186,7 @@ class ResponseTest extends \Test\TestCase {
}
- public function testRenderReturnNullByDefault(){
+ public function testRenderReturnNullByDefault() {
$this->assertEquals(null, $this->childResponse->render());
}
diff --git a/tests/lib/AppFramework/Http/StreamResponseTest.php b/tests/lib/AppFramework/Http/StreamResponseTest.php
index 6257769d927..fb4eb5dc91c 100644
--- a/tests/lib/AppFramework/Http/StreamResponseTest.php
+++ b/tests/lib/AppFramework/Http/StreamResponseTest.php
@@ -39,7 +39,7 @@ class StreamResponseTest extends \Test\TestCase {
->getMock();
}
- public function testOutputNotModified(){
+ public function testOutputNotModified() {
$path = __FILE__;
$this->output->expects($this->once())
->method('getHttpResponseCode')
@@ -51,7 +51,7 @@ class StreamResponseTest extends \Test\TestCase {
$response->callback($this->output);
}
- public function testOutputOk(){
+ public function testOutputOk() {
$path = __FILE__;
$this->output->expects($this->once())
->method('getHttpResponseCode')
@@ -65,7 +65,7 @@ class StreamResponseTest extends \Test\TestCase {
$response->callback($this->output);
}
- public function testOutputNotFound(){
+ public function testOutputNotFound() {
$path = __FILE__ . 'test';
$this->output->expects($this->once())
->method('getHttpResponseCode')
@@ -80,7 +80,7 @@ class StreamResponseTest extends \Test\TestCase {
$response->callback($this->output);
}
- public function testOutputReadFileError(){
+ public function testOutputReadFileError() {
$path = __FILE__;
$this->output->expects($this->once())
->method('getHttpResponseCode')
diff --git a/tests/lib/AppFramework/Http/TemplateResponseTest.php b/tests/lib/AppFramework/Http/TemplateResponseTest.php
index af5b428cf86..0faa78998cb 100644
--- a/tests/lib/AppFramework/Http/TemplateResponseTest.php
+++ b/tests/lib/AppFramework/Http/TemplateResponseTest.php
@@ -40,7 +40,7 @@ class TemplateResponseTest extends \Test\TestCase {
}
- public function testSetParamsConstructor(){
+ public function testSetParamsConstructor() {
$params = ['hi' => 'yo'];
$this->tpl = new TemplateResponse('app', 'home', $params);
@@ -48,7 +48,7 @@ class TemplateResponseTest extends \Test\TestCase {
}
- public function testSetRenderAsConstructor(){
+ public function testSetRenderAsConstructor() {
$renderAs = 'myrender';
$this->tpl = new TemplateResponse('app', 'home', [], $renderAs);
@@ -56,7 +56,7 @@ class TemplateResponseTest extends \Test\TestCase {
}
- public function testSetParams(){
+ public function testSetParams() {
$params = ['hi' => 'yo'];
$this->tpl->setParams($params);
@@ -64,11 +64,11 @@ class TemplateResponseTest extends \Test\TestCase {
}
- public function testGetTemplateName(){
+ public function testGetTemplateName() {
$this->assertEquals('home', $this->tpl->getTemplateName());
}
- public function testGetRenderAs(){
+ public function testGetRenderAs() {
$render = 'myrender';
$this->tpl->renderAs($render);
$this->assertEquals($render, $this->tpl->getRenderAs());
diff --git a/tests/lib/AppFramework/Middleware/AdditionalScriptsMiddlewareTest.php b/tests/lib/AppFramework/Middleware/AdditionalScriptsMiddlewareTest.php
index 773e900545f..617ead473c0 100644
--- a/tests/lib/AppFramework/Middleware/AdditionalScriptsMiddlewareTest.php
+++ b/tests/lib/AppFramework/Middleware/AdditionalScriptsMiddlewareTest.php
@@ -82,7 +82,7 @@ class AdditionalScriptsMiddlewareTest extends \Test\TestCase {
public function testStandaloneTemplateResponse() {
$this->dispatcher->expects($this->once())
->method('dispatch')
- ->willReturnCallback(function($eventName) {
+ ->willReturnCallback(function ($eventName) {
if ($eventName === TemplateResponse::EVENT_LOAD_ADDITIONAL_SCRIPTS) {
return;
}
@@ -98,7 +98,7 @@ class AdditionalScriptsMiddlewareTest extends \Test\TestCase {
public function testTemplateResponseNotLoggedIn() {
$this->dispatcher->expects($this->once())
->method('dispatch')
- ->willReturnCallback(function($eventName) {
+ ->willReturnCallback(function ($eventName) {
if ($eventName === TemplateResponse::EVENT_LOAD_ADDITIONAL_SCRIPTS) {
return;
}
@@ -116,7 +116,7 @@ class AdditionalScriptsMiddlewareTest extends \Test\TestCase {
$this->dispatcher->expects($this->exactly(2))
->method('dispatch')
- ->willReturnCallback(function($eventName) use (&$events) {
+ ->willReturnCallback(function ($eventName) use (&$events) {
if ($eventName === TemplateResponse::EVENT_LOAD_ADDITIONAL_SCRIPTS ||
$eventName === TemplateResponse::EVENT_LOAD_ADDITIONAL_SCRIPTS_LOGGEDIN) {
$events[] = $eventName;
diff --git a/tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php b/tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php
index 69dd6d16226..5f0517016dd 100644
--- a/tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php
+++ b/tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php
@@ -60,7 +60,7 @@ class TestMiddleware extends Middleware {
$this->beforeControllerThrowsEx = $beforeControllerThrowsEx;
}
- public function beforeController($controller, $methodName){
+ public function beforeController($controller, $methodName) {
self::$beforeControllerCalled++;
$this->beforeControllerOrder = self::$beforeControllerCalled;
$this->controller = $controller;
@@ -70,7 +70,7 @@ class TestMiddleware extends Middleware {
}
}
- public function afterException($controller, $methodName, \Exception $exception){
+ public function afterException($controller, $methodName, \Exception $exception) {
self::$afterExceptionCalled++;
$this->afterExceptionOrder = self::$afterExceptionCalled;
$this->controller = $controller;
@@ -79,7 +79,7 @@ class TestMiddleware extends Middleware {
parent::afterException($controller, $methodName, $exception);
}
- public function afterController($controller, $methodName, Response $response){
+ public function afterController($controller, $methodName, Response $response) {
self::$afterControllerCalled++;
$this->afterControllerOrder = self::$afterControllerCalled;
$this->controller = $controller;
@@ -88,7 +88,7 @@ class TestMiddleware extends Middleware {
return parent::afterController($controller, $methodName, $response);
}
- public function beforeOutput($controller, $methodName, $output){
+ public function beforeOutput($controller, $methodName, $output) {
self::$beforeOutputCalled++;
$this->beforeOutputOrder = self::$beforeOutputCalled;
$this->controller = $controller;
@@ -124,7 +124,7 @@ class MiddlewareDispatcherTest extends \Test\TestCase {
}
- private function getControllerMock(){
+ private function getControllerMock() {
return $this->getMockBuilder('OCP\AppFramework\Controller')
->setMethods(['method'])
->setConstructorArgs(['app',
@@ -137,14 +137,14 @@ class MiddlewareDispatcherTest extends \Test\TestCase {
}
- private function getMiddleware($beforeControllerThrowsEx=false){
+ private function getMiddleware($beforeControllerThrowsEx=false) {
$m1 = new TestMiddleware($beforeControllerThrowsEx);
$this->dispatcher->registerMiddleware($m1);
return $m1;
}
- public function testAfterExceptionShouldReturnResponseOfMiddleware(){
+ public function testAfterExceptionShouldReturnResponseOfMiddleware() {
$response = new Response();
$m1 = $this->getMockBuilder('\OCP\AppFramework\Middleware')
->setMethods(['afterException', 'beforeController'])
@@ -167,7 +167,7 @@ class MiddlewareDispatcherTest extends \Test\TestCase {
}
- public function testAfterExceptionShouldThrowAgainWhenNotHandled(){
+ public function testAfterExceptionShouldThrowAgainWhenNotHandled() {
$m1 = new TestMiddleware(false);
$m2 = new TestMiddleware(true);
@@ -180,7 +180,7 @@ class MiddlewareDispatcherTest extends \Test\TestCase {
}
- public function testBeforeControllerCorrectArguments(){
+ public function testBeforeControllerCorrectArguments() {
$m1 = $this->getMiddleware();
$this->dispatcher->beforeController($this->controller, $this->method);
@@ -189,7 +189,7 @@ class MiddlewareDispatcherTest extends \Test\TestCase {
}
- public function testAfterControllerCorrectArguments(){
+ public function testAfterControllerCorrectArguments() {
$m1 = $this->getMiddleware();
$this->dispatcher->afterController($this->controller, $this->method, $this->response);
@@ -200,7 +200,7 @@ class MiddlewareDispatcherTest extends \Test\TestCase {
}
- public function testAfterExceptionCorrectArguments(){
+ public function testAfterExceptionCorrectArguments() {
$m1 = $this->getMiddleware();
$this->expectException(\Exception::class);
@@ -214,7 +214,7 @@ class MiddlewareDispatcherTest extends \Test\TestCase {
}
- public function testBeforeOutputCorrectArguments(){
+ public function testBeforeOutputCorrectArguments() {
$m1 = $this->getMiddleware();
$this->dispatcher->beforeOutput($this->controller, $this->method, $this->out);
@@ -225,7 +225,7 @@ class MiddlewareDispatcherTest extends \Test\TestCase {
}
- public function testBeforeControllerOrder(){
+ public function testBeforeControllerOrder() {
$m1 = $this->getMiddleware();
$m2 = $this->getMiddleware();
@@ -235,7 +235,7 @@ class MiddlewareDispatcherTest extends \Test\TestCase {
$this->assertEquals(2, $m2->beforeControllerOrder);
}
- public function testAfterControllerOrder(){
+ public function testAfterControllerOrder() {
$m1 = $this->getMiddleware();
$m2 = $this->getMiddleware();
@@ -246,7 +246,7 @@ class MiddlewareDispatcherTest extends \Test\TestCase {
}
- public function testAfterExceptionOrder(){
+ public function testAfterExceptionOrder() {
$m1 = $this->getMiddleware();
$m2 = $this->getMiddleware();
@@ -259,7 +259,7 @@ class MiddlewareDispatcherTest extends \Test\TestCase {
}
- public function testBeforeOutputOrder(){
+ public function testBeforeOutputOrder() {
$m1 = $this->getMiddleware();
$m2 = $this->getMiddleware();
@@ -270,7 +270,7 @@ class MiddlewareDispatcherTest extends \Test\TestCase {
}
- public function testExceptionShouldRunAfterExceptionOfOnlyPreviouslyExecutedMiddlewares(){
+ public function testExceptionShouldRunAfterExceptionOfOnlyPreviouslyExecutedMiddlewares() {
$m1 = $this->getMiddleware();
$m2 = $this->getMiddleware(true);
$m3 = $this->getMockBuilder('\OCP\AppFramework\Middleware')->getMock();
diff --git a/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php
index 85e1ac4e205..422087241f6 100644
--- a/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php
+++ b/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php
@@ -112,7 +112,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
* @PublicPage
* @NoCSRFRequired
*/
- public function testSetNavigationEntry(){
+ public function testSetNavigationEntry() {
$this->navigationManager->expects($this->once())
->method('setActiveEntry')
->with($this->equalTo('files'));
@@ -208,7 +208,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
* @PublicPage
* @NoCSRFRequired
*/
- public function testNoChecks(){
+ public function testNoChecks() {
$this->request->expects($this->never())
->method('passesCSRFCheck')
->willReturn(false);
@@ -224,7 +224,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
* @param string $method
* @param string $expects
*/
- private function securityCheck($method, $expects, $shouldFail=false){
+ private function securityCheck($method, $expects, $shouldFail=false) {
// admin check requires login
if ($expects === 'isAdminUser') {
$isLoggedIn = true;
@@ -250,7 +250,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
/**
* @PublicPage
*/
- public function testCsrfCheck(){
+ public function testCsrfCheck() {
$this->expectException(\OC\AppFramework\Middleware\Security\Exceptions\CrossSiteRequestForgeryException::class);
$this->request->expects($this->once())
@@ -268,7 +268,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
* @PublicPage
* @NoCSRFRequired
*/
- public function testNoCsrfCheck(){
+ public function testNoCsrfCheck() {
$this->request->expects($this->never())
->method('passesCSRFCheck')
->willReturn(false);
@@ -280,7 +280,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
/**
* @PublicPage
*/
- public function testPassesCsrfCheck(){
+ public function testPassesCsrfCheck() {
$this->request->expects($this->once())
->method('passesCSRFCheck')
->willReturn(true);
@@ -295,7 +295,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
/**
* @PublicPage
*/
- public function testFailCsrfCheck(){
+ public function testFailCsrfCheck() {
$this->expectException(\OC\AppFramework\Middleware\Security\Exceptions\CrossSiteRequestForgeryException::class);
$this->request->expects($this->once())
@@ -411,7 +411,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
* @NoCSRFRequired
* @NoAdminRequired
*/
- public function testLoggedInCheck(){
+ public function testLoggedInCheck() {
$this->securityCheck(__FUNCTION__, 'isLoggedIn');
}
@@ -420,7 +420,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
* @NoCSRFRequired
* @NoAdminRequired
*/
- public function testFailLoggedInCheck(){
+ public function testFailLoggedInCheck() {
$this->securityCheck(__FUNCTION__, 'isLoggedIn', true);
}
@@ -428,7 +428,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
/**
* @NoCSRFRequired
*/
- public function testIsAdminCheck(){
+ public function testIsAdminCheck() {
$this->securityCheck(__FUNCTION__, 'isAdminUser');
}
@@ -436,7 +436,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
* @NoCSRFRequired
* @SubAdminRequired
*/
- public function testIsNotSubAdminCheck(){
+ public function testIsNotSubAdminCheck() {
$this->reader->reflect(__CLASS__,__FUNCTION__);
$sec = $this->getMiddleware(true, false, false);
@@ -448,7 +448,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
* @NoCSRFRequired
* @SubAdminRequired
*/
- public function testIsSubAdminCheck(){
+ public function testIsSubAdminCheck() {
$this->reader->reflect(__CLASS__,__FUNCTION__);
$sec = $this->getMiddleware(true, false, true);
@@ -460,7 +460,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
* @NoCSRFRequired
* @SubAdminRequired
*/
- public function testIsSubAdminAndAdminCheck(){
+ public function testIsSubAdminAndAdminCheck() {
$this->reader->reflect(__CLASS__,__FUNCTION__);
$sec = $this->getMiddleware(true, true, true);
@@ -471,12 +471,12 @@ class SecurityMiddlewareTest extends \Test\TestCase {
/**
* @NoCSRFRequired
*/
- public function testFailIsAdminCheck(){
+ public function testFailIsAdminCheck() {
$this->securityCheck(__FUNCTION__, 'isAdminUser', true);
}
- public function testAfterExceptionNotCaughtThrowsItAgain(){
+ public function testAfterExceptionNotCaughtThrowsItAgain() {
$ex = new \Exception();
$this->expectException(\Exception::class);
$this->middleware->afterException($this->controller, 'test', $ex);
@@ -588,7 +588,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
$this->assertEquals($expected , $response);
}
- public function testAfterAjaxExceptionReturnsJSONError(){
+ public function testAfterAjaxExceptionReturnsJSONError() {
$response = $this->middleware->afterException($this->controller, 'test',
$this->secAjaxException);
diff --git a/tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php b/tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php
index 5c0e8c6b223..2d20578efab 100644
--- a/tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php
+++ b/tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php
@@ -30,17 +30,17 @@ class BaseController {
/**
* @Annotation
*/
- public function test(){}
+ public function test() {}
/**
* @Annotation
*/
- public function test2(){}
+ public function test2() {}
/**
* @Annotation
*/
- public function test3(){}
+ public function test3() {}
}
@@ -63,7 +63,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase {
/**
* @Annotation
*/
- public function testReadAnnotation(){
+ public function testReadAnnotation() {
$reader = new ControllerMethodReflector();
$reader->reflect(
'\Test\AppFramework\Utility\ControllerMethodReflectorTest',
@@ -105,7 +105,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase {
* @Annotation
* @param test
*/
- public function testReadAnnotationNoLowercase(){
+ public function testReadAnnotationNoLowercase() {
$reader = new ControllerMethodReflector();
$reader->reflect(
'\Test\AppFramework\Utility\ControllerMethodReflectorTest',
@@ -121,7 +121,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase {
* @Annotation
* @param int $test
*/
- public function testReadTypeIntAnnotations(){
+ public function testReadTypeIntAnnotations() {
$reader = new ControllerMethodReflector();
$reader->reflect(
'\Test\AppFramework\Utility\ControllerMethodReflectorTest',
@@ -136,12 +136,12 @@ 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
*/
- public function testReadTypeIntAnnotationsScalarTypes(){
+ public function testReadTypeIntAnnotationsScalarTypes() {
$reader = new ControllerMethodReflector();
$reader->reflect(
'\Test\AppFramework\Utility\ControllerMethodReflectorTest',
@@ -159,7 +159,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase {
* @Annotation
* @param double $test something special
*/
- public function testReadTypeDoubleAnnotations(){
+ public function testReadTypeDoubleAnnotations() {
$reader = new ControllerMethodReflector();
$reader->reflect(
'\Test\AppFramework\Utility\ControllerMethodReflectorTest',
@@ -173,7 +173,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase {
* @Annotation
* @param string $foo
*/
- public function testReadTypeWhitespaceAnnotations(){
+ public function testReadTypeWhitespaceAnnotations() {
$reader = new ControllerMethodReflector();
$reader->reflect(
'\Test\AppFramework\Utility\ControllerMethodReflectorTest',
diff --git a/tests/lib/AppFramework/Utility/SimpleContainerTest.php b/tests/lib/AppFramework/Utility/SimpleContainerTest.php
index 8343c05e916..52908ed8839 100644
--- a/tests/lib/AppFramework/Utility/SimpleContainerTest.php
+++ b/tests/lib/AppFramework/Utility/SimpleContainerTest.php
@@ -158,7 +158,7 @@ class SimpleContainerTest extends \Test\TestCase {
}
public function testRegisterAliasService() {
- $this->container->registerService('test', function() {
+ $this->container->registerService('test', function () {
return new \StdClass;
}, true);
$this->container->registerAlias('test1', 'test');
@@ -183,7 +183,7 @@ class SimpleContainerTest extends \Test\TestCase {
* @dataProvider sanitizeNameProvider
*/
public function testSanitizeName($register, $query) {
- $this->container->registerService($register, function() {
+ $this->container->registerService($register, function () {
return 'abc';
});
$this->assertEquals('abc', $this->container->query($query));
@@ -199,7 +199,7 @@ class SimpleContainerTest extends \Test\TestCase {
}
public function testRegisterFactory() {
- $this->container->registerService('test', function() {
+ $this->container->registerService('test', function () {
return new \StdClass();
}, false);
$this->assertNotSame(
@@ -207,7 +207,7 @@ class SimpleContainerTest extends \Test\TestCase {
}
public function testRegisterAliasFactory() {
- $this->container->registerService('test', function() {
+ $this->container->registerService('test', function () {
return new \StdClass();
}, false);
$this->container->registerAlias('test1', 'test');