diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-09 13:53:40 +0200 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-09 13:54:22 +0200 |
commit | afbd9c4e6ed834e713039f2cff88ba3eec03dadb (patch) | |
tree | 7d8721cf8fc0329d6b750db63798de67a162b090 /tests | |
parent | 19e97e86c69ab128191439d6a17dacb5a630cf98 (diff) | |
download | nextcloud-server-afbd9c4e6ed834e713039f2cff88ba3eec03dadb.tar.gz nextcloud-server-afbd9c4e6ed834e713039f2cff88ba3eec03dadb.zip |
Unify function spacing to PSR2 recommendation
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'tests')
91 files changed, 359 insertions, 363 deletions
diff --git a/tests/Core/Command/Config/App/GetConfigTest.php b/tests/Core/Command/Config/App/GetConfigTest.php index b18bc8de1d0..75e51a68b2f 100644 --- a/tests/Core/Command/Config/App/GetConfigTest.php +++ b/tests/Core/Command/Config/App/GetConfigTest.php @@ -147,7 +147,7 @@ class GetConfigTest extends TestCase { $output = ''; $this->consoleOutput->expects($this->any()) ->method('writeln') - ->willReturnCallback(function($value) { + ->willReturnCallback(function ($value) { global $output; $output .= $value . "\n"; return $output; diff --git a/tests/Core/Command/Config/ListConfigsTest.php b/tests/Core/Command/Config/ListConfigsTest.php index ac0155f9b5f..2cab9500702 100644 --- a/tests/Core/Command/Config/ListConfigsTest.php +++ b/tests/Core/Command/Config/ListConfigsTest.php @@ -320,7 +320,7 @@ class ListConfigsTest extends TestCase { $output = ''; $this->consoleOutput->expects($this->any()) ->method('writeln') - ->willReturnCallback(function($value) { + ->willReturnCallback(function ($value) { global $output; $output .= $value . "\n"; return $output; diff --git a/tests/Core/Command/Config/System/GetConfigTest.php b/tests/Core/Command/Config/System/GetConfigTest.php index ab366b3e1f5..175a24eb354 100644 --- a/tests/Core/Command/Config/System/GetConfigTest.php +++ b/tests/Core/Command/Config/System/GetConfigTest.php @@ -156,7 +156,7 @@ class GetConfigTest extends TestCase { $output = ''; $this->consoleOutput->expects($this->any()) ->method('writeln') - ->willReturnCallback(function($value) { + ->willReturnCallback(function ($value) { global $output; $output .= $value . "\n"; return $output; diff --git a/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php b/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php index 4f15b2a50b1..4f3fc432dfe 100644 --- a/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php +++ b/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php @@ -332,7 +332,7 @@ class ChangeKeyStorageRootTest extends TestCase { public function testPrepareParentFolder($path, $pathExists) { $this->view->expects($this->any())->method('file_exists') ->willReturnCallback( - function($fileExistsPath) use ($path, $pathExists) { + function ($fileExistsPath) use ($path, $pathExists) { if ($path === $fileExistsPath) { return $pathExists; } diff --git a/tests/Core/Command/Encryption/DecryptAllTest.php b/tests/Core/Command/Encryption/DecryptAllTest.php index 4cae5bc0ad2..a6918404d71 100644 --- a/tests/Core/Command/Encryption/DecryptAllTest.php +++ b/tests/Core/Command/Encryption/DecryptAllTest.php @@ -217,7 +217,7 @@ class DecryptAllTest extends TestCase { $this->decryptAll->expects($this->once()) ->method('decryptAll') ->with($this->consoleInput, $this->consoleOutput, 'user1') - ->willReturnCallback(function() { throw new \Exception(); }); + ->willReturnCallback(function () { throw new \Exception(); }); $this->invokePrivate($instance, 'execute', [$this->consoleInput, $this->consoleOutput]); } diff --git a/tests/Core/Command/Group/AddTest.php b/tests/Core/Command/Group/AddTest.php index d4ba34246af..87cf3c6b8d1 100644 --- a/tests/Core/Command/Group/AddTest.php +++ b/tests/Core/Command/Group/AddTest.php @@ -52,7 +52,7 @@ class AddTest extends TestCase { $this->input = $this->createMock(InputInterface::class); $this->input->method('getArgument') - ->willReturnCallback(function($arg) { + ->willReturnCallback(function ($arg) { if ($arg === 'groupid') { return 'myGroup'; } diff --git a/tests/Core/Command/Group/AddUserTest.php b/tests/Core/Command/Group/AddUserTest.php index 1ee2d2d3377..800e5ecd4f4 100644 --- a/tests/Core/Command/Group/AddUserTest.php +++ b/tests/Core/Command/Group/AddUserTest.php @@ -58,7 +58,7 @@ class AddUserTest extends TestCase { $this->input = $this->createMock(InputInterface::class); $this->input->method('getArgument') - ->willReturnCallback(function($arg) { + ->willReturnCallback(function ($arg) { if ($arg === 'group') { return 'myGroup'; } else if ($arg === 'user') { diff --git a/tests/Core/Command/Group/DeleteTest.php b/tests/Core/Command/Group/DeleteTest.php index 69bdae99d63..60d41d2e24c 100644 --- a/tests/Core/Command/Group/DeleteTest.php +++ b/tests/Core/Command/Group/DeleteTest.php @@ -57,7 +57,7 @@ class DeleteTest extends TestCase { public function testDoesNotExists() { $gid = 'myGroup'; $this->input->method('getArgument') - ->willReturnCallback(function($arg) use ($gid) { + ->willReturnCallback(function ($arg) use ($gid) { if ($arg === 'groupid') { return $gid; } @@ -79,7 +79,7 @@ class DeleteTest extends TestCase { public function testDeleteAdmin() { $gid = 'admin'; $this->input->method('getArgument') - ->willReturnCallback(function($arg) use ($gid) { + ->willReturnCallback(function ($arg) use ($gid) { if ($arg === 'groupid') { return $gid; } @@ -98,7 +98,7 @@ class DeleteTest extends TestCase { public function testDeleteFailed() { $gid = 'myGroup'; $this->input->method('getArgument') - ->willReturnCallback(function($arg) use ($gid) { + ->willReturnCallback(function ($arg) use ($gid) { if ($arg === 'groupid') { return $gid; } @@ -124,7 +124,7 @@ class DeleteTest extends TestCase { public function testDelete() { $gid = 'myGroup'; $this->input->method('getArgument') - ->willReturnCallback(function($arg) use ($gid) { + ->willReturnCallback(function ($arg) use ($gid) { if ($arg === 'groupid') { return $gid; } diff --git a/tests/Core/Command/Group/ListCommandTest.php b/tests/Core/Command/Group/ListCommandTest.php index 21adb29924a..6f2a45c9706 100644 --- a/tests/Core/Command/Group/ListCommandTest.php +++ b/tests/Core/Command/Group/ListCommandTest.php @@ -56,7 +56,7 @@ class ListCommandTest extends TestCase { $this->input = $this->createMock(InputInterface::class); $this->input->method('getOption') - ->willReturnCallback(function($arg) { + ->willReturnCallback(function ($arg) { if ($arg === 'limit') { return '100'; } else if ($arg === 'offset') { diff --git a/tests/Core/Command/Group/RemoveUserTest.php b/tests/Core/Command/Group/RemoveUserTest.php index eda4886da3b..18d8512fcaa 100644 --- a/tests/Core/Command/Group/RemoveUserTest.php +++ b/tests/Core/Command/Group/RemoveUserTest.php @@ -58,7 +58,7 @@ class RemoveUserTest extends TestCase { $this->input = $this->createMock(InputInterface::class); $this->input->method('getArgument') - ->willReturnCallback(function($arg) { + ->willReturnCallback(function ($arg) { if ($arg === 'group') { return 'myGroup'; } else if ($arg === 'user') { diff --git a/tests/Core/Controller/ClientFlowLoginControllerTest.php b/tests/Core/Controller/ClientFlowLoginControllerTest.php index 211f08b929f..a997546270f 100644 --- a/tests/Core/Controller/ClientFlowLoginControllerTest.php +++ b/tests/Core/Controller/ClientFlowLoginControllerTest.php @@ -83,7 +83,7 @@ class ClientFlowLoginControllerTest extends TestCase { $this->l10n ->expects($this->any()) ->method('t') - ->willReturnCallback(function($text, $parameters = []) { + ->willReturnCallback(function ($text, $parameters = []) { return vsprintf($text, $parameters); }); $this->defaults = $this->createMock(Defaults::class); diff --git a/tests/Core/Controller/ClientFlowLoginV2ControllerTest.php b/tests/Core/Controller/ClientFlowLoginV2ControllerTest.php index d1c3f8b7293..1e35dc71c3f 100644 --- a/tests/Core/Controller/ClientFlowLoginV2ControllerTest.php +++ b/tests/Core/Controller/ClientFlowLoginV2ControllerTest.php @@ -184,7 +184,7 @@ class ClientFlowLoginV2ControllerTest extends TestCase { public function testGrantPageInvalidStateToken() { $this->session->method('get') - ->willReturnCallback(function($name) { + ->willReturnCallback(function ($name) { return null; }); @@ -194,7 +194,7 @@ class ClientFlowLoginV2ControllerTest extends TestCase { public function testGrantPageInvalidLoginToken() { $this->session->method('get') - ->willReturnCallback(function($name) { + ->willReturnCallback(function ($name) { if ($name === 'client.flow.v2.state.token') { return 'stateToken'; } @@ -214,7 +214,7 @@ class ClientFlowLoginV2ControllerTest extends TestCase { public function testGrantPageValid() { $this->session->method('get') - ->willReturnCallback(function($name) { + ->willReturnCallback(function ($name) { if ($name === 'client.flow.v2.state.token') { return 'stateToken'; } @@ -236,7 +236,7 @@ class ClientFlowLoginV2ControllerTest extends TestCase { public function testGenerateAppPasswordInvalidStateToken() { $this->session->method('get') - ->willReturnCallback(function($name) { + ->willReturnCallback(function ($name) { return null; }); @@ -246,7 +246,7 @@ class ClientFlowLoginV2ControllerTest extends TestCase { public function testGenerateAppPassworInvalidLoginToken() { $this->session->method('get') - ->willReturnCallback(function($name) { + ->willReturnCallback(function ($name) { if ($name === 'client.flow.v2.state.token') { return 'stateToken'; } @@ -266,7 +266,7 @@ class ClientFlowLoginV2ControllerTest extends TestCase { public function testGenerateAppPassworValid() { $this->session->method('get') - ->willReturnCallback(function($name) { + ->willReturnCallback(function ($name) { if ($name === 'client.flow.v2.state.token') { return 'stateToken'; } diff --git a/tests/Core/Controller/CssControllerTest.php b/tests/Core/Controller/CssControllerTest.php index daccee82705..d1d3ae7eb47 100644 --- a/tests/Core/Controller/CssControllerTest.php +++ b/tests/Core/Controller/CssControllerTest.php @@ -159,7 +159,7 @@ class CssControllerTest extends TestCase { $folder->method('getFile') ->willReturnCallback( - function($fileName) use ($file) { + function ($fileName) use ($file) { if ($fileName === 'file.css') { return $file; } diff --git a/tests/Core/Controller/JsControllerTest.php b/tests/Core/Controller/JsControllerTest.php index 4476b3ee6ed..0b2c6a28f5b 100644 --- a/tests/Core/Controller/JsControllerTest.php +++ b/tests/Core/Controller/JsControllerTest.php @@ -159,7 +159,7 @@ class JsControllerTest extends TestCase { $folder->method('getFile') ->willReturnCallback( - function($fileName) use ($file) { + function ($fileName) use ($file) { if ($fileName === 'file.js') { return $file; } diff --git a/tests/Core/Controller/LoginControllerTest.php b/tests/Core/Controller/LoginControllerTest.php index 4b2511b9ab1..80be53ed26d 100644 --- a/tests/Core/Controller/LoginControllerTest.php +++ b/tests/Core/Controller/LoginControllerTest.php @@ -588,7 +588,7 @@ class LoginControllerTest extends TestCase { $this->chain->expects($this->once()) ->method('process') ->with($this->equalTo($loginData)) - ->willReturnCallback(function(LoginData $data) use ($loginResult) { + ->willReturnCallback(function (LoginData $data) use ($loginResult) { $data->setUsername('john'); return $loginResult; }); diff --git a/tests/Core/Controller/LostControllerTest.php b/tests/Core/Controller/LostControllerTest.php index 4c416947008..ffd8a5a8c02 100644 --- a/tests/Core/Controller/LostControllerTest.php +++ b/tests/Core/Controller/LostControllerTest.php @@ -110,7 +110,7 @@ class LostControllerTest extends \Test\TestCase { $this->l10n ->expects($this->any()) ->method('t') - ->willReturnCallback(function($text, $parameters = []) { + ->willReturnCallback(function ($text, $parameters = []) { return vsprintf($text, $parameters); }); $this->defaults = $this->getMockBuilder('\OCP\Defaults') @@ -766,7 +766,7 @@ class LostControllerTest extends \Test\TestCase { $encryptionModule = $this->createMock(IEncryptionModule::class); $encryptionModule->expects($this->once())->method('needDetailedAccessList')->willReturn(true); $this->encryptionManager->expects($this->once())->method('getEncryptionModules') - ->willReturn([0 => ['callback' => function() use ($encryptionModule) { return $encryptionModule; }]]); + ->willReturn([0 => ['callback' => function () use ($encryptionModule) { return $encryptionModule; }]]); $response = $this->lostController->setPassword('myToken', 'user', 'newpass', false); $expectedResponse = ['status' => 'error', 'msg' => '', 'encryption' => true]; $this->assertSame($expectedResponse, $response); @@ -776,7 +776,7 @@ class LostControllerTest extends \Test\TestCase { $encryptionModule = $this->createMock(IEncryptionModule::class); $encryptionModule->expects($this->once())->method('needDetailedAccessList')->willReturn(false); $this->encryptionManager->expects($this->once())->method('getEncryptionModules') - ->willReturn([0 => ['callback' => function() use ($encryptionModule) { return $encryptionModule; }]]); + ->willReturn([0 => ['callback' => function () use ($encryptionModule) { return $encryptionModule; }]]); $this->config->method('getUserValue') ->with('ValidTokenUser', 'core', 'lostpassword', null) ->willReturn('encryptedData'); diff --git a/tests/acceptance/features/bootstrap/SettingsContext.php b/tests/acceptance/features/bootstrap/SettingsContext.php index 5f9a724e771..ccc010e38e9 100644 --- a/tests/acceptance/features/bootstrap/SettingsContext.php +++ b/tests/acceptance/features/bootstrap/SettingsContext.php @@ -204,7 +204,7 @@ class SettingsContext implements Context, ActorAwareInterface { $actor = $this->actor; - $tagFoundInDropdownCallback = function() use($actor, $tag) { + $tagFoundInDropdownCallback = function () use ($actor, $tag) { // Open the dropdown to look for the tag. $actor->find(self::systemTagsSelectTagButton())->click(); diff --git a/tests/acceptance/features/bootstrap/ThemingAppContext.php b/tests/acceptance/features/bootstrap/ThemingAppContext.php index 79d140b2694..e52c1c86b03 100644 --- a/tests/acceptance/features/bootstrap/ThemingAppContext.php +++ b/tests/acceptance/features/bootstrap/ThemingAppContext.php @@ -93,7 +93,7 @@ class ThemingAppContext implements Context, ActorAwareInterface { $actor = $this->actor; - $colorSelectorLoadedCallback = function() use($actor) { + $colorSelectorLoadedCallback = function () use ($actor) { $colorSelectorValue = $this->getRGBArray($actor->getSession()->evaluateScript("return $('#theming-color')[0].value;")); $inputBgColor = $this->getRGBArray($actor->getSession()->evaluateScript("return $('#theming-color').css('background-color');")); if ($colorSelectorValue == $inputBgColor) { @@ -108,7 +108,7 @@ class ThemingAppContext implements Context, ActorAwareInterface { } } - private function getRGBArray ($color) { + private function getRGBArray($color) { if (preg_match("/rgb\(\s*(\d+),\s*(\d+),\s*(\d+)\)/", $color, $matches)) { // Already an RGB (R, G, B) color // Convert from "rgb(R, G, B)" string to RGB array @@ -128,7 +128,7 @@ class ThemingAppContext implements Context, ActorAwareInterface { * @Then I see that the header color is eventually :color */ public function iSeeThatTheHeaderColorIsEventually($color) { - $headerColorMatchesCallback = function() use($color) { + $headerColorMatchesCallback = function () use ($color) { $headerColor = $this->actor->getSession()->evaluateScript("return $('#header').css('background-color');"); $headerColor = $this->getRGBArray($headerColor); $color = $this->getRGBArray($color); @@ -149,7 +149,7 @@ class ThemingAppContext implements Context, ActorAwareInterface { $actor = $this->actor; - $savedStatusMessageShownCallback = function() use($actor) { + $savedStatusMessageShownCallback = function () use ($actor) { if ($actor->find(self::statusMessage())->getText() !== "Saved") { return false; } diff --git a/tests/acceptance/features/bootstrap/WaitFor.php b/tests/acceptance/features/bootstrap/WaitFor.php index 038de3e42c2..0b79d023ee5 100644 --- a/tests/acceptance/features/bootstrap/WaitFor.php +++ b/tests/acceptance/features/bootstrap/WaitFor.php @@ -39,7 +39,7 @@ class WaitFor { * the timeout expires, false otherwise. */ public static function elementToBeEventuallyShown(Actor $actor, Locator $elementLocator, $timeout = 10, $timeoutStep = 1) { - $elementShownCallback = function() use ($actor, $elementLocator) { + $elementShownCallback = function () use ($actor, $elementLocator) { try { return $actor->find($elementLocator)->isVisible(); } catch (NoSuchElementException $exception) { @@ -64,7 +64,7 @@ class WaitFor { * the timeout expires, false otherwise. */ public static function elementToBeEventuallyNotShown(Actor $actor, Locator $elementLocator, $timeout = 10, $timeoutStep = 1) { - $elementNotShownCallback = function() use ($actor, $elementLocator) { + $elementNotShownCallback = function () use ($actor, $elementLocator) { try { return !$actor->find($elementLocator)->isVisible(); } catch (NoSuchElementException $exception) { diff --git a/tests/acceptance/features/core/ElementFinder.php b/tests/acceptance/features/core/ElementFinder.php index d075e9fe660..5570637aa96 100644 --- a/tests/acceptance/features/core/ElementFinder.php +++ b/tests/acceptance/features/core/ElementFinder.php @@ -56,7 +56,7 @@ class ElementFinder { $locator = $elementLocator->getLocator(); $ancestorElement = self::findAncestorElement($session, $elementLocator, $timeout, $timeoutStep); - $findCallback = function() use (&$element, $selector, $locator, $ancestorElement) { + $findCallback = function () use (&$element, $selector, $locator, $ancestorElement) { $element = $ancestorElement->find($selector, $locator); return $element !== null; diff --git a/tests/acceptance/features/core/ElementWrapper.php b/tests/acceptance/features/core/ElementWrapper.php index c866ea699fe..97b1b4bfbcd 100644 --- a/tests/acceptance/features/core/ElementWrapper.php +++ b/tests/acceptance/features/core/ElementWrapper.php @@ -141,7 +141,7 @@ class ElementWrapper { * @return bool true if the wrapped element is visible, false otherwise. */ public function isVisible() { - $commandCallback = function() { + $commandCallback = function () { return $this->element->isVisible(); }; return $this->executeCommand($commandCallback, "visibility could not be got"); @@ -153,7 +153,7 @@ class ElementWrapper { * @return bool true if the wrapped element is checked, false otherwise. */ public function isChecked() { - $commandCallback = function() { + $commandCallback = function () { return $this->element->isChecked(); }; return $this->executeCommand($commandCallback, "check state could not be got"); @@ -169,7 +169,7 @@ class ElementWrapper { * is not visible. */ public function getText() { - $commandCallback = function() { + $commandCallback = function () { return $this->element->getText(); }; return $this->executeCommand($commandCallback, "text could not be got"); @@ -183,7 +183,7 @@ class ElementWrapper { * @return string the value of the wrapped element. */ public function getValue() { - $commandCallback = function() { + $commandCallback = function () { return $this->element->getValue(); }; return $this->executeCommand($commandCallback, "value could not be got"); @@ -198,7 +198,7 @@ class ElementWrapper { * @param string $value the value to set. */ public function setValue($value) { - $commandCallback = function() use ($value) { + $commandCallback = function () use ($value) { $this->element->setValue($value); }; $this->executeCommandOnVisibleElement($commandCallback, "value could not be set"); @@ -211,7 +211,7 @@ class ElementWrapper { * timeout set when finding it). */ public function click() { - $commandCallback = function() { + $commandCallback = function () { $this->element->click(); }; $this->executeCommandOnVisibleElement($commandCallback, "could not be clicked"); @@ -224,7 +224,7 @@ class ElementWrapper { * timeout set when finding it). */ public function check() { - $commandCallback = function() { + $commandCallback = function () { $this->element->check(); }; $this->executeCommand($commandCallback, "could not be checked"); @@ -237,7 +237,7 @@ class ElementWrapper { * timeout set when finding it). */ public function uncheck() { - $commandCallback = function() { + $commandCallback = function () { $this->element->uncheck(); }; $this->executeCommand($commandCallback, "could not be unchecked"); @@ -325,7 +325,7 @@ class ElementWrapper { * otherwise. */ private function waitForElementToBeVisible() { - $isVisibleCallback = function() { + $isVisibleCallback = function () { return $this->isVisible(); }; $timeout = $this->elementFinder->getTimeout(); diff --git a/tests/acceptance/features/core/Utils.php b/tests/acceptance/features/core/Utils.php index 86b7515e4c6..f81542eb079 100644 --- a/tests/acceptance/features/core/Utils.php +++ b/tests/acceptance/features/core/Utils.php @@ -71,7 +71,7 @@ class Utils { * @return boolean true if the server was found, false otherwise. */ public static function waitForServer($url, $timeout, $timeoutStep = 0.5) { - $isServerUpCallback = function() use ($url) { + $isServerUpCallback = function () use ($url) { $curlHandle = curl_init($url); // Returning the transfer as the result of curl_exec prevents the diff --git a/tests/lib/Activity/ManagerTest.php b/tests/lib/Activity/ManagerTest.php index 1f616e062b7..98f36572c4a 100644 --- a/tests/lib/Activity/ManagerTest.php +++ b/tests/lib/Activity/ManagerTest.php @@ -61,7 +61,7 @@ class ManagerTest extends TestCase { $this->assertSame([], self::invokePrivate($this->activityManager, 'getConsumers')); - $this->activityManager->registerConsumer(function() { + $this->activityManager->registerConsumer(function () { return new NoOpConsumer(); }); @@ -79,7 +79,7 @@ class ManagerTest extends TestCase { public function testGetConsumersInvalidConsumer() { $this->expectException(\InvalidArgumentException::class); - $this->activityManager->registerConsumer(function() { + $this->activityManager->registerConsumer(function () { return new \stdClass(); }); @@ -240,7 +240,7 @@ class ManagerTest extends TestCase { $consumer->expects($this->once()) ->method('receive') ->with($event) - ->willReturnCallback(function(\OCP\Activity\IEvent $event) use ($expected) { + ->willReturnCallback(function (\OCP\Activity\IEvent $event) use ($expected) { $this->assertLessThanOrEqual(time() + 2, $event->getTimestamp(), 'Timestamp not set correctly'); $this->assertGreaterThanOrEqual(time() - 2, $event->getTimestamp(), 'Timestamp not set correctly'); $this->assertSame($expected, $event->getAuthor(), 'Author name not set correctly'); @@ -270,7 +270,7 @@ class ManagerTest extends TestCase { ->getMock(); $consumer->expects($this->once()) ->method('receive') - ->willReturnCallback(function(\OCP\Activity\IEvent $event) { + ->willReturnCallback(function (\OCP\Activity\IEvent $event) { $this->assertSame('test_app', $event->getApp(), 'App not set correctly'); $this->assertSame('test_type', $event->getType(), 'Type not set correctly'); $this->assertSame('test_affected', $event->getAffectedUser(), 'Affected user not set correctly'); diff --git a/tests/lib/App/AppManagerTest.php b/tests/lib/App/AppManagerTest.php index 56a20a14300..1a5d6c648a1 100644 --- a/tests/lib/App/AppManagerTest.php +++ b/tests/lib/App/AppManagerTest.php @@ -465,7 +465,7 @@ class AppManagerTest extends TestCase { $manager->expects($this->any()) ->method('getAppInfo') ->willReturnCallback( - function($appId) use ($appInfos) { + function ($appId) use ($appInfos) { return $appInfos[$appId]; } ); @@ -514,7 +514,7 @@ class AppManagerTest extends TestCase { $manager->expects($this->any()) ->method('getAppInfo') ->willReturnCallback( - function($appId) use ($appInfos) { + function ($appId) use ($appInfos) { return $appInfos[$appId]; } ); diff --git a/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php b/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php index a381175b0a6..9b772ca5bfc 100644 --- a/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php +++ b/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php @@ -1863,7 +1863,7 @@ EJL3BaQAQaASSsvFrcozYxrQG4VzEg== public function testGetWithFilter() { $this->config->method('getSystemValue') - ->willReturnCallback(function($key, $default) { + ->willReturnCallback(function ($key, $default) { if ($key === 'appstoreenabled') { return true; } else if ($key === 'version') { @@ -1946,7 +1946,7 @@ EJL3BaQAQaASSsvFrcozYxrQG4VzEg== public function testAppstoreDisabled() { $this->config ->method('getSystemValue') - ->willReturnCallback(function($var, $default) { + ->willReturnCallback(function ($var, $default) { if ($var === 'appstoreenabled') { return false; } else if ($var === 'version') { @@ -1965,7 +1965,7 @@ EJL3BaQAQaASSsvFrcozYxrQG4VzEg== public function testNoInternet() { $this->config ->method('getSystemValue') - ->willReturnCallback(function($var, $default) { + ->willReturnCallback(function ($var, $default) { if ($var === 'has_internet_connection') { return false; } else if ($var === 'version') { @@ -1982,7 +1982,7 @@ EJL3BaQAQaASSsvFrcozYxrQG4VzEg== public function testSetVersion() { $this->config->method('getSystemValue') - ->willReturnCallback(function($key, $default) { + ->willReturnCallback(function ($key, $default) { if ($key === 'appstoreenabled') { return true; } else if ($key === 'version') { diff --git a/tests/lib/App/AppStore/Fetcher/CategoryFetcherTest.php b/tests/lib/App/AppStore/Fetcher/CategoryFetcherTest.php index 22e7a8742ec..47be7adcc7b 100644 --- a/tests/lib/App/AppStore/Fetcher/CategoryFetcherTest.php +++ b/tests/lib/App/AppStore/Fetcher/CategoryFetcherTest.php @@ -41,7 +41,7 @@ class CategoryFetcherTest extends FetcherBase { public function testAppstoreDisabled() { $this->config ->method('getSystemValue') - ->willReturnCallback(function($var, $default) { + ->willReturnCallback(function ($var, $default) { if ($var === 'appstoreenabled') { return false; } @@ -57,7 +57,7 @@ class CategoryFetcherTest extends FetcherBase { public function testNoInternet() { $this->config ->method('getSystemValue') - ->willReturnCallback(function($var, $default) { + ->willReturnCallback(function ($var, $default) { if ($var === 'has_internet_connection') { return false; } diff --git a/tests/lib/App/AppStore/Fetcher/FetcherBase.php b/tests/lib/App/AppStore/Fetcher/FetcherBase.php index 9dac4dd7499..11813c7f3bd 100644 --- a/tests/lib/App/AppStore/Fetcher/FetcherBase.php +++ b/tests/lib/App/AppStore/Fetcher/FetcherBase.php @@ -210,7 +210,7 @@ abstract class FetcherBase extends TestCase { public function testGetWithAlreadyExistingFileAndOutdatedTimestamp() { $this->config->method('getSystemValue') - ->willReturnCallback(function($key, $default) { + ->willReturnCallback(function ($key, $default) { if ($key === 'appstoreenabled') { return true; } else if ($key === 'version') { @@ -463,7 +463,7 @@ abstract class FetcherBase extends TestCase { public function testGetWithExceptionInClient() { $this->config->method('getSystemValue') - ->willReturnCallback(function($key, $default) { + ->willReturnCallback(function ($key, $default) { if ($key === 'appstoreenabled') { return true; } else { @@ -503,7 +503,7 @@ abstract class FetcherBase extends TestCase { public function testGetMatchingETag() { $this->config->method('getSystemValue') - ->willReturnCallback(function($key, $default) { + ->willReturnCallback(function ($key, $default) { if ($key === 'appstoreenabled') { return true; } else if ($key === 'version') { @@ -584,7 +584,7 @@ abstract class FetcherBase extends TestCase { public function testGetNoMatchingETag() { $this->config->method('getSystemValue') - ->willReturnCallback(function($key, $default) { + ->willReturnCallback(function ($key, $default) { if ($key === 'appstoreenabled') { return true; } else if ($key === 'version') { @@ -671,7 +671,7 @@ abstract class FetcherBase extends TestCase { public function testFetchAfterUpgradeNoETag() { $this->config->method('getSystemValue') - ->willReturnCallback(function($key, $default) { + ->willReturnCallback(function ($key, $default) { if ($key === 'appstoreenabled') { return true; } else if ($key === 'version') { diff --git a/tests/lib/App/DependencyAnalyzerTest.php b/tests/lib/App/DependencyAnalyzerTest.php index 52965d4a72d..9ac44b97cc5 100644 --- a/tests/lib/App/DependencyAnalyzerTest.php +++ b/tests/lib/App/DependencyAnalyzerTest.php @@ -44,12 +44,12 @@ class DependencyAnalyzerTest extends TestCase { ->willReturn( 'Linux'); $this->platformMock->expects($this->any()) ->method('isCommandKnown') - ->willReturnCallback( function($command) { + ->willReturnCallback( function ($command) { return ($command === 'grep'); }); $this->platformMock->expects($this->any()) ->method('getLibraryVersion') - ->willReturnCallback( function($lib) { + ->willReturnCallback( function ($lib) { if ($lib === 'curl') { return "2.3.4"; } @@ -64,7 +64,7 @@ class DependencyAnalyzerTest extends TestCase { ->getMock(); $this->l10nMock->expects($this->any()) ->method('t') - ->willReturnCallback(function($text, $parameters = []) { + ->willReturnCallback(function ($text, $parameters = []) { return vsprintf($text, $parameters); }); 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'); diff --git a/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php b/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php index c9dc3d6ef4a..357200e24b4 100644 --- a/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php +++ b/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php @@ -285,7 +285,7 @@ class PublicKeyTokenProviderTest extends TestCase { $this->mapper ->expects($this->at(2)) ->method('delete') - ->with($this->callback(function($token) use ($oldToken) { + ->with($this->callback(function ($token) use ($oldToken) { return $token === $oldToken; })); @@ -325,7 +325,7 @@ class PublicKeyTokenProviderTest extends TestCase { $this->mapper ->expects($this->at(2)) ->method('delete') - ->with($this->callback(function($token) use ($oldToken) { + ->with($this->callback(function ($token) use ($oldToken) { return $token === $oldToken; })); diff --git a/tests/lib/Authentication/TwoFactorAuth/MandatoryTwoFactorTest.php b/tests/lib/Authentication/TwoFactorAuth/MandatoryTwoFactorTest.php index 92d072608f2..e1e401e7683 100644 --- a/tests/lib/Authentication/TwoFactorAuth/MandatoryTwoFactorTest.php +++ b/tests/lib/Authentication/TwoFactorAuth/MandatoryTwoFactorTest.php @@ -109,7 +109,7 @@ class MandatoryTwoFactorTest extends TestCase { ['twofactor_enforced_excluded_groups', [], []], ]); $this->groupManager->method('isInGroup') - ->willReturnCallback(function($user, $group) { + ->willReturnCallback(function ($user, $group) { return $user === 'user123' && $group ==='twofactorers'; }); @@ -147,7 +147,7 @@ class MandatoryTwoFactorTest extends TestCase { ['twofactor_enforced_excluded_groups', [], ['yoloers']], ]); $this->groupManager->method('isInGroup') - ->willReturnCallback(function($user, $group) { + ->willReturnCallback(function ($user, $group) { return $user === 'user123' && $group ==='yoloers'; }); diff --git a/tests/lib/Authentication/TwoFactorAuth/RegistryTest.php b/tests/lib/Authentication/TwoFactorAuth/RegistryTest.php index 6a5ba83dc8b..5b2aa654f11 100644 --- a/tests/lib/Authentication/TwoFactorAuth/RegistryTest.php +++ b/tests/lib/Authentication/TwoFactorAuth/RegistryTest.php @@ -81,7 +81,7 @@ class RegistryTest extends TestCase { ->method('dispatch') ->with( $this->equalTo(IRegistry::EVENT_PROVIDER_ENABLED), - $this->callback(function(RegistryEvent $e) use ($user, $provider) { + $this->callback(function (RegistryEvent $e) use ($user, $provider) { return $e->getUser() === $user && $e->getProvider() === $provider; }) ); @@ -102,7 +102,7 @@ class RegistryTest extends TestCase { ->method('dispatch') ->with( $this->equalTo(IRegistry::EVENT_PROVIDER_DISABLED), - $this->callback(function(RegistryEvent $e) use ($user, $provider) { + $this->callback(function (RegistryEvent $e) use ($user, $provider) { return $e->getUser() === $user && $e->getProvider() === $provider; }) ); diff --git a/tests/lib/Avatar/UserAvatarTest.php b/tests/lib/Avatar/UserAvatarTest.php index b93c4112af5..d3e36954cee 100644 --- a/tests/lib/Avatar/UserAvatarTest.php +++ b/tests/lib/Avatar/UserAvatarTest.php @@ -57,13 +57,13 @@ class UserAvatarTest extends \Test\TestCase { ->willReturn($file); $this->folder->method('getFile') - ->willReturnCallback(function($path) { + ->willReturnCallback(function ($path) { if ($path === 'avatar.64.png') { throw new NotFoundException(); } }); $this->folder->method('fileExists') - ->willReturnCallback(function($path) { + ->willReturnCallback(function ($path) { if ($path === 'generated') { return true; } @@ -134,7 +134,7 @@ class UserAvatarTest extends \Test\TestCase { $this->folder->method('getFile') ->willReturnCallback( - function($path) use ($file) { + function ($path) use ($file) { if ($path === 'avatar.png') { return $file; } else { diff --git a/tests/lib/CapabilitiesManagerTest.php b/tests/lib/CapabilitiesManagerTest.php index e7d519a7493..536355f9697 100644 --- a/tests/lib/CapabilitiesManagerTest.php +++ b/tests/lib/CapabilitiesManagerTest.php @@ -53,7 +53,7 @@ class CapabilitiesManagerTest extends TestCase { * Test a valid capabilitie */ public function testValidCapability() { - $this->manager->registerCapability(function() { + $this->manager->registerCapability(function () { return new SimpleCapability(); }); @@ -65,13 +65,13 @@ class CapabilitiesManagerTest extends TestCase { * Test a public capabilitie */ public function testPublicCapability() { - $this->manager->registerCapability(function() { + $this->manager->registerCapability(function () { return new PublicSimpleCapability1(); }); - $this->manager->registerCapability(function() { + $this->manager->registerCapability(function () { return new SimpleCapability2(); }); - $this->manager->registerCapability(function() { + $this->manager->registerCapability(function () { return new SimpleCapability3(); }); @@ -86,7 +86,7 @@ class CapabilitiesManagerTest extends TestCase { $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('The given Capability (Test\\NoCapability) does not implement the ICapability interface'); - $this->manager->registerCapability(function() { + $this->manager->registerCapability(function () { return new NoCapability(); }); @@ -98,13 +98,13 @@ class CapabilitiesManagerTest extends TestCase { * Test a bunch of merged Capabilities */ public function testMergedCapabilities() { - $this->manager->registerCapability(function() { + $this->manager->registerCapability(function () { return new SimpleCapability(); }); - $this->manager->registerCapability(function() { + $this->manager->registerCapability(function () { return new SimpleCapability2(); }); - $this->manager->registerCapability(function() { + $this->manager->registerCapability(function () { return new SimpleCapability3(); }); @@ -124,10 +124,10 @@ class CapabilitiesManagerTest extends TestCase { * Test deep identical capabilities */ public function testDeepIdenticalCapabilities() { - $this->manager->registerCapability(function() { + $this->manager->registerCapability(function () { return new DeepCapability(); }); - $this->manager->registerCapability(function() { + $this->manager->registerCapability(function () { return new DeepCapability(); }); diff --git a/tests/lib/Collaboration/Collaborators/GroupPluginTest.php b/tests/lib/Collaboration/Collaborators/GroupPluginTest.php index e53fb290d0e..b4a9b3d0955 100644 --- a/tests/lib/Collaboration/Collaborators/GroupPluginTest.php +++ b/tests/lib/Collaboration/Collaborators/GroupPluginTest.php @@ -459,8 +459,7 @@ class GroupPluginTest extends TestCase { $this->config->expects($this->any()) ->method('getAppValue') ->willReturnCallback( - function($appName, $key, $default) - use ($shareWithGroupOnly, $shareeEnumeration) + function ($appName, $key, $default) use ($shareWithGroupOnly, $shareeEnumeration) { if ($appName === 'core' && $key === 'shareapi_only_share_with_group_members') { return $shareWithGroupOnly ? 'yes' : 'no'; diff --git a/tests/lib/Collaboration/Collaborators/MailPluginTest.php b/tests/lib/Collaboration/Collaborators/MailPluginTest.php index 934c6bc68e6..5a690393d6c 100644 --- a/tests/lib/Collaboration/Collaborators/MailPluginTest.php +++ b/tests/lib/Collaboration/Collaborators/MailPluginTest.php @@ -86,8 +86,7 @@ class MailPluginTest extends TestCase { $this->config->expects($this->any()) ->method('getAppValue') ->willReturnCallback( - function($appName, $key, $default) - use ($shareeEnumeration) + function ($appName, $key, $default) use ($shareeEnumeration) { if ($appName === 'core' && $key === 'shareapi_allow_share_dialog_user_enumeration') { return $shareeEnumeration ? 'yes' : 'no'; @@ -534,7 +533,7 @@ class MailPluginTest extends TestCase { $this->config->expects($this->any()) ->method('getAppValue') ->willReturnCallback( - function($appName, $key, $default) { + function ($appName, $key, $default) { if ($appName === 'core' && $key === 'shareapi_allow_share_dialog_user_enumeration') { return 'yes'; } else if ($appName === 'core' && $key === 'shareapi_only_share_with_group_members') { @@ -564,13 +563,13 @@ class MailPluginTest extends TestCase { $this->groupManager->expects($this->any()) ->method('getUserGroupIds') - ->willReturnCallback(function(\OCP\IUser $user) use ($userToGroupMapping) { + ->willReturnCallback(function (\OCP\IUser $user) use ($userToGroupMapping) { return $userToGroupMapping[$user->getUID()]; }); $this->groupManager->expects($this->any()) ->method('isInGroup') - ->willReturnCallback(function($userId, $group) use ($userToGroupMapping) { + ->willReturnCallback(function ($userId, $group) use ($userToGroupMapping) { return in_array($group, $userToGroupMapping[$userId]); }); diff --git a/tests/lib/Collaboration/Collaborators/RemotePluginTest.php b/tests/lib/Collaboration/Collaborators/RemotePluginTest.php index 30ee7092aa9..d85fadad408 100644 --- a/tests/lib/Collaboration/Collaborators/RemotePluginTest.php +++ b/tests/lib/Collaboration/Collaborators/RemotePluginTest.php @@ -92,8 +92,7 @@ class RemotePluginTest extends TestCase { $this->config->expects($this->any()) ->method('getAppValue') ->willReturnCallback( - function($appName, $key, $default) - use ($shareeEnumeration) + function ($appName, $key, $default) use ($shareeEnumeration) { if ($appName === 'core' && $key === 'shareapi_allow_share_dialog_user_enumeration') { return $shareeEnumeration ? 'yes' : 'no'; diff --git a/tests/lib/Collaboration/Collaborators/SearchTest.php b/tests/lib/Collaboration/Collaborators/SearchTest.php index 5a78e084da8..521ea0737ed 100644 --- a/tests/lib/Collaboration/Collaborators/SearchTest.php +++ b/tests/lib/Collaboration/Collaborators/SearchTest.php @@ -75,7 +75,7 @@ class SearchTest extends TestCase { $userPlugin = $this->createMock(ISearchPlugin::class); $userPlugin->expects($this->any()) ->method('search') - ->willReturnCallback(function() use ($searchResult, $mockedUserResult, $expectedMoreResults) { + ->willReturnCallback(function () use ($searchResult, $mockedUserResult, $expectedMoreResults) { $type = new SearchResultType('users'); $searchResult->addResultSet($type, $mockedUserResult); return $expectedMoreResults; @@ -84,7 +84,7 @@ class SearchTest extends TestCase { $groupPlugin = $this->createMock(ISearchPlugin::class); $groupPlugin->expects($this->any()) ->method('search') - ->willReturnCallback(function() use ($searchResult, $mockedGroupsResult, $expectedMoreResults) { + ->willReturnCallback(function () use ($searchResult, $mockedGroupsResult, $expectedMoreResults) { $type = new SearchResultType('groups'); $searchResult->addResultSet($type, $mockedGroupsResult); return $expectedMoreResults; @@ -93,7 +93,7 @@ class SearchTest extends TestCase { $remotePlugin = $this->createMock(ISearchPlugin::class); $remotePlugin->expects($this->any()) ->method('search') - ->willReturnCallback(function() use ($searchResult, $mockedRemotesResult, $expectedMoreResults) { + ->willReturnCallback(function () use ($searchResult, $mockedRemotesResult, $expectedMoreResults) { if($mockedRemotesResult !== null) { $type = new SearchResultType('remotes'); $searchResult->addResultSet($type, $mockedRemotesResult['results'], $mockedRemotesResult['exact']); @@ -106,7 +106,7 @@ class SearchTest extends TestCase { $this->container->expects($this->any()) ->method('resolve') - ->willReturnCallback(function($class) use ($searchResult, $userPlugin, $groupPlugin, $remotePlugin) { + ->willReturnCallback(function ($class) use ($searchResult, $userPlugin, $groupPlugin, $remotePlugin) { if($class === SearchResult::class) { return $searchResult; } elseif ($class === $userPlugin) { diff --git a/tests/lib/Collaboration/Collaborators/UserPluginTest.php b/tests/lib/Collaboration/Collaborators/UserPluginTest.php index f279ada254b..bacf68f652e 100644 --- a/tests/lib/Collaboration/Collaborators/UserPluginTest.php +++ b/tests/lib/Collaboration/Collaborators/UserPluginTest.php @@ -94,8 +94,7 @@ class UserPluginTest extends TestCase { $this->config->expects($this->any()) ->method('getAppValue') ->willReturnCallback( - function ($appName, $key, $default) - use ($shareWithGroupOnly, $shareeEnumeration, $shareeEnumerationLimitToGroup) { + function ($appName, $key, $default) use ($shareWithGroupOnly, $shareeEnumeration, $shareeEnumerationLimitToGroup) { if ($appName === 'core' && $key === 'shareapi_only_share_with_group_members') { return $shareWithGroupOnly ? 'yes' : 'no'; } else if ($appName === 'core' && $key === 'shareapi_allow_share_dialog_user_enumeration') { diff --git a/tests/lib/Comments/CommentTest.php b/tests/lib/Comments/CommentTest.php index bd58d3fb156..686c2bcd19e 100644 --- a/tests/lib/Comments/CommentTest.php +++ b/tests/lib/Comments/CommentTest.php @@ -112,7 +112,7 @@ class CommentTest extends TestCase { /** * @dataProvider roleSetterProvider */ - public function testSetRoleInvalidInput($role, $type, $id){ + public function testSetRoleInvalidInput($role, $type, $id) { $this->expectException(\InvalidArgumentException::class); $comment = new Comment(); diff --git a/tests/lib/Comments/ManagerTest.php b/tests/lib/Comments/ManagerTest.php index 1700af797fe..9ae49d62f33 100644 --- a/tests/lib/Comments/ManagerTest.php +++ b/tests/lib/Comments/ManagerTest.php @@ -378,7 +378,7 @@ class ManagerTest extends TestCase { $expected = array_reverse($expected); } - $this->assertSame($expected, array_map(function(IComment $c) { + $this->assertSame($expected, array_map(function (IComment $c) { return (int) $c->getId(); }, $comments)); } diff --git a/tests/lib/ContactsManagerTest.php b/tests/lib/ContactsManagerTest.php index 5437ca3fbaf..099f27ce07b 100644 --- a/tests/lib/ContactsManagerTest.php +++ b/tests/lib/ContactsManagerTest.php @@ -14,7 +14,7 @@ class ContactsManagerTest extends \Test\TestCase { $this->cm = new \OC\ContactsManager(); } - public function searchProvider(){ + public function searchProvider() { $search1 = [ 0 => [ 'N' => [0 => '', 1 => 'Jan', 2 => 'Jansen', 3 => '', 4 => '',], @@ -62,7 +62,7 @@ class ContactsManagerTest extends \Test\TestCase { /** * @dataProvider searchProvider */ - public function testSearch($search1, $search2, $expectedResult ){ + public function testSearch($search1, $search2, $expectedResult) { /** @var \PHPUnit_Framework_MockObject_MockObject|IAddressBook $addressbook */ $addressbook1 = $this->getMockBuilder('\OCP\IAddressBook') ->disableOriginalConstructor() @@ -96,7 +96,7 @@ class ContactsManagerTest extends \Test\TestCase { } - public function testDeleteHavePermission(){ + public function testDeleteHavePermission() { /** @var \PHPUnit_Framework_MockObject_MockObject|IAddressBook $addressbook */ $addressbook = $this->getMockBuilder('\OCP\IAddressBook') ->disableOriginalConstructor() @@ -116,7 +116,7 @@ class ContactsManagerTest extends \Test\TestCase { $this->assertEquals($result, 'returnMe'); } - public function testDeleteNoPermission(){ + public function testDeleteNoPermission() { /** @var \PHPUnit_Framework_MockObject_MockObject|IAddressBook $addressbook */ $addressbook = $this->getMockBuilder('\OCP\IAddressBook') ->disableOriginalConstructor() @@ -134,7 +134,7 @@ class ContactsManagerTest extends \Test\TestCase { $this->assertEquals($result, null); } - public function testDeleteNoAddressbook(){ + public function testDeleteNoAddressbook() { /** @var \PHPUnit_Framework_MockObject_MockObject|IAddressBook $addressbook */ $addressbook = $this->getMockBuilder('\OCP\IAddressBook') ->disableOriginalConstructor() @@ -149,7 +149,7 @@ class ContactsManagerTest extends \Test\TestCase { } - public function testCreateOrUpdateHavePermission(){ + public function testCreateOrUpdateHavePermission() { /** @var \PHPUnit_Framework_MockObject_MockObject|IAddressBook $addressbook */ $addressbook = $this->getMockBuilder('\OCP\IAddressBook') ->disableOriginalConstructor() @@ -168,7 +168,7 @@ class ContactsManagerTest extends \Test\TestCase { $this->assertEquals($result, 'returnMe'); } - public function testCreateOrUpdateNoPermission(){ + public function testCreateOrUpdateNoPermission() { /** @var \PHPUnit_Framework_MockObject_MockObject|IAddressBook $addressbook */ $addressbook = $this->getMockBuilder('\OCP\IAddressBook') ->disableOriginalConstructor() @@ -187,7 +187,7 @@ class ContactsManagerTest extends \Test\TestCase { } - public function testCreateOrUpdateNOAdressbook(){ + public function testCreateOrUpdateNOAdressbook() { /** @var \PHPUnit_Framework_MockObject_MockObject|IAddressBook $addressbook */ $addressbook = $this->getMockBuilder('\OCP\IAddressBook') ->disableOriginalConstructor() @@ -201,12 +201,12 @@ class ContactsManagerTest extends \Test\TestCase { $this->assertEquals($result, null); } - public function testIsEnabledIfNot(){ + public function testIsEnabledIfNot() { $result = $this->cm->isEnabled(); $this->assertFalse($result); } - public function testIsEnabledIfSo(){ + public function testIsEnabledIfSo() { /** @var \PHPUnit_Framework_MockObject_MockObject|IAddressBook $addressbook */ $addressbook = $this->getMockBuilder('\OCP\IAddressBook') ->disableOriginalConstructor() diff --git a/tests/lib/Encryption/DecryptAllTest.php b/tests/lib/Encryption/DecryptAllTest.php index 2c8cc2a4ac9..8e53c4a92e1 100644 --- a/tests/lib/Encryption/DecryptAllTest.php +++ b/tests/lib/Encryption/DecryptAllTest.php @@ -177,7 +177,7 @@ class DecryptAllTest extends TestCase { ->with($this->inputInterface, $this->outputInterface, $user) ->willReturn($success); - $callback = function() use ($dummyEncryptionModule) {return $dummyEncryptionModule;}; + $callback = function () use ($dummyEncryptionModule) {return $dummyEncryptionModule;}; $moduleDescription = [ 'id' => 'id', 'displayName' => 'displayName', @@ -283,7 +283,7 @@ class DecryptAllTest extends TestCase { $this->view->expects($this->any())->method('is_dir') ->willReturnCallback( - function($path) { + function ($path) { if ($path === '/user1/files/foo') { return true; } @@ -379,7 +379,7 @@ class DecryptAllTest extends TestCase { $this->view->expects($this->once()) ->method('copy') ->with($path, $path . '.decrypted.42') - ->willReturnCallback(function() { throw new DecryptionFailedException();}); + ->willReturnCallback(function () { throw new DecryptionFailedException();}); $this->view->expects($this->never())->method('rename'); $this->view->expects($this->once()) diff --git a/tests/lib/Encryption/Keys/StorageTest.php b/tests/lib/Encryption/Keys/StorageTest.php index 7e21fe881fc..2233c25c8f1 100644 --- a/tests/lib/Encryption/Keys/StorageTest.php +++ b/tests/lib/Encryption/Keys/StorageTest.php @@ -338,7 +338,7 @@ class StorageTest extends TestCase { ->willReturnCallback([$this, 'getUidAndFilenameCallback']); $this->util->expects($this->any()) ->method('isSystemWideMountPoint') - ->willReturnCallback(function($path, $owner) use ($systemWideMountSource, $systemWideMountTarget) { + ->willReturnCallback(function ($path, $owner) use ($systemWideMountSource, $systemWideMountTarget) { if(strpos($path, 'source.txt') !== false) { return $systemWideMountSource; } @@ -369,7 +369,7 @@ class StorageTest extends TestCase { ->willReturnCallback([$this, 'getUidAndFilenameCallback']); $this->util->expects($this->any()) ->method('isSystemWideMountPoint') - ->willReturnCallback(function($path, $owner) use ($systemWideMountSource, $systemWideMountTarget) { + ->willReturnCallback(function ($path, $owner) use ($systemWideMountSource, $systemWideMountTarget) { if(strpos($path, 'source.txt') !== false) { return $systemWideMountSource; } diff --git a/tests/lib/Encryption/ManagerTest.php b/tests/lib/Encryption/ManagerTest.php index 6e18cd296a3..5a34e9cb392 100644 --- a/tests/lib/Encryption/ManagerTest.php +++ b/tests/lib/Encryption/ManagerTest.php @@ -60,7 +60,7 @@ class ManagerTest extends TestCase { $em = $this->createMock(IEncryptionModule::class); $em->expects($this->any())->method('getId')->willReturn('id'); $em->expects($this->any())->method('getDisplayName')->willReturn('TestDummyModule0'); - $this->manager->registerEncryptionModule('id', 'TestDummyModule0', function() use ($em) {return $em;}); + $this->manager->registerEncryptionModule('id', 'TestDummyModule0', function () use ($em) {return $em;}); $this->assertFalse($this->manager->isEnabled()); } @@ -117,7 +117,7 @@ class ManagerTest extends TestCase { $this->config->expects($this->any()) ->method('getAppValue') ->with('core', 'default_encryption_module') - ->willReturnCallback(function() { global $defaultId; return $defaultId; }); + ->willReturnCallback(function () { global $defaultId; return $defaultId; }); $this->addNewEncryptionModule($this->manager, 0); $this->assertCount(1, $this->manager->getEncryptionModules()); @@ -138,7 +138,7 @@ class ManagerTest extends TestCase { $this->config->expects($this->any()) ->method('getAppValue') ->with('core', 'default_encryption_module') - ->willReturnCallback(function() { global $defaultId; return $defaultId; }); + ->willReturnCallback(function () { global $defaultId; return $defaultId; }); $this->addNewEncryptionModule($this->manager, 0); $defaultId = 'ID0'; @@ -160,7 +160,7 @@ class ManagerTest extends TestCase { $this->config->expects($this->any()) ->method('getAppValue') ->with('core', 'default_encryption_module') - ->willReturnCallback(function() { global $defaultId; return $defaultId; }); + ->willReturnCallback(function () { global $defaultId; return $defaultId; }); $this->addNewEncryptionModule($this->manager, 0); $this->assertCount(1, $this->manager->getEncryptionModules()); @@ -251,7 +251,7 @@ class ManagerTest extends TestCase { ->method('getDisplayName') ->willReturn('TestDummyModule' . $id); /** @var \OCP\Encryption\IEncryptionModule $encryptionModule */ - $manager->registerEncryptionModule('ID' . $id, 'TestDummyModule' . $id, function() use ($encryptionModule) { + $manager->registerEncryptionModule('ID' . $id, 'TestDummyModule' . $id, function () use ($encryptionModule) { return $encryptionModule; }); } diff --git a/tests/lib/Encryption/UpdateTest.php b/tests/lib/Encryption/UpdateTest.php index 4509a1f5fec..a783c620a5b 100644 --- a/tests/lib/Encryption/UpdateTest.php +++ b/tests/lib/Encryption/UpdateTest.php @@ -147,7 +147,7 @@ class UpdateTest extends TestCase { } else { $updateMock->expects($this->once()) ->method('getOwnerPath') - ->willReturnCallback(function($path) use ($target) { + ->willReturnCallback(function ($path) use ($target) { $this->assertSame( $target, $path, diff --git a/tests/lib/Files/Cache/QuerySearchHelperTest.php b/tests/lib/Files/Cache/QuerySearchHelperTest.php index d5aad09a8fb..464561681d0 100644 --- a/tests/lib/Files/Cache/QuerySearchHelperTest.php +++ b/tests/lib/Files/Cache/QuerySearchHelperTest.php @@ -200,7 +200,7 @@ class QuerySearchHelperTest extends TestCase { 'mimetype' => 'image/png' ]); - $fileIds = array_map(function($i) use ($fileId) { + $fileIds = array_map(function ($i) use ($fileId) { return $fileId[$i]; }, $fileIds); diff --git a/tests/lib/Files/FilesystemTest.php b/tests/lib/Files/FilesystemTest.php index d98256501b1..39545b542e7 100644 --- a/tests/lib/Files/FilesystemTest.php +++ b/tests/lib/Files/FilesystemTest.php @@ -46,7 +46,7 @@ class DummyMountProvider implements IMountProvider { * @param IStorageFactory $loader * @return \OCP\Files\Mount\IMountPoint[] */ - public function getMountsForUser(IUser $user, IStorageFactory $loader) { + public function getMountsForUser(IUser $user, IStorageFactory $loader) { return isset($this->mounts[$user->getUID()]) ? $this->mounts[$user->getUID()] : []; } } diff --git a/tests/lib/Files/Mount/MountPointTest.php b/tests/lib/Files/Mount/MountPointTest.php index 800b360415a..976ccc64d70 100644 --- a/tests/lib/Files/Mount/MountPointTest.php +++ b/tests/lib/Files/Mount/MountPointTest.php @@ -51,7 +51,7 @@ class MountPointTest extends \Test\TestCase { ->will($this->throwException(new \Exception('Test storage init exception'))); $called = false; - $wrapper = function($mountPoint, $storage) use ($called) { + $wrapper = function ($mountPoint, $storage) use ($called) { $called = true; }; diff --git a/tests/lib/Files/Storage/Wrapper/EncryptionTest.php b/tests/lib/Files/Storage/Wrapper/EncryptionTest.php index ac3880309c0..c50015483fb 100644 --- a/tests/lib/Files/Storage/Wrapper/EncryptionTest.php +++ b/tests/lib/Files/Storage/Wrapper/EncryptionTest.php @@ -174,7 +174,7 @@ class EncryptionTest extends Storage { ->disableOriginalConstructor()->getMock(); $this->cache->expects($this->any()) ->method('get') - ->willReturnCallback(function($path) {return ['encrypted' => false, 'path' => $path];}); + ->willReturnCallback(function ($path) {return ['encrypted' => false, 'path' => $path];}); $this->mountManager = $this->createMock(\OC\Files\Mount\Manager::class); $this->mountManager->method('findByStorageId') @@ -253,7 +253,7 @@ class EncryptionTest extends Storage { $cache->expects($this->any()) ->method('get') ->willReturnCallback( - function($path) use ($encrypted) { + function ($path) use ($encrypted) { return ['encrypted' => $encrypted, 'path' => $path, 'size' => 0, 'fileid' => 1]; } ); @@ -387,7 +387,7 @@ class EncryptionTest extends Storage { $this->instance->expects($this->any())->method('fixUnencryptedSize') ->with('/test.txt', $encryptedSize, $unencryptedSize) ->willReturnCallback( - function() use ($failure, $expected) { + function () use ($failure, $expected) { if ($failure) { throw new \Exception(); } else { @@ -645,7 +645,7 @@ class EncryptionTest extends Storage { ->disableOriginalConstructor()->getMock(); $cache->expects($this->any()) ->method('get') - ->willReturnCallback(function($path) use ($isEncrypted) {return ['encrypted' => $isEncrypted, 'path' => $path];}); + ->willReturnCallback(function ($path) use ($isEncrypted) {return ['encrypted' => $isEncrypted, 'path' => $path];}); $instance = $this->getMockBuilder('\OC\Files\Storage\Wrapper\Encryption') ->setConstructorArgs( @@ -737,7 +737,7 @@ class EncryptionTest extends Storage { $storage2->expects($this->any()) ->method('fopen') - ->willReturnCallback(function($path, $mode) { + ->willReturnCallback(function ($path, $mode) { $temp = \OC::$server->getTempManager(); return fopen($temp->getTemporaryFile(), $mode); }); @@ -786,7 +786,7 @@ class EncryptionTest extends Storage { $storage2->expects($this->any()) ->method('fopen') - ->willReturnCallback(function($path, $mode) { + ->willReturnCallback(function ($path, $mode) { $temp = \OC::$server->getTempManager(); return fopen($temp->getTemporaryFile(), $mode); }); @@ -839,7 +839,7 @@ class EncryptionTest extends Storage { * @param bool $copyResult * @param bool $encrypted */ - public function testCopyBetweenStorageVersions($sourceInternalPath, $targetInternalPath, $copyResult, $encrypted) { + public function testCopyBetweenStorageVersions($sourceInternalPath, $targetInternalPath, $copyResult, $encrypted) { $sourceStorage = $this->createMock(\OC\Files\Storage\Storage::class); @@ -1005,7 +1005,7 @@ class EncryptionTest extends Storage { ->method('getEncryptionModule') ->with($fullPath) ->willReturnCallback( - function() use ($encryptionModule) { + function () use ($encryptionModule) { if ($encryptionModule === false) { throw new ModuleDoesNotExistsException(); } diff --git a/tests/lib/Files/Stream/EncryptionTest.php b/tests/lib/Files/Stream/EncryptionTest.php index 43114ff70f3..5eab39efba3 100644 --- a/tests/lib/Files/Stream/EncryptionTest.php +++ b/tests/lib/Files/Stream/EncryptionTest.php @@ -342,7 +342,7 @@ class EncryptionTest extends \Test\TestCase { $encryptionModule->expects($this->any())->method('end')->willReturn(''); $encryptionModule->expects($this->any())->method('isReadable')->willReturn(true); $encryptionModule->expects($this->any())->method('needDetailedAccessList')->willReturn(false); - $encryptionModule->expects($this->any())->method('encrypt')->willReturnCallback(function($data) { + $encryptionModule->expects($this->any())->method('encrypt')->willReturnCallback(function ($data) { // simulate different block size by adding some padding to the data if (isset($data[6125])) { return str_pad($data, 8192, 'X'); @@ -350,7 +350,7 @@ class EncryptionTest extends \Test\TestCase { // last block return $data; }); - $encryptionModule->expects($this->any())->method('decrypt')->willReturnCallback(function($data) { + $encryptionModule->expects($this->any())->method('decrypt')->willReturnCallback(function ($data) { if (isset($data[8191])) { return substr($data, 0, 6126); } diff --git a/tests/lib/Files/Type/DetectionTest.php b/tests/lib/Files/Type/DetectionTest.php index 1965dc405ff..a7ac6c8057d 100644 --- a/tests/lib/Files/Type/DetectionTest.php +++ b/tests/lib/Files/Type/DetectionTest.php @@ -241,7 +241,7 @@ class DetectionTest extends \Test\TestCase { [$this->equalTo('core'), $this->equalTo('filetypes/my.png')] ) ->willReturnCallback( - function($appName, $file) { + function ($appName, $file) { if ($file === 'filetypes/my.png') { return 'my.svg'; } @@ -272,7 +272,7 @@ class DetectionTest extends \Test\TestCase { [$this->equalTo('core'), $this->equalTo('filetypes/file.png')] ) ->willReturnCallback( - function($appName, $file) { + function ($appName, $file) { if ($file === 'filetypes/file.png') { return 'file.svg'; } diff --git a/tests/lib/Group/ManagerTest.php b/tests/lib/Group/ManagerTest.php index 7fc16dfcc6d..c4b56b56fff 100644 --- a/tests/lib/Group/ManagerTest.php +++ b/tests/lib/Group/ManagerTest.php @@ -91,7 +91,7 @@ class ManagerTest extends TestCase { ->getMock(); $backend->expects($this->any()) ->method('implementsActions') - ->willReturnCallback(function($actions) use ($implementedActions) { + ->willReturnCallback(function ($actions) use ($implementedActions) { return (bool)($actions & $implementedActions); }); return $backend; @@ -546,7 +546,7 @@ class ManagerTest extends TestCase { $backend->expects($this->any()) ->method('inGroup') - ->willReturnCallback(function($uid, $gid) { + ->willReturnCallback(function ($uid, $gid) { switch($uid) { case 'user1' : return false; case 'user2' : return true; @@ -560,7 +560,7 @@ class ManagerTest extends TestCase { $this->userManager->expects($this->any()) ->method('searchDisplayName') ->with('user3') - ->willReturnCallback(function($search, $limit, $offset) { + ->willReturnCallback(function ($search, $limit, $offset) { switch($offset) { case 0 : return ['user3' => $this->getTestUser('user3'), 'user33' => $this->getTestUser('user33')]; @@ -570,7 +570,7 @@ class ManagerTest extends TestCase { }); $this->userManager->expects($this->any()) ->method('get') - ->willReturnCallback(function($uid) { + ->willReturnCallback(function ($uid) { switch($uid) { case 'user1' : return $this->getTestUser('user1'); case 'user2' : return $this->getTestUser('user2'); @@ -604,7 +604,7 @@ class ManagerTest extends TestCase { $backend->expects($this->any()) ->method('inGroup') - ->willReturnCallback(function($uid, $gid) { + ->willReturnCallback(function ($uid, $gid) { switch($uid) { case 'user1' : return false; case 'user2' : return true; @@ -619,7 +619,7 @@ class ManagerTest extends TestCase { $this->userManager->expects($this->any()) ->method('searchDisplayName') ->with('user3') - ->willReturnCallback(function($search, $limit, $offset) { + ->willReturnCallback(function ($search, $limit, $offset) { switch($offset) { case 0 : return ['user3' => $this->getTestUser('user3'), 'user33' => $this->getTestUser('user33')]; @@ -629,7 +629,7 @@ class ManagerTest extends TestCase { }); $this->userManager->expects($this->any()) ->method('get') - ->willReturnCallback(function($uid) { + ->willReturnCallback(function ($uid) { switch($uid) { case 'user1' : return $this->getTestUser('user1'); case 'user2' : return $this->getTestUser('user2'); @@ -665,7 +665,7 @@ class ManagerTest extends TestCase { $backend->expects($this->any()) ->method('inGroup') - ->willReturnCallback(function($uid) { + ->willReturnCallback(function ($uid) { switch($uid) { case 'user1' : return false; case 'user2' : return true; @@ -680,7 +680,7 @@ class ManagerTest extends TestCase { $this->userManager->expects($this->any()) ->method('searchDisplayName') ->with('user3') - ->willReturnCallback(function($search, $limit, $offset) { + ->willReturnCallback(function ($search, $limit, $offset) { switch($offset) { case 0 : return [ @@ -693,7 +693,7 @@ class ManagerTest extends TestCase { }); $this->userManager->expects($this->any()) ->method('get') - ->willReturnCallback(function($uid) { + ->willReturnCallback(function ($uid) { switch($uid) { case 'user1' : return $this->getTestUser('user1'); case 'user2' : return $this->getTestUser('user2'); @@ -734,7 +734,7 @@ class ManagerTest extends TestCase { $this->userManager->expects($this->any()) ->method('get') - ->willReturnCallback(function($uid) { + ->willReturnCallback(function ($uid) { switch($uid) { case 'user1' : return $this->getTestUser('user1'); case 'user2' : return $this->getTestUser('user2'); @@ -773,7 +773,7 @@ class ManagerTest extends TestCase { $this->userManager->expects($this->any()) ->method('get') - ->willReturnCallback(function($uid) { + ->willReturnCallback(function ($uid) { switch($uid) { case 'user1' : return $this->getTestUser('user1'); case 'user2' : return $this->getTestUser('user2'); @@ -812,7 +812,7 @@ class ManagerTest extends TestCase { $this->userManager->expects($this->any()) ->method('get') - ->willReturnCallback(function($uid) { + ->willReturnCallback(function ($uid) { switch($uid) { case 'user1' : return $this->getTestUser('user1'); case 'user2' : return $this->getTestUser('user2'); diff --git a/tests/lib/InitialStateServiceTest.php b/tests/lib/InitialStateServiceTest.php index 2a97f07ac21..6859fbec4f8 100644 --- a/tests/lib/InitialStateServiceTest.php +++ b/tests/lib/InitialStateServiceTest.php @@ -84,7 +84,7 @@ class InitialStateServiceTest extends TestCase { * @dataProvider staticData */ public function testLazyData($value) { - $this->service->provideLazyInitialState('test', 'key', function() use ($value) { + $this->service->provideLazyInitialState('test', 'key', function () use ($value) { return $value; }); $data = $this->service->getInitialStates(); diff --git a/tests/lib/IntegrityCheck/CheckerTest.php b/tests/lib/IntegrityCheck/CheckerTest.php index 98ae3bac9bb..b1b3e4eb029 100644 --- a/tests/lib/IntegrityCheck/CheckerTest.php +++ b/tests/lib/IntegrityCheck/CheckerTest.php @@ -140,7 +140,7 @@ class CheckerTest extends TestCase { ->method('file_put_contents') ->with( $this->equalTo(\OC::$SERVERROOT . '/tests/data/integritycheck/app//appinfo/signature.json'), - $this->callback(function($signature) use ($expectedSignatureFileData) { + $this->callback(function ($signature) use ($expectedSignatureFileData) { $expectedArray = json_decode($expectedSignatureFileData, true); $actualArray = json_decode($signature, true); $this->assertEquals($expectedArray, $actualArray); @@ -546,7 +546,7 @@ class CheckerTest extends TestCase { ->method('file_put_contents') ->with( \OC::$SERVERROOT . '/tests/data/integritycheck/app//core/signature.json', - $this->callback(function($signature) use ($expectedSignatureFileData) { + $this->callback(function ($signature) use ($expectedSignatureFileData) { $expectedArray = json_decode($expectedSignatureFileData, true); $actualArray = json_decode($signature, true); $this->assertEquals($expectedArray, $actualArray); @@ -581,7 +581,7 @@ class CheckerTest extends TestCase { ->method('file_put_contents') ->with( \OC::$SERVERROOT . '/tests/data/integritycheck/htaccessUnmodified//core/signature.json', - $this->callback(function($signature) use ($expectedSignatureFileData) { + $this->callback(function ($signature) use ($expectedSignatureFileData) { $expectedArray = json_decode($expectedSignatureFileData, true); $actualArray = json_decode($signature, true); $this->assertEquals($expectedArray, $actualArray); @@ -611,7 +611,7 @@ class CheckerTest extends TestCase { ->method('file_put_contents') ->with( \OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithInvalidModifiedContent//core/signature.json', - $this->callback(function($signature) use ($expectedSignatureFileData) { + $this->callback(function ($signature) use ($expectedSignatureFileData) { $expectedArray = json_decode($expectedSignatureFileData, true); $actualArray = json_decode($signature, true); $this->assertEquals($expectedArray, $actualArray); @@ -646,7 +646,7 @@ class CheckerTest extends TestCase { ->method('file_put_contents') ->with( \OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithValidModifiedContent/core/signature.json', - $this->callback(function($signature) use ($expectedSignatureFileData) { + $this->callback(function ($signature) use ($expectedSignatureFileData) { $expectedArray = json_decode($expectedSignatureFileData, true); $actualArray = json_decode($signature, true); $this->assertEquals($expectedArray, $actualArray); diff --git a/tests/lib/L10N/FactoryTest.php b/tests/lib/L10N/FactoryTest.php index 4d35aeabc91..33667e26fe8 100644 --- a/tests/lib/L10N/FactoryTest.php +++ b/tests/lib/L10N/FactoryTest.php @@ -419,7 +419,7 @@ class FactoryTest extends TestCase { ->willReturn($availableLanguages); $factory->expects($this->any()) - ->method('respectDefaultLanguage')->willReturnCallback(function($app, $lang) { + ->method('respectDefaultLanguage')->willReturnCallback(function ($app, $lang) { return $lang; }); @@ -510,7 +510,7 @@ class FactoryTest extends TestCase { $this->config->expects($this->any()) ->method('getSystemValue') - ->willReturnCallback(function($var, $default) use ($defaultLang) { + ->willReturnCallback(function ($var, $default) use ($defaultLang) { if ($var === 'installed') { return true; } else if ($var === 'default_language') { @@ -558,7 +558,7 @@ class FactoryTest extends TestCase { return $availableLang; }); $factory->expects($this->any()) - ->method('respectDefaultLanguage')->willReturnCallback(function($app, $lang) { + ->method('respectDefaultLanguage')->willReturnCallback(function ($app, $lang) { return $lang; }); diff --git a/tests/lib/LegacyHelperTest.php b/tests/lib/LegacyHelperTest.php index 8fa339dbbab..a2c2e011254 100644 --- a/tests/lib/LegacyHelperTest.php +++ b/tests/lib/LegacyHelperTest.php @@ -54,7 +54,7 @@ class LegacyHelperTest extends \Test\TestCase { $this->assertEquals($expected, $result); } - function providesComputerFileSize(){ + function providesComputerFileSize() { return [ [0.0, "0 B"], [1024.0, "1 KB"], diff --git a/tests/lib/Lockdown/LockdownManagerTest.php b/tests/lib/Lockdown/LockdownManagerTest.php index 7b52994d381..2f9a410b7e3 100644 --- a/tests/lib/Lockdown/LockdownManagerTest.php +++ b/tests/lib/Lockdown/LockdownManagerTest.php @@ -32,7 +32,7 @@ class LockdownManagerTest extends TestCase { protected function setUp(): void { parent::setUp(); - $this->sessionCallback = function() { + $this->sessionCallback = function () { return $this->createMock(ISession::class); }; } diff --git a/tests/lib/LoggerTest.php b/tests/lib/LoggerTest.php index fd695c8c68d..99743ab95bd 100644 --- a/tests/lib/LoggerTest.php +++ b/tests/lib/LoggerTest.php @@ -176,7 +176,7 @@ class LoggerTest extends TestCase implements IWriter { * @dataProvider userAndPasswordData */ public function testDetectclosure(string $user, string $password): void { - $a = function($user, $password) { + $a = function ($user, $password) { throw new \Exception('test'); }; $this->registry->expects($this->once()) diff --git a/tests/lib/Memcache/RedisTest.php b/tests/lib/Memcache/RedisTest.php index e6a940599d7..d5bf10e7af9 100644 --- a/tests/lib/Memcache/RedisTest.php +++ b/tests/lib/Memcache/RedisTest.php @@ -23,7 +23,7 @@ class RedisTest extends Cache { $errorOccurred = false; set_error_handler( - function($errno, $errstr) { + function ($errno, $errstr) { throw new \RuntimeException($errstr, 123456789); }, E_WARNING diff --git a/tests/lib/Preview/GeneratorTest.php b/tests/lib/Preview/GeneratorTest.php index ae84d8eb4b3..80293102631 100644 --- a/tests/lib/Preview/GeneratorTest.php +++ b/tests/lib/Preview/GeneratorTest.php @@ -112,7 +112,7 @@ class GeneratorTest extends \Test\TestCase { ->method('dispatch') ->with( $this->equalTo(IPreview::EVENT), - $this->callback(function(GenericEvent $event) use ($file) { + $this->callback(function (GenericEvent $event) use ($file) { return $event->getSubject() === $file && $event->getArgument('width') === 100 && $event->getArgument('height') === 100; @@ -146,7 +146,7 @@ class GeneratorTest extends \Test\TestCase { ->willReturn($previewFolder); $this->config->method('getSystemValue') - ->willReturnCallback(function($key, $defult) { + ->willReturnCallback(function ($key, $defult) { return $defult; }); @@ -168,7 +168,7 @@ class GeneratorTest extends \Test\TestCase { ]); $this->helper->method('getProvider') - ->willReturnCallback(function($provider) use ($invalidProvider, $validProvider, $unavailableProvider) { + ->willReturnCallback(function ($provider) use ($invalidProvider, $validProvider, $unavailableProvider) { if ($provider === 'wrongProvider') { $this->fail('Wrongprovider should not be constructed!'); } else if ($provider === 'brokenProvider') { @@ -210,7 +210,7 @@ class GeneratorTest extends \Test\TestCase { $previewFolder->method('getDirectoryListing') ->willReturn([]); $previewFolder->method('newFile') - ->willReturnCallback(function($filename) use ($maxPreview, $previewFile) { + ->willReturnCallback(function ($filename) use ($maxPreview, $previewFile) { if ($filename === '2048-2048-max.png') { return $maxPreview; } else if ($filename === '256-256.png') { @@ -248,7 +248,7 @@ class GeneratorTest extends \Test\TestCase { ->method('dispatch') ->with( $this->equalTo(IPreview::EVENT), - $this->callback(function(GenericEvent $event) use ($file) { + $this->callback(function (GenericEvent $event) use ($file) { return $event->getSubject() === $file && $event->getArgument('width') === 100 && $event->getArgument('height') === 100; @@ -274,7 +274,7 @@ class GeneratorTest extends \Test\TestCase { ->method('dispatch') ->with( $this->equalTo(IPreview::EVENT), - $this->callback(function(GenericEvent $event) use ($file) { + $this->callback(function (GenericEvent $event) use ($file) { return $event->getSubject() === $file && $event->getArgument('width') === 0 && $event->getArgument('height') === 0 && @@ -314,7 +314,7 @@ class GeneratorTest extends \Test\TestCase { ->method('dispatch') ->with( $this->equalTo(IPreview::EVENT), - $this->callback(function(GenericEvent $event) use ($file) { + $this->callback(function (GenericEvent $event) use ($file) { return $event->getSubject() === $file && $event->getArgument('width') === 100 && $event->getArgument('height') === 100; @@ -427,7 +427,7 @@ class GeneratorTest extends \Test\TestCase { ->method('dispatch') ->with( $this->equalTo(IPreview::EVENT), - $this->callback(function(GenericEvent $event) use ($file, $reqX, $reqY, $crop, $mode) { + $this->callback(function (GenericEvent $event) use ($file, $reqX, $reqY, $crop, $mode) { return $event->getSubject() === $file && $event->getArgument('width') === $reqX && $event->getArgument('height') === $reqY && diff --git a/tests/lib/Security/Bruteforce/ThrottlerTest.php b/tests/lib/Security/Bruteforce/ThrottlerTest.php index 5e0db3bf24c..1c58849c9f8 100644 --- a/tests/lib/Security/Bruteforce/ThrottlerTest.php +++ b/tests/lib/Security/Bruteforce/ThrottlerTest.php @@ -185,7 +185,7 @@ class ThrottlerTest extends TestCase { ->willReturn($enabled); $this->config->method('getAppValue') - ->willReturnCallback(function($app, $key, $default) use ($whitelists) { + ->willReturnCallback(function ($app, $key, $default) use ($whitelists) { if ($app !== 'bruteForce') { return $default; } diff --git a/tests/lib/Security/CSP/ContentSecurityPolicyManagerTest.php b/tests/lib/Security/CSP/ContentSecurityPolicyManagerTest.php index ca37623177f..21e29c910c4 100644 --- a/tests/lib/Security/CSP/ContentSecurityPolicyManagerTest.php +++ b/tests/lib/Security/CSP/ContentSecurityPolicyManagerTest.php @@ -79,7 +79,7 @@ class ContentSecurityPolicyManagerTest extends TestCase { } public function testGetDefaultPolicyWithPoliciesViaEvent() { - $this->dispatcher->addListener(AddContentSecurityPolicyEvent::class, function(AddContentSecurityPolicyEvent $e) { + $this->dispatcher->addListener(AddContentSecurityPolicyEvent::class, function (AddContentSecurityPolicyEvent $e) { $policy = new \OCP\AppFramework\Http\ContentSecurityPolicy(); $policy->addAllowedFontDomain('mydomain.com'); $policy->addAllowedImageDomain('anotherdomain.de'); @@ -87,7 +87,7 @@ class ContentSecurityPolicyManagerTest extends TestCase { $e->addPolicy($policy); }); - $this->dispatcher->addListener(AddContentSecurityPolicyEvent::class, function(AddContentSecurityPolicyEvent $e) { + $this->dispatcher->addListener(AddContentSecurityPolicyEvent::class, function (AddContentSecurityPolicyEvent $e) { $policy = new \OCP\AppFramework\Http\ContentSecurityPolicy(); $policy->addAllowedFontDomain('example.com'); $policy->addAllowedImageDomain('example.org'); @@ -96,7 +96,7 @@ class ContentSecurityPolicyManagerTest extends TestCase { $e->addPolicy($policy); }); - $this->dispatcher->addListener(AddContentSecurityPolicyEvent::class, function(AddContentSecurityPolicyEvent $e) { + $this->dispatcher->addListener(AddContentSecurityPolicyEvent::class, function (AddContentSecurityPolicyEvent $e) { $policy = new \OCP\AppFramework\Http\EmptyContentSecurityPolicy(); $policy->addAllowedChildSrcDomain('childdomain'); $policy->addAllowedFontDomain('anotherFontDomain'); diff --git a/tests/lib/Security/CertificateManagerTest.php b/tests/lib/Security/CertificateManagerTest.php index 5d8e66bb99b..579a15f483a 100644 --- a/tests/lib/Security/CertificateManagerTest.php +++ b/tests/lib/Security/CertificateManagerTest.php @@ -181,7 +181,7 @@ class CertificateManagerTest extends \Test\TestCase { } $view->expects($this->any())->method('filemtime') - ->willReturnCallback(function($path) use ($systemWideMtime, $targetBundleMtime) { + ->willReturnCallback(function ($path) use ($systemWideMtime, $targetBundleMtime) { if ($path === 'SystemBundlePath') { return $systemWideMtime; } elseif ($path === 'targetBundlePath') { diff --git a/tests/lib/Security/FeaturePolicy/FeaturePolicyManagerTest.php b/tests/lib/Security/FeaturePolicy/FeaturePolicyManagerTest.php index 4014b253f58..15bbc803f5a 100644 --- a/tests/lib/Security/FeaturePolicy/FeaturePolicyManagerTest.php +++ b/tests/lib/Security/FeaturePolicy/FeaturePolicyManagerTest.php @@ -51,7 +51,7 @@ class FeaturePolicyManagerTest extends TestCase { } public function testGetDefaultPolicyWithPoliciesViaEvent() { - $this->dispatcher->addListener(AddFeaturePolicyEvent::class, function(AddFeaturePolicyEvent $e) { + $this->dispatcher->addListener(AddFeaturePolicyEvent::class, function (AddFeaturePolicyEvent $e) { $policy = new FeaturePolicy(); $policy->addAllowedMicrophoneDomain('mydomain.com'); $policy->addAllowedPaymentDomain('mypaymentdomain.com'); @@ -59,7 +59,7 @@ class FeaturePolicyManagerTest extends TestCase { $e->addPolicy($policy); }); - $this->dispatcher->addListener(AddFeaturePolicyEvent::class, function(AddFeaturePolicyEvent $e) { + $this->dispatcher->addListener(AddFeaturePolicyEvent::class, function (AddFeaturePolicyEvent $e) { $policy = new FeaturePolicy(); $policy->addAllowedPaymentDomain('mydomainother.com'); $policy->addAllowedGeoLocationDomain('mylocation.here'); @@ -67,7 +67,7 @@ class FeaturePolicyManagerTest extends TestCase { $e->addPolicy($policy); }); - $this->dispatcher->addListener(AddFeaturePolicyEvent::class, function(AddFeaturePolicyEvent $e) { + $this->dispatcher->addListener(AddFeaturePolicyEvent::class, function (AddFeaturePolicyEvent $e) { $policy = new FeaturePolicy(); $policy->addAllowedAutoplayDomain('youtube.com'); diff --git a/tests/lib/Share20/DefaultShareProviderTest.php b/tests/lib/Share20/DefaultShareProviderTest.php index c3f663052ed..c0a869d0793 100644 --- a/tests/lib/Share20/DefaultShareProviderTest.php +++ b/tests/lib/Share20/DefaultShareProviderTest.php @@ -1767,7 +1767,7 @@ class DefaultShareProviderTest extends \Test\TestCase { } $this->userManager->method('get')->willReturnCallback( - function($userId) use ($users) { + function ($userId) use ($users) { return $users[$userId]; } ); @@ -1824,7 +1824,7 @@ class DefaultShareProviderTest extends \Test\TestCase { } $this->userManager->method('get')->willReturnCallback( - function($userId) use ($users) { + function ($userId) use ($users) { return $users[$userId]; } ); @@ -1890,7 +1890,7 @@ class DefaultShareProviderTest extends \Test\TestCase { } $this->userManager->method('get')->willReturnCallback( - function($userId) use ($users) { + function ($userId) use ($users) { return $users[$userId]; } ); @@ -1947,7 +1947,7 @@ class DefaultShareProviderTest extends \Test\TestCase { } $this->userManager->method('get')->willReturnCallback( - function($userId) use ($users) { + function ($userId) use ($users) { return $users[$userId]; } ); @@ -1960,7 +1960,7 @@ class DefaultShareProviderTest extends \Test\TestCase { } $this->groupManager->method('get')->willReturnCallback( - function($groupId) use ($groups) { + function ($groupId) use ($groups) { return $groups[$groupId]; } ); @@ -2025,7 +2025,7 @@ class DefaultShareProviderTest extends \Test\TestCase { } $this->userManager->method('get')->willReturnCallback( - function($userId) use ($users) { + function ($userId) use ($users) { return $users[$userId]; } ); @@ -2038,7 +2038,7 @@ class DefaultShareProviderTest extends \Test\TestCase { } $this->groupManager->method('get')->willReturnCallback( - function($groupId) use ($groups) { + function ($groupId) use ($groups) { return $groups[$groupId]; } ); diff --git a/tests/lib/Share20/ManagerTest.php b/tests/lib/Share20/ManagerTest.php index f48d776eb01..96bebc196f6 100644 --- a/tests/lib/Share20/ManagerTest.php +++ b/tests/lib/Share20/ManagerTest.php @@ -123,7 +123,7 @@ class ManagerTest extends \Test\TestCase { $this->l10nFactory = $this->createMock(IFactory::class); $this->l = $this->createMock(IL10N::class); $this->l->method('t') - ->willReturnCallback(function($text, $parameters = []) { + ->willReturnCallback(function ($text, $parameters = []) { return vsprintf($text, $parameters); }); @@ -233,7 +233,7 @@ class ManagerTest extends \Test\TestCase { ->method('dispatch') ->with( 'OCP\Share::preUnshare', - $this->callBack(function(GenericEvent $e) use ($share) { + $this->callBack(function (GenericEvent $e) use ($share) { return $e->getSubject() === $share; }) ); @@ -241,7 +241,7 @@ class ManagerTest extends \Test\TestCase { ->method('dispatch') ->with( 'OCP\Share::postUnshare', - $this->callBack(function(GenericEvent $e) use ($share) { + $this->callBack(function (GenericEvent $e) use ($share) { return $e->getSubject() === $share && $e->getArgument('deletedShares') === [$share]; }) @@ -279,7 +279,7 @@ class ManagerTest extends \Test\TestCase { ->method('dispatch') ->with( 'OCP\Share::preUnshare', - $this->callBack(function(GenericEvent $e) use ($share) { + $this->callBack(function (GenericEvent $e) use ($share) { return $e->getSubject() === $share; }) ); @@ -287,7 +287,7 @@ class ManagerTest extends \Test\TestCase { ->method('dispatch') ->with( 'OCP\Share::postUnshare', - $this->callBack(function(GenericEvent $e) use ($share) { + $this->callBack(function (GenericEvent $e) use ($share) { return $e->getSubject() === $share && $e->getArgument('deletedShares') === [$share]; }) @@ -348,7 +348,7 @@ class ManagerTest extends \Test\TestCase { ->method('dispatch') ->with( 'OCP\Share::preUnshare', - $this->callBack(function(GenericEvent $e) use ($share1) { + $this->callBack(function (GenericEvent $e) use ($share1) { return $e->getSubject() === $share1; }) ); @@ -356,7 +356,7 @@ class ManagerTest extends \Test\TestCase { ->method('dispatch') ->with( 'OCP\Share::postUnshare', - $this->callBack(function(GenericEvent $e) use ($share1, $share2, $share3) { + $this->callBack(function (GenericEvent $e) use ($share1, $share2, $share3) { return $e->getSubject() === $share1 && $e->getArgument('deletedShares') === [$share3, $share2, $share1]; }) @@ -391,7 +391,7 @@ class ManagerTest extends \Test\TestCase { ->method('dispatch') ->with( 'OCP\Share::postUnshareFromSelf', - $this->callBack(function(GenericEvent $e) use ($share) { + $this->callBack(function (GenericEvent $e) use ($share) { return $e->getSubject() === $share; }) ); @@ -423,7 +423,7 @@ class ManagerTest extends \Test\TestCase { $this->defaultProvider ->expects($this->exactly(4)) ->method('getChildren') - ->willReturnCallback(function($_share) use ($share, $shares) { + ->willReturnCallback(function ($_share) use ($share, $shares) { if ($_share === $share) { return $shares; } @@ -505,7 +505,7 @@ class ManagerTest extends \Test\TestCase { ]); $this->eventDispatcher->expects($this->once())->method('dispatch') - ->willReturnCallback(function(Event $event) { + ->willReturnCallback(function (Event $event) { $this->assertInstanceOf(ValidatePasswordPolicyEvent::class, $event); /** @var ValidatePasswordPolicyEvent $event */ $this->assertSame('password', $event->getPassword()); @@ -526,7 +526,7 @@ class ManagerTest extends \Test\TestCase { ]); $this->eventDispatcher->expects($this->once())->method('dispatch') - ->willReturnCallback(function(Event $event) { + ->willReturnCallback(function (Event $event) { $this->assertInstanceOf(ValidatePasswordPolicyEvent::class, $event); /** @var ValidatePasswordPolicyEvent $event */ $this->assertSame('password', $event->getPassword()); @@ -1773,7 +1773,7 @@ class ManagerTest extends \Test\TestCase { ->expects($this->once()) ->method('create') ->with($share) - ->willReturnCallback(function(Share $share) { + ->willReturnCallback(function (Share $share) { return $share->setId(42); }); @@ -1782,7 +1782,7 @@ class ManagerTest extends \Test\TestCase { ->method('dispatch') ->with( $this->equalTo('OCP\Share::preShare'), - $this->callback(function(GenericEvent $e) use ($path, $date) { + $this->callback(function (GenericEvent $e) use ($path, $date) { /** @var IShare $share */ $share = $e->getSubject(); @@ -1801,7 +1801,7 @@ class ManagerTest extends \Test\TestCase { ->method('dispatch') ->with( $this->equalTo('OCP\Share::postShare'), - $this->callback(function(GenericEvent $e) use ($path, $date) { + $this->callback(function (GenericEvent $e) use ($path, $date) { /** @var IShare $share */ $share = $e->getSubject(); @@ -1882,7 +1882,7 @@ class ManagerTest extends \Test\TestCase { ->expects($this->once()) ->method('create') ->with($share) - ->willReturnCallback(function(Share $share) { + ->willReturnCallback(function (Share $share) { return $share->setId(42); }); @@ -1891,7 +1891,7 @@ class ManagerTest extends \Test\TestCase { ->method('dispatch') ->with( $this->equalTo('OCP\Share::preShare'), - $this->callback(function(GenericEvent $e) use ($path) { + $this->callback(function (GenericEvent $e) use ($path) { /** @var IShare $share */ $share = $e->getSubject(); @@ -1910,7 +1910,7 @@ class ManagerTest extends \Test\TestCase { ->method('dispatch') ->with( $this->equalTo('OCP\Share::postShare'), - $this->callback(function(GenericEvent $e) use ($path) { + $this->callback(function (GenericEvent $e) use ($path) { /** @var IShare $share */ $share = $e->getSubject(); @@ -1993,7 +1993,7 @@ class ManagerTest extends \Test\TestCase { ->with( $this->equalTo('OCP\Share::preShare'), $this->isInstanceOf(GenericEvent::class) - )->willReturnCallback(function($name, GenericEvent $e) { + )->willReturnCallback(function ($name, GenericEvent $e) { $e->setArgument('error', 'I won\'t let you share!'); $e->stopPropagation(); } @@ -2145,7 +2145,7 @@ class ManagerTest extends \Test\TestCase { */ $this->defaultProvider ->method('getSharesBy') - ->willReturnCallback(function($uid, $type, $node, $reshares, $limit, $offset) use (&$shares2) { + ->willReturnCallback(function ($uid, $type, $node, $reshares, $limit, $offset) use (&$shares2) { return array_slice($shares2, $offset, $limit); }); @@ -2153,7 +2153,7 @@ class ManagerTest extends \Test\TestCase { * Simulate the deleteShare call. */ $manager->method('deleteShare') - ->willReturnCallback(function($share) use (&$shares2) { + ->willReturnCallback(function ($share) use (&$shares2) { for($i = 0; $i < count($shares2); $i++) { if ($shares2[$i]->getId() === $share->getId()) { array_splice($shares2, $i, 1); @@ -2255,7 +2255,7 @@ class ManagerTest extends \Test\TestCase { $factory->expects($this->any()) ->method('getProviderForType') - ->willReturnCallback(function($shareType) use ($roomShareProvider) { + ->willReturnCallback(function ($shareType) use ($roomShareProvider) { if ($shareType !== \OCP\Share::SHARE_TYPE_ROOM) { throw new Exception\ProviderException(); } @@ -2464,7 +2464,7 @@ class ManagerTest extends \Test\TestCase { ->setPassword('passwordHash'); $this->hasher->method('verify')->with('password', 'passwordHash', '') - ->willReturnCallback(function($pass, $hash, &$newHash) { + ->willReturnCallback(function ($pass, $hash, &$newHash) { $newHash = 'newHash'; return true; @@ -3741,12 +3741,12 @@ class ManagerTest extends \Test\TestCase { $share4 = $this->createMock(IShare::class); $this->defaultProvider->method('getAllShares') - ->willReturnCallback(function() use ($share1, $share2) { + ->willReturnCallback(function () use ($share1, $share2) { yield $share1; yield $share2; }); $extraProvider->method('getAllShares') - ->willReturnCallback(function() use ($share3, $share4) { + ->willReturnCallback(function () use ($share3, $share4) { yield $share3; yield $share4; }); diff --git a/tests/lib/SystemTag/SystemTagObjectMapperTest.php b/tests/lib/SystemTag/SystemTagObjectMapperTest.php index b729079fbad..a5158bbee68 100644 --- a/tests/lib/SystemTag/SystemTagObjectMapperTest.php +++ b/tests/lib/SystemTag/SystemTagObjectMapperTest.php @@ -88,7 +88,7 @@ class SystemTagObjectMapperTest extends TestCase { $this->tagManager->expects($this->any()) ->method('getTagsByIds') - ->willReturnCallback(function($tagIds) { + ->willReturnCallback(function ($tagIds) { $result = []; if (in_array(1, $tagIds)) { $result[1] = $this->tag1; diff --git a/tests/lib/Template/JSCombinerTest.php b/tests/lib/Template/JSCombinerTest.php index 1e8ba5f6a2c..b892749806d 100644 --- a/tests/lib/Template/JSCombinerTest.php +++ b/tests/lib/Template/JSCombinerTest.php @@ -120,7 +120,7 @@ class JSCombinerTest extends \Test\TestCase { $fileDeps = $this->createMock(ISimpleFile::class); $folder->method('getFile') - ->willReturnCallback(function($path) use ($file, $gzfile) { + ->willReturnCallback(function ($path) use ($file, $gzfile) { if ($path === 'combine.js') { return $file; } else if ($path === 'combine.js.deps') { @@ -157,7 +157,7 @@ class JSCombinerTest extends \Test\TestCase { $gzfile = $this->createMock(ISimpleFile::class); $folder->method('getFile') - ->willReturnCallback(function($path) use ($file, $gzfile) { + ->willReturnCallback(function ($path) use ($file, $gzfile) { if ($path === 'combine.js') { return $file; } else if ($path === 'combine.js.deps') { @@ -200,7 +200,7 @@ class JSCombinerTest extends \Test\TestCase { ->willReturn(true); $folder->method('getFile') - ->willReturnCallback(function($path) use ($file, $fileDeps) { + ->willReturnCallback(function ($path) use ($file, $fileDeps) { if ($path === 'combine.js') { return $file; } @@ -245,7 +245,7 @@ class JSCombinerTest extends \Test\TestCase { ->willReturn('{}'); $folder->method('getFile') - ->willReturnCallback(function($path) use ($file) { + ->willReturnCallback(function ($path) use ($file) { if ($path === 'combine.js') { return $file; } @@ -262,7 +262,7 @@ class JSCombinerTest extends \Test\TestCase { $file = $this->createMock(ISimpleFile::class); $folder->method('getFile') - ->willReturnCallback(function($path) use ($file) { + ->willReturnCallback(function ($path) use ($file) { if ($path === 'combine.js') { return $file; } diff --git a/tests/lib/Template/SCSSCacherTest.php b/tests/lib/Template/SCSSCacherTest.php index fda899e51b2..5760ea7f8e0 100644 --- a/tests/lib/Template/SCSSCacherTest.php +++ b/tests/lib/Template/SCSSCacherTest.php @@ -120,7 +120,7 @@ class SCSSCacherTest extends \Test\TestCase { substr(md5('http://localhost/nextcloud/index.php'), 0, 4) . '-'; $folder->method('getFile') - ->willReturnCallback(function($path) use ($file, $gzfile, $filePrefix) { + ->willReturnCallback(function ($path) use ($file, $gzfile, $filePrefix) { if ($path === $filePrefix.'styles.css') { return $file; } else if ($path === $filePrefix.'styles.css.deps') { @@ -160,7 +160,7 @@ class SCSSCacherTest extends \Test\TestCase { substr(md5('http://localhost/nextcloud/index.php'), 0, 4) . '-'; $folder->method('getFile') - ->willReturnCallback(function($path) use ($file, $gzfile, $filePrefix) { + ->willReturnCallback(function ($path) use ($file, $gzfile, $filePrefix) { if ($path === $filePrefix.'styles.css') { return $file; } else if ($path === $filePrefix.'styles.css.deps') { @@ -196,7 +196,7 @@ class SCSSCacherTest extends \Test\TestCase { substr(md5('http://localhost/nextcloud/index.php'), 0, 4) . '-'; $folder->method('getFile') - ->willReturnCallback(function($name) use ($file, $fileDeps, $gzFile, $filePrefix) { + ->willReturnCallback(function ($name) use ($file, $fileDeps, $gzFile, $filePrefix) { if ($name === $filePrefix.'styles.css') { return $file; } else if ($name === $filePrefix.'styles.css.deps') { @@ -234,7 +234,7 @@ class SCSSCacherTest extends \Test\TestCase { $filePrefix = substr(md5(\OC_Util::getVersionString('core')), 0, 4) . '-' . substr(md5('http://localhost/nextcloud/index.php'), 0, 4) . '-'; $folder->method('getFile') - ->willReturnCallback(function($name) use ($file, $fileDeps, $gzFile, $filePrefix) { + ->willReturnCallback(function ($name) use ($file, $fileDeps, $gzFile, $filePrefix) { if ($name === $filePrefix.'styles.css') { return $file; } else if ($name === $filePrefix.'styles.css.deps') { @@ -272,7 +272,7 @@ class SCSSCacherTest extends \Test\TestCase { $file->expects($this->once())->method('getSize')->willReturn(1); $folder->method('getFile') - ->willReturnCallback(function($path) use ($file) { + ->willReturnCallback(function ($path) use ($file) { if ($path === 'styles.css') { return $file; } else if ($path === 'styles.css.deps') { @@ -300,7 +300,7 @@ class SCSSCacherTest extends \Test\TestCase { $path = \OC::$SERVERROOT . '/core/css/'; $folder->method('getFile')->willThrowException(new NotFoundException()); - $folder->method('newFile')->willReturnCallback(function($fileName) use ($file, $depsFile, $gzipFile) { + $folder->method('newFile')->willReturnCallback(function ($fileName) use ($file, $depsFile, $gzipFile) { if ($fileName === 'styles.css') { return $file; } else if ($fileName === 'styles.css.deps') { @@ -334,7 +334,7 @@ class SCSSCacherTest extends \Test\TestCase { $webDir = "core/css"; $path = \OC::$SERVERROOT; - $folder->method('getFile')->willReturnCallback(function($fileName) use ($file, $depsFile, $gzipFile) { + $folder->method('getFile')->willReturnCallback(function ($fileName) use ($file, $depsFile, $gzipFile) { if ($fileName === 'styles.css') { return $file; } else if ($fileName === 'styles.css.deps') { @@ -368,7 +368,7 @@ class SCSSCacherTest extends \Test\TestCase { $webDir = "tests/data/scss"; $path = \OC::$SERVERROOT . $webDir; - $folder->method('getFile')->willReturnCallback(function($fileName) use ($file, $depsFile, $gzipFile) { + $folder->method('getFile')->willReturnCallback(function ($fileName) use ($file, $depsFile, $gzipFile) { if ($fileName === 'styles-success.css') { return $file; } else if ($fileName === 'styles-success.css.deps') { @@ -384,7 +384,7 @@ class SCSSCacherTest extends \Test\TestCase { ->willReturn('body{background-color:#0082c9}'); $file->expects($this->at(0))->method('putContent')->with($this->callback( - function ($content){ + function ($content) { return 'body{background-color:#0082c9}' === $content; })); $depsFile->expects($this->at(0))->method('putContent')->with($this->callback( diff --git a/tests/lib/TestCase.php b/tests/lib/TestCase.php index be4a7ade787..9d3070a0e28 100644 --- a/tests/lib/TestCase.php +++ b/tests/lib/TestCase.php @@ -479,7 +479,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase { $l10n ->expects($this->any()) ->method('t') - ->willReturnCallback(function($text, $parameters = []) { + ->willReturnCallback(function ($text, $parameters = []) { return vsprintf($text, $parameters); }); diff --git a/tests/lib/Updater/ChangesCheckTest.php b/tests/lib/Updater/ChangesCheckTest.php index 1bc8b47e58f..b3897ebbd07 100644 --- a/tests/lib/Updater/ChangesCheckTest.php +++ b/tests/lib/Updater/ChangesCheckTest.php @@ -348,8 +348,8 @@ class ChangesCheckTest extends TestCase { public function changeDataProvider():array { $testDataFound = $testDataNotFound = $this->versionProvider(); - array_walk($testDataFound, function(&$params) { $params[] = true; }); - array_walk($testDataNotFound, function(&$params) { $params[] = false; }); + array_walk($testDataFound, function (&$params) { $params[] = true; }); + array_walk($testDataNotFound, function (&$params) { $params[] = false; }); return array_merge($testDataFound, $testDataNotFound); } diff --git a/tests/lib/User/SessionTest.php b/tests/lib/User/SessionTest.php index f7aba189603..48c4785bf71 100644 --- a/tests/lib/User/SessionTest.php +++ b/tests/lib/User/SessionTest.php @@ -264,7 +264,7 @@ class SessionTest extends \Test\TestCase { $this->dispatcher->expects($this->once()) ->method('dispatchTyped') ->with( - $this->callback(function(PostLoginEvent $e) { + $this->callback(function (PostLoginEvent $e) { return $e->getUser()->getUID() === 'foo' && $e->getPassword() === 'bar' && $e->isTokenLogin() === false; @@ -1375,7 +1375,7 @@ class SessionTest extends \Test\TestCase { $this->session ->method('set') - ->willReturnCallback(function($k, $v) use (&$davAuthenticatedSet, &$lastPasswordConfirmSet) { + ->willReturnCallback(function ($k, $v) use (&$davAuthenticatedSet, &$lastPasswordConfirmSet) { switch ($k) { case Auth::DAV_AUTHENTICATED: $davAuthenticatedSet = $v; diff --git a/tests/lib/Util/User/Dummy.php b/tests/lib/Util/User/Dummy.php index 1d3c2d57b42..3e6372ca033 100644 --- a/tests/lib/Util/User/Dummy.php +++ b/tests/lib/Util/User/Dummy.php @@ -175,7 +175,7 @@ class Dummy extends Backend implements \OCP\IUserBackend { * Backend name to be shown in user management * @return string the name of the backend to be shown */ - public function getBackendName(){ + public function getBackendName() { return 'Dummy'; } } diff --git a/tests/lib/UtilTest.php b/tests/lib/UtilTest.php index 4d8432294fb..767ada3ae03 100644 --- a/tests/lib/UtilTest.php +++ b/tests/lib/UtilTest.php @@ -233,7 +233,7 @@ class UtilTest extends \Test\TestCase { $appManager = $this->createMock(IAppManager::class); $appManager->expects($this->any()) ->method('isEnabledForUser') - ->willReturnCallback(function($appId) use ($enabledApps){ + ->willReturnCallback(function ($appId) use ($enabledApps) { return in_array($appId, $enabledApps); }); Dummy_OC_Util::$appManager = $appManager; |