diff options
Diffstat (limited to 'tests')
52 files changed, 213 insertions, 213 deletions
diff --git a/tests/Core/Command/Log/FileTest.php b/tests/Core/Command/Log/FileTest.php index 08ff01e019d..9c7e0297d53 100644 --- a/tests/Core/Command/Log/FileTest.php +++ b/tests/Core/Command/Log/FileTest.php @@ -91,7 +91,7 @@ class FileTest extends TestCase { $this->config->method('getSystemValue') ->willReturnMap([ ['log_type', 'file', 'log_type_value'], - ['datadirectory', \OC::$SERVERROOT.'/data', '/data/directory/'], + ['datadirectory', \OC::$SERVERROOT . '/data', '/data/directory/'], ['logfile', '/data/directory/nextcloud.log', '/var/log/nextcloud.log'], ['log_rotate_size', 100 * 1024 * 1024, 5 * 1024 * 1024], ]); diff --git a/tests/Core/Command/Maintenance/ModeTest.php b/tests/Core/Command/Maintenance/ModeTest.php index 59b8bbfc045..a4c33474745 100644 --- a/tests/Core/Command/Maintenance/ModeTest.php +++ b/tests/Core/Command/Maintenance/ModeTest.php @@ -123,7 +123,7 @@ class ModeTest extends TestCase { string $option, bool $currentMaintenanceState, $expectedMaintenanceState, - string $expectedOutput + string $expectedOutput, ): void { $this->config->expects($this->any()) ->method('getSystemValueBool') diff --git a/tests/Core/Command/SystemTag/AddTest.php b/tests/Core/Command/SystemTag/AddTest.php index 4dd0df7ffe0..7ae832e4079 100644 --- a/tests/Core/Command/SystemTag/AddTest.php +++ b/tests/Core/Command/SystemTag/AddTest.php @@ -95,7 +95,7 @@ class AddTest extends TestCase { $this->systemTagManager->method('createTag') ->willReturnCallback(function ($tagName, $userVisible, $userAssignable) { throw new TagAlreadyExistsException( - 'Tag ("' . $tagName . '", '. $userVisible . ', ' . $userAssignable . ') already exists' + 'Tag ("' . $tagName . '", ' . $userVisible . ', ' . $userAssignable . ') already exists' ); }); diff --git a/tests/Core/Command/SystemTag/EditTest.php b/tests/Core/Command/SystemTag/EditTest.php index 1857da25ab0..f2695591905 100644 --- a/tests/Core/Command/SystemTag/EditTest.php +++ b/tests/Core/Command/SystemTag/EditTest.php @@ -87,7 +87,7 @@ class EditTest extends TestCase { $this->output->expects($this->once()) ->method('writeln') ->with( - '<info>Tag updated ("'.$newTagName.'", '.$newTagUserVisible.', '.$newTagUserAssignable.')</info>' + '<info>Tag updated ("' . $newTagName . '", ' . $newTagUserVisible . ', ' . $newTagUserAssignable . ')</info>' ); $this->invokePrivate($this->command, 'execute', [$this->input, $this->output]); @@ -135,7 +135,7 @@ class EditTest extends TestCase { $this->systemTagManager->method('updateTag') ->willReturnCallback(function ($tagId, $tagName, $userVisible, $userAssignable) { throw new TagAlreadyExistsException( - 'Tag ("' . $tagName . '", '. $userVisible . ', ' . $userAssignable . ') already exists' + 'Tag ("' . $tagName . '", ' . $userVisible . ', ' . $userAssignable . ') already exists' ); }); @@ -151,7 +151,7 @@ class EditTest extends TestCase { $this->output->expects($this->once()) ->method('writeln') ->with( - '<error>Tag ("' . $newTagName . '", '. $newTagUserVisible . ', ' . $newTagUserAssignable . ') already exists</error>' + '<error>Tag ("' . $newTagName . '", ' . $newTagUserVisible . ', ' . $newTagUserAssignable . ') already exists</error>' ); $this->invokePrivate($this->command, 'execute', [$this->input, $this->output]); diff --git a/tests/Core/Controller/AppPasswordControllerTest.php b/tests/Core/Controller/AppPasswordControllerTest.php index f0246561145..b33033edac3 100644 --- a/tests/Core/Controller/AppPasswordControllerTest.php +++ b/tests/Core/Controller/AppPasswordControllerTest.php @@ -128,7 +128,7 @@ class AppPasswordControllerTest extends TestCase { $this->random->method('generate') ->with( 72, - ISecureRandom::CHAR_UPPER.ISecureRandom::CHAR_LOWER.ISecureRandom::CHAR_DIGITS + ISecureRandom::CHAR_UPPER . ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_DIGITS )->willReturn('myToken'); $this->tokenProvider->expects($this->once()) @@ -169,7 +169,7 @@ class AppPasswordControllerTest extends TestCase { $this->random->method('generate') ->with( 72, - ISecureRandom::CHAR_UPPER.ISecureRandom::CHAR_LOWER.ISecureRandom::CHAR_DIGITS + ISecureRandom::CHAR_UPPER . ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_DIGITS )->willReturn('myToken'); $this->tokenProvider->expects($this->once()) diff --git a/tests/Core/Controller/AvatarControllerTest.php b/tests/Core/Controller/AvatarControllerTest.php index 3a1123c940b..0dca611b020 100644 --- a/tests/Core/Controller/AvatarControllerTest.php +++ b/tests/Core/Controller/AvatarControllerTest.php @@ -309,7 +309,7 @@ class AvatarControllerTest extends \Test\TestCase { * Fetch tmp avatar */ public function testTmpAvatarValid(): void { - $this->cache->method('get')->willReturn(file_get_contents(\OC::$SERVERROOT.'/tests/data/testimage.jpg')); + $this->cache->method('get')->willReturn(file_get_contents(\OC::$SERVERROOT . '/tests/data/testimage.jpg')); $response = $this->avatarController->getTmpAvatar(); $this->assertEquals(Http::STATUS_OK, $response->getStatus()); @@ -331,14 +331,14 @@ class AvatarControllerTest extends \Test\TestCase { public function testPostAvatarFile(): void { //Create temp file $fileName = tempnam('', 'avatarTest'); - $copyRes = copy(\OC::$SERVERROOT.'/tests/data/testimage.jpg', $fileName); + $copyRes = copy(\OC::$SERVERROOT . '/tests/data/testimage.jpg', $fileName); $this->assertTrue($copyRes); //Create file in cache - $this->cache->method('get')->willReturn(file_get_contents(\OC::$SERVERROOT.'/tests/data/testimage.jpg')); + $this->cache->method('get')->willReturn(file_get_contents(\OC::$SERVERROOT . '/tests/data/testimage.jpg')); //Create request return - $reqRet = ['error' => [0], 'tmp_name' => [$fileName], 'size' => [filesize(\OC::$SERVERROOT.'/tests/data/testimage.jpg')]]; + $reqRet = ['error' => [0], 'tmp_name' => [$fileName], 'size' => [filesize(\OC::$SERVERROOT . '/tests/data/testimage.jpg')]]; $this->request->method('getUploadedFile')->willReturn($reqRet); $response = $this->avatarController->postAvatar(null); @@ -369,14 +369,14 @@ class AvatarControllerTest extends \Test\TestCase { public function testPostAvatarFileGif(): void { //Create temp file $fileName = tempnam('', 'avatarTest'); - $copyRes = copy(\OC::$SERVERROOT.'/tests/data/testimage.gif', $fileName); + $copyRes = copy(\OC::$SERVERROOT . '/tests/data/testimage.gif', $fileName); $this->assertTrue($copyRes); //Create file in cache - $this->cache->method('get')->willReturn(file_get_contents(\OC::$SERVERROOT.'/tests/data/testimage.gif')); + $this->cache->method('get')->willReturn(file_get_contents(\OC::$SERVERROOT . '/tests/data/testimage.gif')); //Create request return - $reqRet = ['error' => [0], 'tmp_name' => [$fileName], 'size' => [filesize(\OC::$SERVERROOT.'/tests/data/testimage.gif')]]; + $reqRet = ['error' => [0], 'tmp_name' => [$fileName], 'size' => [filesize(\OC::$SERVERROOT . '/tests/data/testimage.gif')]]; $this->request->method('getUploadedFile')->willReturn($reqRet); $response = $this->avatarController->postAvatar(null); @@ -396,7 +396,7 @@ class AvatarControllerTest extends \Test\TestCase { ->disableOriginalConstructor()->getMock(); $file->expects($this->once()) ->method('getContent') - ->willReturn(file_get_contents(\OC::$SERVERROOT.'/tests/data/testimage.jpg')); + ->willReturn(file_get_contents(\OC::$SERVERROOT . '/tests/data/testimage.jpg')); $file->expects($this->once()) ->method('getMimeType') ->willReturn('image/jpeg'); @@ -474,7 +474,7 @@ class AvatarControllerTest extends \Test\TestCase { ->disableOriginalConstructor()->getMock(); $file->expects($this->once()) ->method('getContent') - ->willReturn(file_get_contents(\OC::$SERVERROOT.'/tests/data/testimage.jpg')); + ->willReturn(file_get_contents(\OC::$SERVERROOT . '/tests/data/testimage.jpg')); $file->expects($this->once()) ->method('getMimeType') ->willReturn('image/jpeg'); @@ -512,7 +512,7 @@ class AvatarControllerTest extends \Test\TestCase { * Test with non square crop */ public function testPostCroppedAvatarNoSquareCrop(): void { - $this->cache->method('get')->willReturn(file_get_contents(\OC::$SERVERROOT.'/tests/data/testimage.jpg')); + $this->cache->method('get')->willReturn(file_get_contents(\OC::$SERVERROOT . '/tests/data/testimage.jpg')); $this->avatarMock->method('set')->will($this->throwException(new \OC\NotSquareException)); $this->avatarManager->method('getAvatar')->willReturn($this->avatarMock); @@ -525,7 +525,7 @@ class AvatarControllerTest extends \Test\TestCase { * Check for proper reply on proper crop argument */ public function testPostCroppedAvatarValidCrop(): void { - $this->cache->method('get')->willReturn(file_get_contents(\OC::$SERVERROOT.'/tests/data/testimage.jpg')); + $this->cache->method('get')->willReturn(file_get_contents(\OC::$SERVERROOT . '/tests/data/testimage.jpg')); $this->avatarManager->method('getAvatar')->willReturn($this->avatarMock); $response = $this->avatarController->postCroppedAvatar(['x' => 0, 'y' => 0, 'w' => 10, 'h' => 10]); @@ -537,7 +537,7 @@ class AvatarControllerTest extends \Test\TestCase { * Test what happens if the cropping of the avatar fails */ public function testPostCroppedAvatarException(): void { - $this->cache->method('get')->willReturn(file_get_contents(\OC::$SERVERROOT.'/tests/data/testimage.jpg')); + $this->cache->method('get')->willReturn(file_get_contents(\OC::$SERVERROOT . '/tests/data/testimage.jpg')); $this->avatarMock->method('set')->will($this->throwException(new \Exception('foo'))); $this->avatarManager->method('getAvatar')->willReturn($this->avatarMock); @@ -554,7 +554,7 @@ class AvatarControllerTest extends \Test\TestCase { * Check for proper reply on proper crop argument */ public function testFileTooBig(): void { - $fileName = \OC::$SERVERROOT.'/tests/data/testimage.jpg'; + $fileName = \OC::$SERVERROOT . '/tests/data/testimage.jpg'; //Create request return $reqRet = ['error' => [0], 'tmp_name' => [$fileName], 'size' => [21 * 1024 * 1024]]; $this->request->method('getUploadedFile')->willReturn($reqRet); diff --git a/tests/Core/Controller/ClientFlowLoginControllerTest.php b/tests/Core/Controller/ClientFlowLoginControllerTest.php index a38f73c85a6..7f9f11db7e3 100644 --- a/tests/Core/Controller/ClientFlowLoginControllerTest.php +++ b/tests/Core/Controller/ClientFlowLoginControllerTest.php @@ -137,7 +137,7 @@ class ClientFlowLoginControllerTest extends TestCase { ->method('generate') ->with( 64, - ISecureRandom::CHAR_LOWER.ISecureRandom::CHAR_UPPER.ISecureRandom::CHAR_DIGITS + ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_UPPER . ISecureRandom::CHAR_DIGITS ) ->willReturn('StateToken'); $this->session @@ -207,7 +207,7 @@ class ClientFlowLoginControllerTest extends TestCase { ->method('generate') ->with( 64, - ISecureRandom::CHAR_LOWER.ISecureRandom::CHAR_UPPER.ISecureRandom::CHAR_DIGITS + ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_UPPER . ISecureRandom::CHAR_DIGITS ) ->willReturn('StateToken'); $this->session @@ -448,8 +448,8 @@ class ClientFlowLoginControllerTest extends TestCase { [128] ) ->willReturnMap([ - [72, ISecureRandom::CHAR_UPPER.ISecureRandom::CHAR_LOWER.ISecureRandom::CHAR_DIGITS, 'MyGeneratedToken'], - [128, ISecureRandom::CHAR_UPPER.ISecureRandom::CHAR_LOWER.ISecureRandom::CHAR_DIGITS, 'MyAccessCode'], + [72, ISecureRandom::CHAR_UPPER . ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_DIGITS, 'MyGeneratedToken'], + [128, ISecureRandom::CHAR_UPPER . ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_DIGITS, 'MyAccessCode'], ]); $user = $this->createMock(IUser::class); $user diff --git a/tests/Core/Controller/ClientFlowLoginV2ControllerTest.php b/tests/Core/Controller/ClientFlowLoginV2ControllerTest.php index 093b8a3442d..98c7821791d 100644 --- a/tests/Core/Controller/ClientFlowLoginV2ControllerTest.php +++ b/tests/Core/Controller/ClientFlowLoginV2ControllerTest.php @@ -161,7 +161,7 @@ class ClientFlowLoginV2ControllerTest extends TestCase { ->willReturn($flow); $this->random->method('generate') - ->with(64, ISecureRandom::CHAR_LOWER.ISecureRandom::CHAR_UPPER.ISecureRandom::CHAR_DIGITS) + ->with(64, ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_UPPER . ISecureRandom::CHAR_DIGITS) ->willReturn('random'); $this->session->expects($this->once()) ->method('set') diff --git a/tests/Core/Service/LoginFlowV2ServiceUnitTest.php b/tests/Core/Service/LoginFlowV2ServiceUnitTest.php index 2fb61a2ef08..1c31efee8f7 100644 --- a/tests/Core/Service/LoginFlowV2ServiceUnitTest.php +++ b/tests/Core/Service/LoginFlowV2ServiceUnitTest.php @@ -296,7 +296,7 @@ class LoginFlowV2ServiceUnitTest extends TestCase { $this->secureRandom->expects($this->once()) ->method('generate') - ->with(72, ISecureRandom::CHAR_UPPER.ISecureRandom::CHAR_LOWER.ISecureRandom::CHAR_DIGITS) + ->with(72, ISecureRandom::CHAR_UPPER . ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_DIGITS) ->willReturn('test_pass'); // session token diff --git a/tests/enable_all.php b/tests/enable_all.php index db01de6ec41..54e5614e55a 100644 --- a/tests/enable_all.php +++ b/tests/enable_all.php @@ -5,7 +5,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -require_once __DIR__.'/../lib/base.php'; +require_once __DIR__ . '/../lib/base.php'; function enableApp($app) { try { diff --git a/tests/lib/AllConfigTest.php b/tests/lib/AllConfigTest.php index f8b2e8e857f..5d2091780a0 100644 --- a/tests/lib/AllConfigTest.php +++ b/tests/lib/AllConfigTest.php @@ -231,7 +231,7 @@ class AllConfigTest extends \Test\TestCase { $connectionMock = $this->createMock(IDBConnection::class); $connectionMock->expects($this->once()) ->method('executeQuery') - ->with($this->equalTo('SELECT `configvalue` FROM `*PREFIX*preferences` '. + ->with($this->equalTo('SELECT `configvalue` FROM `*PREFIX*preferences` ' . 'WHERE `userid` = ? AND `appid` = ? AND `configkey` = ?'), $this->equalTo(['userSetUnchanged', 'appSetUnchanged', 'keySetUnchanged'])) ->willReturn($resultMock); diff --git a/tests/lib/App/AppManagerTest.php b/tests/lib/App/AppManagerTest.php index 5c79a75bf0d..266a60bf159 100644 --- a/tests/lib/App/AppManagerTest.php +++ b/tests/lib/App/AppManagerTest.php @@ -142,7 +142,7 @@ class AppManagerTest extends TestCase { /** * @dataProvider dataGetAppIcon */ - public function testGetAppIcon($callback, ?bool $dark, string|null $expected): void { + public function testGetAppIcon($callback, ?bool $dark, ?string $expected): void { $this->urlGenerator->expects($this->atLeastOnce()) ->method('imagePath') ->willReturnCallback($callback); diff --git a/tests/lib/App/AppStore/Fetcher/AppDiscoverFetcherTest.php b/tests/lib/App/AppStore/Fetcher/AppDiscoverFetcherTest.php index fdc8b45cf70..e7652d5c50c 100644 --- a/tests/lib/App/AppStore/Fetcher/AppDiscoverFetcherTest.php +++ b/tests/lib/App/AppStore/Fetcher/AppDiscoverFetcherTest.php @@ -74,7 +74,7 @@ class AppDiscoverFetcherTest extends FetcherBase { /** * @dataProvider dataGetETag */ - public function testGetEtag(string|null $expected, bool $throws, string $content = ''): void { + public function testGetEtag(?string $expected, bool $throws, string $content = ''): void { $folder = $this->createMock(ISimpleFolder::class); if (!$throws) { $file = $this->createMock(ISimpleFile::class); diff --git a/tests/lib/App/InfoParserTest.php b/tests/lib/App/InfoParserTest.php index 914741d05b1..66ff10266e2 100644 --- a/tests/lib/App/InfoParserTest.php +++ b/tests/lib/App/InfoParserTest.php @@ -26,7 +26,7 @@ class InfoParserTest extends TestCase { if (!is_null($expectedJson)) { $expectedData = json_decode(file_get_contents(OC::$SERVERROOT . "/tests/data/app/$expectedJson"), true); } - $data = $parser->parse(OC::$SERVERROOT. "/tests/data/app/$xmlFile"); + $data = $parser->parse(OC::$SERVERROOT . "/tests/data/app/$xmlFile"); $this->assertEquals($expectedData, $data); } diff --git a/tests/lib/AppConfigTest.php b/tests/lib/AppConfigTest.php index e6929484dc5..e8c10fe654b 100644 --- a/tests/lib/AppConfigTest.php +++ b/tests/lib/AppConfigTest.php @@ -309,7 +309,7 @@ class AppConfigTest extends TestCase { * @dataProvider providerGetKeys */ public function testIsSensitive( - string $appId, string $configKey, string $configValue, int $type, bool $lazy, bool $sensitive + string $appId, string $configKey, string $configValue, int $type, bool $lazy, bool $sensitive, ): void { $config = $this->generateAppConfig(); $this->assertEquals($sensitive, $config->isSensitive($appId, $configKey, $lazy)); @@ -352,7 +352,7 @@ class AppConfigTest extends TestCase { /** * @dataProvider providerGetKeys */ - public function testIsLazy(string $appId, string $configKey, string $configValue, int $type, bool $lazy + public function testIsLazy(string $appId, string $configKey, string $configValue, int $type, bool $lazy, ): void { $config = $this->generateAppConfig(); $this->assertEquals($lazy, $config->isLazy($appId, $configKey)); diff --git a/tests/lib/AppFramework/Http/DownloadResponseTest.php b/tests/lib/AppFramework/Http/DownloadResponseTest.php index 8ac5954e00d..ee89e8e55d1 100644 --- a/tests/lib/AppFramework/Http/DownloadResponseTest.php +++ b/tests/lib/AppFramework/Http/DownloadResponseTest.php @@ -34,7 +34,7 @@ class DownloadResponseTest extends \Test\TestCase { $response = new ChildDownloadResponse($input, 'content'); $headers = $response->getHeaders(); - $this->assertEquals('attachment; filename="'.$expected.'"', $headers['Content-Disposition']); + $this->assertEquals('attachment; filename="' . $expected . '"', $headers['Content-Disposition']); } public function filenameEncodingProvider() : array { diff --git a/tests/lib/AppFramework/Routing/RoutingTest.php b/tests/lib/AppFramework/Routing/RoutingTest.php index 32b57e7bf21..8522382ddcc 100644 --- a/tests/lib/AppFramework/Routing/RoutingTest.php +++ b/tests/lib/AppFramework/Routing/RoutingTest.php @@ -441,7 +441,7 @@ class RoutingTest extends \Test\TestCase { $controllerName, $actionName, array $requirements = [], - array $defaults = [] + array $defaults = [], ) { $route = $this->getMockBuilder(Route::class) ->onlyMethods(['method', 'requirements', 'defaults']) diff --git a/tests/lib/AppTest.php b/tests/lib/AppTest.php index e6759170fb1..41643b49ddc 100644 --- a/tests/lib/AppTest.php +++ b/tests/lib/AppTest.php @@ -621,14 +621,14 @@ class AppTest extends \Test\TestCase { public function testParseAppInfoL10N(): void { $parser = new InfoParser(); - $data = $parser->parse(\OC::$SERVERROOT. '/tests/data/app/description-multi-lang.xml'); + $data = $parser->parse(\OC::$SERVERROOT . '/tests/data/app/description-multi-lang.xml'); $this->assertEquals('English', \OC_App::parseAppInfo($data, 'en')['description']); $this->assertEquals('German', \OC_App::parseAppInfo($data, 'de')['description']); } public function testParseAppInfoL10NSingleLanguage(): void { $parser = new InfoParser(); - $data = $parser->parse(\OC::$SERVERROOT. '/tests/data/app/description-single-lang.xml'); + $data = $parser->parse(\OC::$SERVERROOT . '/tests/data/app/description-single-lang.xml'); $this->assertEquals('English', \OC_App::parseAppInfo($data, 'en')['description']); } } diff --git a/tests/lib/Archive/TestBase.php b/tests/lib/Archive/TestBase.php index 3f2d8c9561e..fda485d2dc1 100644 --- a/tests/lib/Archive/TestBase.php +++ b/tests/lib/Archive/TestBase.php @@ -28,10 +28,10 @@ abstract class TestBase extends \Test\TestCase { $this->instance = $this->getExisting(); $allFiles = $this->instance->getFiles(); $expected = ['lorem.txt','logo-wide.png','dir/', 'dir/lorem.txt']; - $this->assertEquals(4, count($allFiles), 'only found '.count($allFiles).' out of 4 expected files'); + $this->assertEquals(4, count($allFiles), 'only found ' . count($allFiles) . ' out of 4 expected files'); foreach ($expected as $file) { - $this->assertContains($file, $allFiles, 'cant find '. $file . ' in archive'); - $this->assertTrue($this->instance->fileExists($file), 'file '.$file.' does not exist in archive'); + $this->assertContains($file, $allFiles, 'cant find ' . $file . ' in archive'); + $this->assertTrue($this->instance->fileExists($file), 'file ' . $file . ' does not exist in archive'); } $this->assertFalse($this->instance->fileExists('non/existing/file')); @@ -39,21 +39,21 @@ abstract class TestBase extends \Test\TestCase { $expected = ['lorem.txt','logo-wide.png', 'dir/']; $this->assertEquals(3, count($rootContent)); foreach ($expected as $file) { - $this->assertContains($file, $rootContent, 'cant find '. $file . ' in archive'); + $this->assertContains($file, $rootContent, 'cant find ' . $file . ' in archive'); } $dirContent = $this->instance->getFolder('dir/'); $expected = ['lorem.txt']; $this->assertEquals(1, count($dirContent)); foreach ($expected as $file) { - $this->assertContains($file, $dirContent, 'cant find '. $file . ' in archive'); + $this->assertContains($file, $dirContent, 'cant find ' . $file . ' in archive'); } } public function testContent(): void { $this->instance = $this->getExisting(); - $dir = \OC::$SERVERROOT.'/tests/data'; - $textFile = $dir.'/lorem.txt'; + $dir = \OC::$SERVERROOT . '/tests/data'; + $textFile = $dir . '/lorem.txt'; $this->assertEquals(file_get_contents($textFile), $this->instance->getFile('lorem.txt')); $tmpFile = \OC::$server->getTempManager()->getTemporaryFile('.txt'); @@ -62,8 +62,8 @@ abstract class TestBase extends \Test\TestCase { } public function testWrite(): void { - $dir = \OC::$SERVERROOT.'/tests/data'; - $textFile = $dir.'/lorem.txt'; + $dir = \OC::$SERVERROOT . '/tests/data'; + $textFile = $dir . '/lorem.txt'; $this->instance = $this->getNew(); $this->assertEquals(0, count($this->instance->getFiles())); $this->instance->addFile('lorem.txt', $textFile); @@ -77,24 +77,24 @@ abstract class TestBase extends \Test\TestCase { } public function testReadStream(): void { - $dir = \OC::$SERVERROOT.'/tests/data'; + $dir = \OC::$SERVERROOT . '/tests/data'; $this->instance = $this->getExisting(); $fh = $this->instance->getStream('lorem.txt', 'r'); $this->assertTrue((bool)$fh); $content = fread($fh, $this->instance->filesize('lorem.txt')); fclose($fh); - $this->assertEquals(file_get_contents($dir.'/lorem.txt'), $content); + $this->assertEquals(file_get_contents($dir . '/lorem.txt'), $content); } public function testWriteStream(): void { - $dir = \OC::$SERVERROOT.'/tests/data'; + $dir = \OC::$SERVERROOT . '/tests/data'; $this->instance = $this->getNew(); $fh = $this->instance->getStream('lorem.txt', 'w'); - $source = fopen($dir.'/lorem.txt', 'r'); + $source = fopen($dir . '/lorem.txt', 'r'); \OCP\Files::streamCopy($source, $fh); fclose($source); fclose($fh); $this->assertTrue($this->instance->fileExists('lorem.txt')); - $this->assertEquals(file_get_contents($dir.'/lorem.txt'), $this->instance->getFile('lorem.txt')); + $this->assertEquals(file_get_contents($dir . '/lorem.txt'), $this->instance->getFile('lorem.txt')); } public function testFolder(): void { $this->instance = $this->getNew(); @@ -108,19 +108,19 @@ abstract class TestBase extends \Test\TestCase { $this->assertFalse($this->instance->fileExists('/test/')); } public function testExtract(): void { - $dir = \OC::$SERVERROOT.'/tests/data'; + $dir = \OC::$SERVERROOT . '/tests/data'; $this->instance = $this->getExisting(); $tmpDir = \OC::$server->getTempManager()->getTemporaryFolder(); $this->instance->extract($tmpDir); - $this->assertEquals(true, file_exists($tmpDir.'lorem.txt')); - $this->assertEquals(true, file_exists($tmpDir.'dir/lorem.txt')); - $this->assertEquals(true, file_exists($tmpDir.'logo-wide.png')); - $this->assertEquals(file_get_contents($dir.'/lorem.txt'), file_get_contents($tmpDir.'lorem.txt')); + $this->assertEquals(true, file_exists($tmpDir . 'lorem.txt')); + $this->assertEquals(true, file_exists($tmpDir . 'dir/lorem.txt')); + $this->assertEquals(true, file_exists($tmpDir . 'logo-wide.png')); + $this->assertEquals(file_get_contents($dir . '/lorem.txt'), file_get_contents($tmpDir . 'lorem.txt')); \OCP\Files::rmdirr($tmpDir); } public function testMoveRemove(): void { - $dir = \OC::$SERVERROOT.'/tests/data'; - $textFile = $dir.'/lorem.txt'; + $dir = \OC::$SERVERROOT . '/tests/data'; + $textFile = $dir . '/lorem.txt'; $this->instance = $this->getNew(); $this->instance->addFile('lorem.txt', $textFile); $this->assertFalse($this->instance->fileExists('target.txt')); @@ -132,7 +132,7 @@ abstract class TestBase extends \Test\TestCase { $this->assertFalse($this->instance->fileExists('target.txt')); } public function testRecursive(): void { - $dir = \OC::$SERVERROOT.'/tests/data'; + $dir = \OC::$SERVERROOT . '/tests/data'; $this->instance = $this->getNew(); $this->instance->addRecursive('/dir', $dir); $this->assertTrue($this->instance->fileExists('/dir/lorem.txt')); diff --git a/tests/lib/Archive/ZIPTest.php b/tests/lib/Archive/ZIPTest.php index 62467ca230e..25707e4b051 100644 --- a/tests/lib/Archive/ZIPTest.php +++ b/tests/lib/Archive/ZIPTest.php @@ -16,6 +16,6 @@ class ZIPTest extends TestBase { } protected function getNew() { - return new ZIP(\OC::$server->getTempManager()->getTempBaseDir().'/newArchive.zip'); + return new ZIP(\OC::$server->getTempManager()->getTempBaseDir() . '/newArchive.zip'); } } diff --git a/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php b/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php index be90d60c64f..6097c1f482d 100644 --- a/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php +++ b/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php @@ -307,7 +307,7 @@ class PublicKeyTokenProviderTest extends TestCase { $this->mapper->expects($this->exactly(2)) ->method('invalidate') ->withConsecutive( - [hash('sha512', 'token7'.'1f4h9s')], + [hash('sha512', 'token7' . '1f4h9s')], [hash('sha512', 'token7')] ); @@ -443,7 +443,7 @@ class PublicKeyTokenProviderTest extends TestCase { $this->mapper->method('getToken') ->with( $this->callback(function (string $token) { - return hash('sha512', 'unhashedTokentokentokentokentoken'.'1f4h9s') === $token; + return hash('sha512', 'unhashedTokentokentokentokentoken' . '1f4h9s') === $token; }) )->willReturn($token); @@ -457,7 +457,7 @@ class PublicKeyTokenProviderTest extends TestCase { ->method('getToken') ->withConsecutive( [$this->callback(function (string $token): bool { - return hash('sha512', 'unhashedTokentokentokentokentoken'.'1f4h9s') === $token; + return hash('sha512', 'unhashedTokentokentokentokentoken' . '1f4h9s') === $token; })], [$this->callback(function (string $token): bool { return hash('sha512', 'unhashedTokentokentokentokentoken') === $token; @@ -481,7 +481,7 @@ class PublicKeyTokenProviderTest extends TestCase { $this->mapper->method('getToken') ->with( $this->callback(function (string $token) { - return hash('sha512', 'tokentokentokentokentoken'.'1f4h9s') === $token; + return hash('sha512', 'tokentokentokentokentoken' . '1f4h9s') === $token; }) )->willReturn($actual); diff --git a/tests/lib/Collaboration/Collaborators/GroupPluginTest.php b/tests/lib/Collaboration/Collaborators/GroupPluginTest.php index e52ae95bf34..8fe71234906 100644 --- a/tests/lib/Collaboration/Collaborators/GroupPluginTest.php +++ b/tests/lib/Collaboration/Collaborators/GroupPluginTest.php @@ -440,7 +440,7 @@ class GroupPluginTest extends TestCase { array $exactExpected, array $expected, bool $reachedEnd, - $singleGroup + $singleGroup, ): void { $this->config->expects($this->any()) ->method('getAppValue') diff --git a/tests/lib/Collaboration/Collaborators/SearchTest.php b/tests/lib/Collaboration/Collaborators/SearchTest.php index 88bdfa6047e..3e43d6331b2 100644 --- a/tests/lib/Collaboration/Collaborators/SearchTest.php +++ b/tests/lib/Collaboration/Collaborators/SearchTest.php @@ -42,7 +42,7 @@ class SearchTest extends TestCase { array $mockedRemotesResult, array $mockedMailResult, array $expected, - bool $expectedMoreResults + bool $expectedMoreResults, ): void { $searchResult = new SearchResult(); diff --git a/tests/lib/Collaboration/Collaborators/UserPluginTest.php b/tests/lib/Collaboration/Collaborators/UserPluginTest.php index c6a266b55d6..453f16c6686 100644 --- a/tests/lib/Collaboration/Collaborators/UserPluginTest.php +++ b/tests/lib/Collaboration/Collaborators/UserPluginTest.php @@ -441,7 +441,7 @@ class UserPluginTest extends TestCase { $reachedEnd, $singleUser, array $users = [], - $shareeEnumerationPhone = false + $shareeEnumerationPhone = false, ): void { $this->mockConfig(['core' => [ 'shareapi_only_share_with_group_members' => $shareWithGroupOnly ? 'yes' : 'no', diff --git a/tests/lib/Comments/FakeManager.php b/tests/lib/Comments/FakeManager.php index b22264cb216..155bbc59dce 100644 --- a/tests/lib/Comments/FakeManager.php +++ b/tests/lib/Comments/FakeManager.php @@ -26,7 +26,7 @@ class FakeManager implements ICommentsManager { $objectId, $limit = 0, $offset = 0, - ?\DateTime $notOlderThan = null + ?\DateTime $notOlderThan = null, ) { } @@ -36,7 +36,7 @@ class FakeManager implements ICommentsManager { int $lastKnownCommentId, string $sortDirection = 'asc', int $limit = 30, - bool $includeLastKnown = false + bool $includeLastKnown = false, ): array { return []; } @@ -48,7 +48,7 @@ class FakeManager implements ICommentsManager { int $lastKnownCommentId, string $sortDirection = 'asc', int $limit = 30, - bool $includeLastKnown = false + bool $includeLastKnown = false, ): array { return []; } diff --git a/tests/lib/ConfigTest.php b/tests/lib/ConfigTest.php index 94ee8da5dec..3be066c6839 100644 --- a/tests/lib/ConfigTest.php +++ b/tests/lib/ConfigTest.php @@ -23,7 +23,7 @@ class ConfigTest extends TestCase { parent::setUp(); $this->randomTmpDir = \OC::$server->getTempManager()->getTemporaryFolder(); - $this->configFile = $this->randomTmpDir.'testconfig.php'; + $this->configFile = $this->randomTmpDir . 'testconfig.php'; file_put_contents($this->configFile, self::TESTCONTENT); } @@ -155,7 +155,7 @@ class ConfigTest extends TestCase { public function testConfigMerge(): void { // Create additional config $additionalConfig = '<?php $CONFIG=array("php53"=>"totallyOutdated");'; - $additionalConfigPath = $this->randomTmpDir.'additionalConfig.testconfig.php'; + $additionalConfigPath = $this->randomTmpDir . 'additionalConfig.testconfig.php'; file_put_contents($additionalConfigPath, $additionalConfig); // Reinstantiate the config to force a read-in of the additional configs diff --git a/tests/lib/ErrorHandlerTest.php b/tests/lib/ErrorHandlerTest.php index 0846d09fd47..b45525e7962 100644 --- a/tests/lib/ErrorHandlerTest.php +++ b/tests/lib/ErrorHandlerTest.php @@ -54,7 +54,7 @@ class ErrorHandlerTest extends TestCase { * @param string $password */ public function testRemovePasswordFromError($username, $password): void { - $url = 'http://'.$username.':'.$password.'@owncloud.org'; + $url = 'http://' . $username . ':' . $password . '@owncloud.org'; $expectedResult = 'http://xxx:xxx@owncloud.org'; $this->logger->expects(self::once()) ->method('log') diff --git a/tests/lib/Files/Config/UserMountCacheTest.php b/tests/lib/Files/Config/UserMountCacheTest.php index a6f25026193..29f9334ae15 100644 --- a/tests/lib/Files/Config/UserMountCacheTest.php +++ b/tests/lib/Files/Config/UserMountCacheTest.php @@ -120,7 +120,7 @@ class UserMountCacheTest extends TestCase { } private function keyForMount(MountPoint $mount): string { - return $mount->getStorageRootId().'::'.$mount->getMountPoint(); + return $mount->getStorageRootId() . '::' . $mount->getMountPoint(); } public function testNewMounts(): void { diff --git a/tests/lib/Files/ObjectStore/ObjectStoreStorageTest.php b/tests/lib/Files/ObjectStore/ObjectStoreStorageTest.php index bbeabcf0f43..3dbdc3afc27 100644 --- a/tests/lib/Files/ObjectStore/ObjectStoreStorageTest.php +++ b/tests/lib/Files/ObjectStore/ObjectStoreStorageTest.php @@ -81,8 +81,8 @@ class ObjectStoreStorageTest extends Storage { $this->instance->rename($source, $target); - $this->assertTrue($this->instance->file_exists($target), $target.' was not created'); - $this->assertFalse($this->instance->file_exists($source), $source.' still exists'); + $this->assertTrue($this->instance->file_exists($target), $target . ' was not created'); + $this->assertFalse($this->instance->file_exists($source), $source . ' still exists'); $this->assertSameAsLorem($target); $targetId = $this->instance->getCache()->getId(ltrim($target, '/')); diff --git a/tests/lib/Files/Storage/StoragesTest.php b/tests/lib/Files/Storage/StoragesTest.php index d157d288f2c..e5a6469cdbe 100644 --- a/tests/lib/Files/Storage/StoragesTest.php +++ b/tests/lib/Files/Storage/StoragesTest.php @@ -37,8 +37,8 @@ abstract class StoragesTest extends TestCase { $this->storage1->moveFromStorage($this->storage2, $source, $target); - $this->assertTrue($this->storage1->file_exists($target), $target.' was not created'); - $this->assertFalse($this->storage2->file_exists($source), $source.' still exists'); + $this->assertTrue($this->storage1->file_exists($target), $target . ' was not created'); + $this->assertFalse($this->storage2->file_exists($source), $source . ' still exists'); $this->assertEquals('foo', $this->storage1->file_get_contents($target)); } @@ -75,8 +75,8 @@ abstract class StoragesTest extends TestCase { $this->storage1->copyFromStorage($this->storage2, $source, $target); - $this->assertTrue($this->storage1->file_exists($target), $target.' was not created'); - $this->assertTrue($this->storage2->file_exists($source), $source.' was deleted'); + $this->assertTrue($this->storage1->file_exists($target), $target . ' was not created'); + $this->assertTrue($this->storage2->file_exists($source), $source . ' was deleted'); $this->assertEquals('foo', $this->storage1->file_get_contents($target)); } diff --git a/tests/lib/Files/Storage/Wrapper/EncodingTest.php b/tests/lib/Files/Storage/Wrapper/EncodingTest.php index 4256337f08e..f52e3689155 100644 --- a/tests/lib/Files/Storage/Wrapper/EncodingTest.php +++ b/tests/lib/Files/Storage/Wrapper/EncodingTest.php @@ -114,7 +114,7 @@ class EncodingTest extends \Test\Files\Storage\Storage { return [ [self::NFD_NAME, self::NFC_NAME], [self::NFD_NAME . '/' . self::NFD_NAME, self::NFC_NAME . '/' . self::NFC_NAME], - [self::NFD_NAME . '/' . self::NFC_NAME . '/' .self::NFD_NAME, self::NFC_NAME . '/' . self::NFC_NAME . '/' . self::NFC_NAME], + [self::NFD_NAME . '/' . self::NFC_NAME . '/' . self::NFD_NAME, self::NFC_NAME . '/' . self::NFC_NAME . '/' . self::NFC_NAME], ]; } diff --git a/tests/lib/Files/Storage/Wrapper/EncryptionTest.php b/tests/lib/Files/Storage/Wrapper/EncryptionTest.php index 2a131a1ea39..851182ab3eb 100644 --- a/tests/lib/Files/Storage/Wrapper/EncryptionTest.php +++ b/tests/lib/Files/Storage/Wrapper/EncryptionTest.php @@ -948,7 +948,7 @@ class EncryptionTest extends Storage { $encryptMountPoint, $encryptionModule, $encryptionModuleShouldEncrypt, - $expected + $expected, ): void { $encryptionManager = $this->createMock(\OC\Encryption\Manager::class); $util = $this->createMock(Util::class); diff --git a/tests/lib/Files/ViewTest.php b/tests/lib/Files/ViewTest.php index 0a029889fb1..53da32b24db 100644 --- a/tests/lib/Files/ViewTest.php +++ b/tests/lib/Files/ViewTest.php @@ -1996,7 +1996,7 @@ class ViewTest extends \Test\TestCase { public function testLockBasicOperationUnlocksAfterException( $operation, $operationArgs, - $path + $path, ): void { if ($operation === 'touch') { $this->markTestSkipped('touch handles storage exceptions internally'); @@ -2081,7 +2081,7 @@ class ViewTest extends \Test\TestCase { $operation, $operationArgs, $path, - $hookType + $hookType, ): void { $view = new View('/' . $this->user . '/files/'); diff --git a/tests/lib/Http/Client/ClientTest.php b/tests/lib/Http/Client/ClientTest.php index 9c5bf1a6eb2..237bb1299e5 100644 --- a/tests/lib/Http/Client/ClientTest.php +++ b/tests/lib/Http/Client/ClientTest.php @@ -486,7 +486,7 @@ class ClientTest extends \Test\TestCase { 'on_redirect' => function ( \Psr\Http\Message\RequestInterface $request, \Psr\Http\Message\ResponseInterface $response, - \Psr\Http\Message\UriInterface $uri + \Psr\Http\Message\UriInterface $uri, ) { }, ], @@ -545,7 +545,7 @@ class ClientTest extends \Test\TestCase { 'on_redirect' => function ( \Psr\Http\Message\RequestInterface $request, \Psr\Http\Message\ResponseInterface $response, - \Psr\Http\Message\UriInterface $uri + \Psr\Http\Message\UriInterface $uri, ) { }, ], @@ -605,7 +605,7 @@ class ClientTest extends \Test\TestCase { 'on_redirect' => function ( \Psr\Http\Message\RequestInterface $request, \Psr\Http\Message\ResponseInterface $response, - \Psr\Http\Message\UriInterface $uri + \Psr\Http\Message\UriInterface $uri, ) { }, ], diff --git a/tests/lib/ImageTest.php b/tests/lib/ImageTest.php index 76b110df521..5de5435335a 100644 --- a/tests/lib/ImageTest.php +++ b/tests/lib/ImageTest.php @@ -14,27 +14,27 @@ use OCP\IConfig; class ImageTest extends \Test\TestCase { public static function tearDownAfterClass(): void { - @unlink(OC::$SERVERROOT.'/tests/data/testimage2.png'); - @unlink(OC::$SERVERROOT.'/tests/data/testimage2.jpg'); + @unlink(OC::$SERVERROOT . '/tests/data/testimage2.png'); + @unlink(OC::$SERVERROOT . '/tests/data/testimage2.jpg'); parent::tearDownAfterClass(); } public function testConstructDestruct(): void { $img = new Image(); - $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); + $img->loadFromFile(OC::$SERVERROOT . '/tests/data/testimage.png'); $this->assertInstanceOf('\OC\Image', $img); $this->assertInstanceOf('\OCP\IImage', $img); unset($img); - $imgcreate = imagecreatefromjpeg(OC::$SERVERROOT.'/tests/data/testimage.jpg'); + $imgcreate = imagecreatefromjpeg(OC::$SERVERROOT . '/tests/data/testimage.jpg'); $img = new Image(); $img->setResource($imgcreate); $this->assertInstanceOf('\OC\Image', $img); $this->assertInstanceOf('\OCP\IImage', $img); unset($img); - $base64 = base64_encode(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.gif')); + $base64 = base64_encode(file_get_contents(OC::$SERVERROOT . '/tests/data/testimage.gif')); $img = new Image(); $img->loadFromBase64($base64); $this->assertInstanceOf('\OC\Image', $img); @@ -49,7 +49,7 @@ class ImageTest extends \Test\TestCase { public function testValid(): void { $img = new Image(); - $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); + $img->loadFromFile(OC::$SERVERROOT . '/tests/data/testimage.png'); $this->assertTrue($img->valid()); $text = base64_encode('Lorem ipsum dolor sir amet …'); @@ -63,32 +63,32 @@ class ImageTest extends \Test\TestCase { public function testMimeType(): void { $img = new Image(); - $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); + $img->loadFromFile(OC::$SERVERROOT . '/tests/data/testimage.png'); $this->assertEquals('image/png', $img->mimeType()); $img = new Image(); $this->assertEquals('', $img->mimeType()); $img = new Image(); - $img->loadFromData(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.jpg')); + $img->loadFromData(file_get_contents(OC::$SERVERROOT . '/tests/data/testimage.jpg')); $this->assertEquals('image/jpeg', $img->mimeType()); $img = new Image(); - $img->loadFromBase64(base64_encode(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.gif'))); + $img->loadFromBase64(base64_encode(file_get_contents(OC::$SERVERROOT . '/tests/data/testimage.gif'))); $this->assertEquals('image/gif', $img->mimeType()); } public function testWidth(): void { $img = new Image(); - $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); + $img->loadFromFile(OC::$SERVERROOT . '/tests/data/testimage.png'); $this->assertEquals(128, $img->width()); $img = new Image(); - $img->loadFromData(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.jpg')); + $img->loadFromData(file_get_contents(OC::$SERVERROOT . '/tests/data/testimage.jpg')); $this->assertEquals(1680, $img->width()); $img = new Image(); - $img->loadFromBase64(base64_encode(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.gif'))); + $img->loadFromBase64(base64_encode(file_get_contents(OC::$SERVERROOT . '/tests/data/testimage.gif'))); $this->assertEquals(64, $img->width()); $img = new Image(); @@ -97,15 +97,15 @@ class ImageTest extends \Test\TestCase { public function testHeight(): void { $img = new Image(); - $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); + $img->loadFromFile(OC::$SERVERROOT . '/tests/data/testimage.png'); $this->assertEquals(128, $img->height()); $img = new Image(); - $img->loadFromData(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.jpg')); + $img->loadFromData(file_get_contents(OC::$SERVERROOT . '/tests/data/testimage.jpg')); $this->assertEquals(1050, $img->height()); $img = new Image(); - $img->loadFromBase64(base64_encode(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.gif'))); + $img->loadFromBase64(base64_encode(file_get_contents(OC::$SERVERROOT . '/tests/data/testimage.gif'))); $this->assertEquals(64, $img->height()); $img = new Image(); @@ -114,22 +114,22 @@ class ImageTest extends \Test\TestCase { public function testSave(): void { $img = new Image(); - $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); + $img->loadFromFile(OC::$SERVERROOT . '/tests/data/testimage.png'); $img->resize(16); - $img->save(OC::$SERVERROOT.'/tests/data/testimage2.png'); - $this->assertEquals(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage2.png'), $img->data()); + $img->save(OC::$SERVERROOT . '/tests/data/testimage2.png'); + $this->assertEquals(file_get_contents(OC::$SERVERROOT . '/tests/data/testimage2.png'), $img->data()); $img = new Image(); - $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.jpg'); + $img->loadFromFile(OC::$SERVERROOT . '/tests/data/testimage.jpg'); $img->resize(128); - $img->save(OC::$SERVERROOT.'/tests/data/testimage2.jpg'); - $this->assertEquals(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage2.jpg'), $img->data()); + $img->save(OC::$SERVERROOT . '/tests/data/testimage2.jpg'); + $this->assertEquals(file_get_contents(OC::$SERVERROOT . '/tests/data/testimage2.jpg'), $img->data()); } public function testData(): void { $img = new Image(); - $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); - $raw = imagecreatefromstring(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.png')); + $img->loadFromFile(OC::$SERVERROOT . '/tests/data/testimage.png'); + $raw = imagecreatefromstring(file_get_contents(OC::$SERVERROOT . '/tests/data/testimage.png')); // Preserve transparency imagealphablending($raw, true); imagesavealpha($raw, true); @@ -149,8 +149,8 @@ class ImageTest extends \Test\TestCase { ->with('preview_max_memory', 256) ->willReturn(256); $img = new Image(null, $appConfig, $config); - $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.jpg'); - $raw = imagecreatefromstring(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.jpg')); + $img->loadFromFile(OC::$SERVERROOT . '/tests/data/testimage.jpg'); + $raw = imagecreatefromstring(file_get_contents(OC::$SERVERROOT . '/tests/data/testimage.jpg')); imageinterlace($raw, true); ob_start(); imagejpeg($raw, null, 80); @@ -158,8 +158,8 @@ class ImageTest extends \Test\TestCase { $this->assertEquals($expected, $img->data()); $img = new Image(); - $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.gif'); - $raw = imagecreatefromstring(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.gif')); + $img->loadFromFile(OC::$SERVERROOT . '/tests/data/testimage.gif'); + $raw = imagecreatefromstring(file_get_contents(OC::$SERVERROOT . '/tests/data/testimage.gif')); ob_start(); imagegif($raw); $expected = ob_get_clean(); @@ -176,36 +176,36 @@ class ImageTest extends \Test\TestCase { */ public function testToString(): void { $img = new Image(); - $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); + $img->loadFromFile(OC::$SERVERROOT . '/tests/data/testimage.png'); $expected = base64_encode($img->data()); $this->assertEquals($expected, (string)$img); $img = new Image(); - $img->loadFromData(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.jpg')); + $img->loadFromData(file_get_contents(OC::$SERVERROOT . '/tests/data/testimage.jpg')); $expected = base64_encode($img->data()); $this->assertEquals($expected, (string)$img); $img = new Image(); - $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.gif'); + $img->loadFromFile(OC::$SERVERROOT . '/tests/data/testimage.gif'); $expected = base64_encode($img->data()); $this->assertEquals($expected, (string)$img); } public function testResize(): void { $img = new Image(); - $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); + $img->loadFromFile(OC::$SERVERROOT . '/tests/data/testimage.png'); $this->assertTrue($img->resize(32)); $this->assertEquals(32, $img->width()); $this->assertEquals(32, $img->height()); $img = new Image(); - $img->loadFromData(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.jpg')); + $img->loadFromData(file_get_contents(OC::$SERVERROOT . '/tests/data/testimage.jpg')); $this->assertTrue($img->resize(840)); $this->assertEquals(840, $img->width()); $this->assertEquals(525, $img->height()); $img = new Image(); - $img->loadFromBase64(base64_encode(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.gif'))); + $img->loadFromBase64(base64_encode(file_get_contents(OC::$SERVERROOT . '/tests/data/testimage.gif'))); $this->assertTrue($img->resize(100)); $this->assertEquals(100, $img->width()); $this->assertEquals(100, $img->height()); @@ -213,19 +213,19 @@ class ImageTest extends \Test\TestCase { public function testPreciseResize(): void { $img = new Image(); - $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); + $img->loadFromFile(OC::$SERVERROOT . '/tests/data/testimage.png'); $this->assertTrue($img->preciseResize(128, 512)); $this->assertEquals(128, $img->width()); $this->assertEquals(512, $img->height()); $img = new Image(); - $img->loadFromData(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.jpg')); + $img->loadFromData(file_get_contents(OC::$SERVERROOT . '/tests/data/testimage.jpg')); $this->assertTrue($img->preciseResize(64, 840)); $this->assertEquals(64, $img->width()); $this->assertEquals(840, $img->height()); $img = new Image(); - $img->loadFromBase64(base64_encode(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.gif'))); + $img->loadFromBase64(base64_encode(file_get_contents(OC::$SERVERROOT . '/tests/data/testimage.gif'))); $this->assertTrue($img->preciseResize(1000, 1337)); $this->assertEquals(1000, $img->width()); $this->assertEquals(1337, $img->height()); @@ -233,19 +233,19 @@ class ImageTest extends \Test\TestCase { public function testCenterCrop(): void { $img = new Image(); - $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); + $img->loadFromFile(OC::$SERVERROOT . '/tests/data/testimage.png'); $img->centerCrop(); $this->assertEquals(128, $img->width()); $this->assertEquals(128, $img->height()); $img = new Image(); - $img->loadFromData(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.jpg')); + $img->loadFromData(file_get_contents(OC::$SERVERROOT . '/tests/data/testimage.jpg')); $img->centerCrop(); $this->assertEquals(1050, $img->width()); $this->assertEquals(1050, $img->height()); $img = new Image(); - $img->loadFromBase64(base64_encode(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.gif'))); + $img->loadFromBase64(base64_encode(file_get_contents(OC::$SERVERROOT . '/tests/data/testimage.gif'))); $img->centerCrop(512); $this->assertEquals(512, $img->width()); $this->assertEquals(512, $img->height()); @@ -253,19 +253,19 @@ class ImageTest extends \Test\TestCase { public function testCrop(): void { $img = new Image(); - $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); + $img->loadFromFile(OC::$SERVERROOT . '/tests/data/testimage.png'); $this->assertTrue($img->crop(0, 0, 50, 20)); $this->assertEquals(50, $img->width()); $this->assertEquals(20, $img->height()); $img = new Image(); - $img->loadFromData(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.jpg')); + $img->loadFromData(file_get_contents(OC::$SERVERROOT . '/tests/data/testimage.jpg')); $this->assertTrue($img->crop(500, 700, 550, 300)); $this->assertEquals(550, $img->width()); $this->assertEquals(300, $img->height()); $img = new Image(); - $img->loadFromBase64(base64_encode(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.gif'))); + $img->loadFromBase64(base64_encode(file_get_contents(OC::$SERVERROOT . '/tests/data/testimage.gif'))); $this->assertTrue($img->crop(10, 10, 15, 15)); $this->assertEquals(15, $img->width()); $this->assertEquals(15, $img->height()); @@ -311,7 +311,7 @@ class ImageTest extends \Test\TestCase { */ public function testScaleDownToFitWhenSmallerAlready($filename): void { $img = new Image(); - $img->loadFromFile(OC::$SERVERROOT.'/tests/data/' . $filename); + $img->loadFromFile(OC::$SERVERROOT . '/tests/data/' . $filename); $currentWidth = $img->width(); $currentHeight = $img->height(); // We pick something larger than the image we want to scale down @@ -344,7 +344,7 @@ class ImageTest extends \Test\TestCase { */ public function testScaleDownWhenBigger($filename, $asked, $expected): void { $img = new Image(); - $img->loadFromFile(OC::$SERVERROOT.'/tests/data/' . $filename); + $img->loadFromFile(OC::$SERVERROOT . '/tests/data/' . $filename); //$this->assertTrue($img->scaleDownToFit($asked[0], $asked[1])); $img->scaleDownToFit($asked[0], $asked[1]); $this->assertEquals($expected[0], $img->width()); @@ -364,7 +364,7 @@ class ImageTest extends \Test\TestCase { */ public function testConvert($mimeType): void { $img = new Image(); - $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); + $img->loadFromFile(OC::$SERVERROOT . '/tests/data/testimage.png'); $tempFile = tempnam(sys_get_temp_dir(), 'img-test'); $img->save($tempFile, $mimeType); @@ -373,12 +373,12 @@ class ImageTest extends \Test\TestCase { public function testMemoryLimitFromFile(): void { $img = new Image(); - $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage-badheader.jpg'); + $img->loadFromFile(OC::$SERVERROOT . '/tests/data/testimage-badheader.jpg'); $this->assertFalse($img->valid()); } public function testMemoryLimitFromData(): void { - $data = file_get_contents(OC::$SERVERROOT.'/tests/data/testimage-badheader.jpg'); + $data = file_get_contents(OC::$SERVERROOT . '/tests/data/testimage-badheader.jpg'); $img = new Image(); $img->loadFromData($data); $this->assertFalse($img->valid()); diff --git a/tests/lib/InfoXmlTest.php b/tests/lib/InfoXmlTest.php index 461a2ecafa8..e579a4b4efd 100644 --- a/tests/lib/InfoXmlTest.php +++ b/tests/lib/InfoXmlTest.php @@ -125,7 +125,7 @@ class InfoXmlTest extends TestCase { if (isset($appInfo['commands'])) { foreach ($appInfo['commands'] as $command) { - $this->assertTrue(class_exists($command), 'Asserting command "'. $command . '"exists'); + $this->assertTrue(class_exists($command), 'Asserting command "' . $command . '"exists'); $this->assertInstanceOf($command, \OC::$server->query($command)); } } diff --git a/tests/lib/IntegrityCheck/CheckerTest.php b/tests/lib/IntegrityCheck/CheckerTest.php index 8d579cda529..6b6da1cc30c 100644 --- a/tests/lib/IntegrityCheck/CheckerTest.php +++ b/tests/lib/IntegrityCheck/CheckerTest.php @@ -89,8 +89,8 @@ class CheckerTest extends TestCase { ->with('NotExistingApp/appinfo') ->willReturn(true); - $keyBundle = file_get_contents(__DIR__ .'/../../data/integritycheck/SomeApp.crt'); - $rsaPrivateKey = file_get_contents(__DIR__ .'/../../data/integritycheck/SomeApp.key'); + $keyBundle = file_get_contents(__DIR__ . '/../../data/integritycheck/SomeApp.crt'); + $rsaPrivateKey = file_get_contents(__DIR__ . '/../../data/integritycheck/SomeApp.key'); $rsa = new RSA(); $rsa->loadKey($rsaPrivateKey); $x509 = new X509(); @@ -108,8 +108,8 @@ class CheckerTest extends TestCase { ->method('file_put_contents') ->will($this->throwException(new \Exception('Exception message'))); - $keyBundle = file_get_contents(__DIR__ .'/../../data/integritycheck/SomeApp.crt'); - $rsaPrivateKey = file_get_contents(__DIR__ .'/../../data/integritycheck/SomeApp.key'); + $keyBundle = file_get_contents(__DIR__ . '/../../data/integritycheck/SomeApp.crt'); + $rsaPrivateKey = file_get_contents(__DIR__ . '/../../data/integritycheck/SomeApp.key'); $rsa = new RSA(); $rsa->loadKey($rsaPrivateKey); $x509 = new X509(); @@ -139,8 +139,8 @@ class CheckerTest extends TestCase { }) ); - $keyBundle = file_get_contents(__DIR__ .'/../../data/integritycheck/SomeApp.crt'); - $rsaPrivateKey = file_get_contents(__DIR__ .'/../../data/integritycheck/SomeApp.key'); + $keyBundle = file_get_contents(__DIR__ . '/../../data/integritycheck/SomeApp.crt'); + $rsaPrivateKey = file_get_contents(__DIR__ . '/../../data/integritycheck/SomeApp.key'); $rsa = new RSA(); $rsa->loadKey($rsaPrivateKey); $x509 = new X509(); @@ -201,7 +201,7 @@ class CheckerTest extends TestCase { ) ->willReturnOnConsecutiveCalls( $signatureDataFile, - file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt') + file_get_contents(__DIR__ . '/../../data/integritycheck/root.crt') ); $this->assertSame([], $this->checker->verifyAppSignature('SomeApp')); @@ -240,7 +240,7 @@ class CheckerTest extends TestCase { ) ->willReturnOnConsecutiveCalls( $signatureDataFile, - file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt') + file_get_contents(__DIR__ . '/../../data/integritycheck/root.crt') ); $expected = [ @@ -285,7 +285,7 @@ class CheckerTest extends TestCase { ) ->willReturnOnConsecutiveCalls( $signatureDataFile, - file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt') + file_get_contents(__DIR__ . '/../../data/integritycheck/root.crt') ); @@ -345,7 +345,7 @@ class CheckerTest extends TestCase { ) ->willReturnOnConsecutiveCalls( $signatureDataFile, - file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt') + file_get_contents(__DIR__ . '/../../data/integritycheck/root.crt') ); @@ -405,7 +405,7 @@ class CheckerTest extends TestCase { ['/resources/codesigning/root.crt'], )->willReturnOnConsecutiveCalls( $signatureDataFile, - file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt') + file_get_contents(__DIR__ . '/../../data/integritycheck/root.crt') ); $expected = [ @@ -449,7 +449,7 @@ class CheckerTest extends TestCase { ['/resources/codesigning/root.crt'], )->willReturnOnConsecutiveCalls( $signatureDataFile, - file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt') + file_get_contents(__DIR__ . '/../../data/integritycheck/root.crt') ); $this->assertSame([], $this->checker->verifyAppSignature('SomeApp')); @@ -470,8 +470,8 @@ class CheckerTest extends TestCase { ->with(__DIR__ . '/core') ->willReturn(true); - $keyBundle = file_get_contents(__DIR__ .'/../../data/integritycheck/SomeApp.crt'); - $rsaPrivateKey = file_get_contents(__DIR__ .'/../../data/integritycheck/SomeApp.key'); + $keyBundle = file_get_contents(__DIR__ . '/../../data/integritycheck/SomeApp.crt'); + $rsaPrivateKey = file_get_contents(__DIR__ . '/../../data/integritycheck/SomeApp.key'); $rsa = new RSA(); $rsa->loadKey($rsaPrivateKey); $x509 = new X509(); @@ -494,8 +494,8 @@ class CheckerTest extends TestCase { ->with(__DIR__ . '/core') ->willReturn(false); - $keyBundle = file_get_contents(__DIR__ .'/../../data/integritycheck/SomeApp.crt'); - $rsaPrivateKey = file_get_contents(__DIR__ .'/../../data/integritycheck/SomeApp.key'); + $keyBundle = file_get_contents(__DIR__ . '/../../data/integritycheck/SomeApp.crt'); + $rsaPrivateKey = file_get_contents(__DIR__ . '/../../data/integritycheck/SomeApp.key'); $rsa = new RSA(); $rsa->loadKey($rsaPrivateKey); $x509 = new X509(); @@ -529,8 +529,8 @@ class CheckerTest extends TestCase { }) ); - $keyBundle = file_get_contents(__DIR__ .'/../../data/integritycheck/core.crt'); - $rsaPrivateKey = file_get_contents(__DIR__ .'/../../data/integritycheck/core.key'); + $keyBundle = file_get_contents(__DIR__ . '/../../data/integritycheck/core.crt'); + $rsaPrivateKey = file_get_contents(__DIR__ . '/../../data/integritycheck/core.key'); $rsa = new RSA(); $rsa->loadKey($rsaPrivateKey); $x509 = new X509(); @@ -564,8 +564,8 @@ class CheckerTest extends TestCase { }) ); - $keyBundle = file_get_contents(__DIR__ .'/../../data/integritycheck/core.crt'); - $rsaPrivateKey = file_get_contents(__DIR__ .'/../../data/integritycheck/core.key'); + $keyBundle = file_get_contents(__DIR__ . '/../../data/integritycheck/core.crt'); + $rsaPrivateKey = file_get_contents(__DIR__ . '/../../data/integritycheck/core.key'); $rsa = new RSA(); $rsa->loadKey($rsaPrivateKey); $x509 = new X509(); @@ -594,8 +594,8 @@ class CheckerTest extends TestCase { }) ); - $keyBundle = file_get_contents(__DIR__ .'/../../data/integritycheck/core.crt'); - $rsaPrivateKey = file_get_contents(__DIR__ .'/../../data/integritycheck/core.key'); + $keyBundle = file_get_contents(__DIR__ . '/../../data/integritycheck/core.crt'); + $rsaPrivateKey = file_get_contents(__DIR__ . '/../../data/integritycheck/core.key'); $rsa = new RSA(); $rsa->loadKey($rsaPrivateKey); $x509 = new X509(); @@ -629,8 +629,8 @@ class CheckerTest extends TestCase { }) ); - $keyBundle = file_get_contents(__DIR__ .'/../../data/integritycheck/core.crt'); - $rsaPrivateKey = file_get_contents(__DIR__ .'/../../data/integritycheck/core.key'); + $keyBundle = file_get_contents(__DIR__ . '/../../data/integritycheck/core.crt'); + $rsaPrivateKey = file_get_contents(__DIR__ . '/../../data/integritycheck/core.key'); $rsa = new RSA(); $rsa->loadKey($rsaPrivateKey); $x509 = new X509(); @@ -689,7 +689,7 @@ class CheckerTest extends TestCase { [\OC::$SERVERROOT . '/tests/data/integritycheck/app//resources/codesigning/root.crt'], )->willReturnOnConsecutiveCalls( $signatureDataFile, - file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt') + file_get_contents(__DIR__ . '/../../data/integritycheck/root.crt') ); $this->assertSame([], $this->checker->verifyCoreSignature()); @@ -727,7 +727,7 @@ class CheckerTest extends TestCase { ) ->willReturnOnConsecutiveCalls( $signatureDataFile, - file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt') + file_get_contents(__DIR__ . '/../../data/integritycheck/root.crt') ); $this->assertSame([], $this->checker->verifyCoreSignature()); @@ -774,12 +774,12 @@ class CheckerTest extends TestCase { ->method('getServerRoot') ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/mimetypeListModified'); - $signatureDataFile = file_get_contents(__DIR__ .'/../../data/integritycheck/mimetypeListModified/core/signature.json'); + $signatureDataFile = file_get_contents(__DIR__ . '/../../data/integritycheck/mimetypeListModified/core/signature.json'); $this->fileAccessHelper ->method('file_get_contents') ->willReturnMap([ [\OC::$SERVERROOT . '/tests/data/integritycheck/mimetypeListModified/core/signature.json', $signatureDataFile], - [\OC::$SERVERROOT . '/tests/data/integritycheck/mimetypeListModified/resources/codesigning/root.crt', file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')], + [\OC::$SERVERROOT . '/tests/data/integritycheck/mimetypeListModified/resources/codesigning/root.crt', file_get_contents(__DIR__ . '/../../data/integritycheck/root.crt')], ]); $this->assertSame([], $this->checker->verifyCoreSignature()); @@ -816,7 +816,7 @@ class CheckerTest extends TestCase { [\OC::$SERVERROOT . '/tests/data/integritycheck/app//resources/codesigning/root.crt'], )->willReturnOnConsecutiveCalls( $signatureDataFile, - file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt') + file_get_contents(__DIR__ . '/../../data/integritycheck/root.crt') ); $this->assertSame([], $this->checker->verifyCoreSignature()); @@ -853,7 +853,7 @@ class CheckerTest extends TestCase { [\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//resources/codesigning/root.crt'], )->willReturnOnConsecutiveCalls( $signatureDataFile, - file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt') + file_get_contents(__DIR__ . '/../../data/integritycheck/root.crt') ); $expected = [ @@ -896,7 +896,7 @@ class CheckerTest extends TestCase { [\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//resources/codesigning/root.crt'], )->willReturnOnConsecutiveCalls( $signatureDataFile, - file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt') + file_get_contents(__DIR__ . '/../../data/integritycheck/root.crt') ); $expected = [ @@ -954,7 +954,7 @@ class CheckerTest extends TestCase { [\OC::$SERVERROOT . '/tests/data/integritycheck/app//resources/codesigning/root.crt'], )->willReturnOnConsecutiveCalls( $signatureDataFile, - file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt') + file_get_contents(__DIR__ . '/../../data/integritycheck/root.crt') ); $expected = [ @@ -997,7 +997,7 @@ class CheckerTest extends TestCase { [\OC::$SERVERROOT . '/tests/data/integritycheck/app//resources/codesigning/root.crt'], )->willReturnOnConsecutiveCalls( $signatureDataFile, - file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt') + file_get_contents(__DIR__ . '/../../data/integritycheck/root.crt') ); $expected = [ diff --git a/tests/lib/L10N/L10nTest.php b/tests/lib/L10N/L10nTest.php index 26f39e41c13..32b81cf06a7 100644 --- a/tests/lib/L10N/L10nTest.php +++ b/tests/lib/L10N/L10nTest.php @@ -40,14 +40,14 @@ class L10nTest extends TestCase { } public function testSimpleTranslationWithTrailingColon(): void { - $transFile = \OC::$SERVERROOT.'/tests/data/l10n/de.json'; + $transFile = \OC::$SERVERROOT . '/tests/data/l10n/de.json'; $l = new L10N($this->getFactory(), 'test', 'de', 'de_AT', [$transFile]); $this->assertEquals('Files:', $l->t('Files:')); } public function testGermanPluralTranslations(): void { - $transFile = \OC::$SERVERROOT.'/tests/data/l10n/de.json'; + $transFile = \OC::$SERVERROOT . '/tests/data/l10n/de.json'; $l = new L10N($this->getFactory(), 'test', 'de', 'de_AT', [$transFile]); $this->assertEquals('1 Datei', (string)$l->n('%n file', '%n files', 1)); @@ -55,7 +55,7 @@ class L10nTest extends TestCase { } public function testRussianPluralTranslations(): void { - $transFile = \OC::$SERVERROOT.'/tests/data/l10n/ru.json'; + $transFile = \OC::$SERVERROOT . '/tests/data/l10n/ru.json'; $l = new L10N($this->getFactory(), 'test', 'ru', 'ru_UA', [$transFile]); $this->assertEquals('1 файл', (string)$l->n('%n file', '%n files', 1)); @@ -79,7 +79,7 @@ class L10nTest extends TestCase { } public function testCzechPluralTranslations(): void { - $transFile = \OC::$SERVERROOT.'/tests/data/l10n/cs.json'; + $transFile = \OC::$SERVERROOT . '/tests/data/l10n/cs.json'; $l = new L10N($this->getFactory(), 'test', 'cs', 'cs_CZ', [$transFile]); $this->assertEquals('1 okno', (string)$l->n('%n window', '%n windows', 1)); @@ -88,7 +88,7 @@ class L10nTest extends TestCase { } public function testGermanPluralWithCzechLocaleTranslations(): void { - $transFile = \OC::$SERVERROOT.'/tests/data/l10n/de.json'; + $transFile = \OC::$SERVERROOT . '/tests/data/l10n/de.json'; $l = new L10N($this->getFactory(), 'test', 'de', 'cs_CZ', [$transFile]); $this->assertEquals('1 Datei', (string)$l->n('%n file', '%n files', 1)); @@ -111,7 +111,7 @@ class L10nTest extends TestCase { * @param $expected */ public function testPlaceholders($string, $expected): void { - $transFile = \OC::$SERVERROOT.'/tests/data/l10n/de.json'; + $transFile = \OC::$SERVERROOT . '/tests/data/l10n/de.json'; $l = new L10N($this->getFactory(), 'test', 'de', 'de_AT', [$transFile]); $this->assertEquals($expected, $l->t($string, ['1', '2'])); diff --git a/tests/lib/Log/LogFactoryTest.php b/tests/lib/Log/LogFactoryTest.php index 22ee0dfb268..6219fd438f7 100644 --- a/tests/lib/Log/LogFactoryTest.php +++ b/tests/lib/Log/LogFactoryTest.php @@ -62,7 +62,7 @@ class LogFactoryTest extends TestCase { * @throws \OCP\AppFramework\QueryException */ public function testFile(string $type): void { - $datadir = \OC::$SERVERROOT.'/data'; + $datadir = \OC::$SERVERROOT . '/data'; $defaultLog = $datadir . '/nextcloud.log'; $this->systemConfig->expects($this->exactly(3)) @@ -82,7 +82,7 @@ class LogFactoryTest extends TestCase { ], [ '/xdev/youshallfallback', - \OC::$SERVERROOT.'/data/nextcloud.log' + \OC::$SERVERROOT . '/data/nextcloud.log' ] ]; } @@ -92,7 +92,7 @@ class LogFactoryTest extends TestCase { * @throws \OCP\AppFramework\QueryException */ public function testFileCustomPath($path, $expected): void { - $datadir = \OC::$SERVERROOT.'/data'; + $datadir = \OC::$SERVERROOT . '/data'; $defaultLog = $datadir . '/nextcloud.log'; $this->systemConfig->expects($this->exactly(3)) diff --git a/tests/lib/NavigationManagerTest.php b/tests/lib/NavigationManagerTest.php index 1297bfdf669..7767a8c2e8f 100644 --- a/tests/lib/NavigationManagerTest.php +++ b/tests/lib/NavigationManagerTest.php @@ -311,7 +311,7 @@ class NavigationManagerTest extends TestCase { 'logout' => [ 'id' => 'logout', 'order' => 99999, - 'href' => 'https://example.com/logout?requesttoken='. urlencode(\OCP\Util::callRegister()), + 'href' => 'https://example.com/logout?requesttoken=' . urlencode(\OCP\Util::callRegister()), 'icon' => '/apps/core/img/actions/logout.svg', 'name' => 'Log out', 'active' => false, diff --git a/tests/lib/Preview/BackgroundCleanupJobTest.php b/tests/lib/Preview/BackgroundCleanupJobTest.php index d9ea1718491..9c521376af5 100644 --- a/tests/lib/Preview/BackgroundCleanupJobTest.php +++ b/tests/lib/Preview/BackgroundCleanupJobTest.php @@ -96,7 +96,7 @@ class BackgroundCleanupJobTest extends \Test\TestCase { $files = []; for ($i = 0; $i < 11; $i++) { - $file = $userFolder->newFile($i.'.txt'); + $file = $userFolder->newFile($i . '.txt'); $file->putContent('hello world!'); $this->previewManager->getPreview($file); $files[] = $file; diff --git a/tests/lib/Route/RouterTest.php b/tests/lib/Route/RouterTest.php index 8647bb0f2f6..6f253d9121f 100644 --- a/tests/lib/Route/RouterTest.php +++ b/tests/lib/Route/RouterTest.php @@ -36,7 +36,7 @@ class RouterTest extends TestCase { $logger->method('info') ->willReturnCallback( function (string $message, array $data) { - $this->fail('Unexpected info log: '.(string)($data['exception'] ?? $message)); + $this->fail('Unexpected info log: ' . (string)($data['exception'] ?? $message)); } ); diff --git a/tests/lib/Security/CertificateManagerTest.php b/tests/lib/Security/CertificateManagerTest.php index 14036b3dd3b..095512d0b4f 100644 --- a/tests/lib/Security/CertificateManagerTest.php +++ b/tests/lib/Security/CertificateManagerTest.php @@ -144,7 +144,7 @@ class CertificateManagerTest extends \Test\TestCase { public function testNeedRebundling($CaBundleMtime, $targetBundleMtime, $targetBundleExists, - $expected + $expected, ): void { $view = $this->getMockBuilder(View::class) ->disableOriginalConstructor()->getMock(); diff --git a/tests/lib/Security/CertificateTest.php b/tests/lib/Security/CertificateTest.php index 8b084ca41b3..c787cc3355f 100644 --- a/tests/lib/Security/CertificateTest.php +++ b/tests/lib/Security/CertificateTest.php @@ -45,7 +45,7 @@ class CertificateTest extends \Test\TestCase { $this->expectException(\Exception::class); $this->expectExceptionMessage('Certificate could not get parsed.'); - new Certificate('file://'.__DIR__ . '/../../data/certificates/goodCertificate.crt', 'bar'); + new Certificate('file://' . __DIR__ . '/../../data/certificates/goodCertificate.crt', 'bar'); } public function testGetName(): void { diff --git a/tests/lib/Security/SecureRandomTest.php b/tests/lib/Security/SecureRandomTest.php index 08d33d4a1b3..8000917579b 100644 --- a/tests/lib/Security/SecureRandomTest.php +++ b/tests/lib/Security/SecureRandomTest.php @@ -72,7 +72,7 @@ class SecureRandomTest extends \Test\TestCase { $generator = $this->rng; $scheme = constant('OCP\Security\ISecureRandom::' . $charName); $randomString = $generator->generate(100, $scheme); - $matchesRegex = preg_match('/^'.$chars.'+$/', $randomString); + $matchesRegex = preg_match('/^' . $chars . '+$/', $randomString); $this->assertSame(1, $matchesRegex); } diff --git a/tests/lib/Share/Backend.php b/tests/lib/Share/Backend.php index 42269d7e275..489f4a9bfd1 100644 --- a/tests/lib/Share/Backend.php +++ b/tests/lib/Share/Backend.php @@ -54,11 +54,11 @@ class Backend implements \OCP\Share_Backend { $ext = substr($target, $pos); $append = ''; $i = 1; - while (in_array($name.$append.$ext, $knownTargets)) { + while (in_array($name . $append . $ext, $knownTargets)) { $append = $i; $i++; } - $target = $name.$append.$ext; + $target = $name . $append . $ext; } return $target; diff --git a/tests/lib/Share20/DefaultShareProviderTest.php b/tests/lib/Share20/DefaultShareProviderTest.php index 36f070d7c99..5bed54cc18f 100644 --- a/tests/lib/Share20/DefaultShareProviderTest.php +++ b/tests/lib/Share20/DefaultShareProviderTest.php @@ -716,7 +716,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $share2 = $this->provider->create($share); $this->assertNotNull($share2->getId()); - $this->assertSame('ocinternal:'.$share2->getId(), $share2->getFullId()); + $this->assertSame('ocinternal:' . $share2->getId(), $share2->getFullId()); $this->assertSame(IShare::TYPE_USER, $share2->getShareType()); $this->assertSame('sharedWith', $share2->getSharedWith()); $this->assertSame('sharedBy', $share2->getSharedBy()); @@ -786,7 +786,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $share2 = $this->provider->create($share); $this->assertNotNull($share2->getId()); - $this->assertSame('ocinternal:'.$share2->getId(), $share2->getFullId()); + $this->assertSame('ocinternal:' . $share2->getId(), $share2->getFullId()); $this->assertSame(IShare::TYPE_GROUP, $share2->getShareType()); $this->assertSame('sharedWith', $share2->getSharedWith()); $this->assertSame('sharedBy', $share2->getSharedBy()); @@ -855,7 +855,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $share2 = $this->provider->create($share); $this->assertNotNull($share2->getId()); - $this->assertSame('ocinternal:'.$share2->getId(), $share2->getFullId()); + $this->assertSame('ocinternal:' . $share2->getId(), $share2->getFullId()); $this->assertSame(IShare::TYPE_LINK, $share2->getShareType()); $this->assertSame('sharedBy', $share2->getSharedBy()); $this->assertSame('shareOwner', $share2->getShareOwner()); @@ -1033,7 +1033,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $groups = []; foreach (range(0, 100) as $i) { - $groups[] = 'group'.$i; + $groups[] = 'group' . $i; } $groups[] = 'sharedWith'; @@ -1287,7 +1287,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $groups = []; foreach (range(0, 100) as $i) { - $groups[] = 'group'.$i; + $groups[] = 'group' . $i; } $groups[] = 'sharedWith'; @@ -1820,9 +1820,9 @@ class DefaultShareProviderTest extends \Test\TestCase { $users = []; for ($i = 0; $i < 6; $i++) { $user = $this->createMock(IUser::class); - $user->method('getUID')->willReturn('user'.$i); + $user->method('getUID')->willReturn('user' . $i); $user->method('getDisplayName')->willReturn('user' . $i); - $users['user'.$i] = $user; + $users['user' . $i] = $user; } $this->userManager->method('get')->willReturnCallback( @@ -1878,8 +1878,8 @@ class DefaultShareProviderTest extends \Test\TestCase { $users = []; for ($i = 0; $i < 6; $i++) { $user = $this->createMock(IUser::class); - $user->method('getUID')->willReturn('user'.$i); - $users['user'.$i] = $user; + $user->method('getUID')->willReturn('user' . $i); + $users['user' . $i] = $user; } $this->userManager->method('get')->willReturnCallback( @@ -1944,8 +1944,8 @@ class DefaultShareProviderTest extends \Test\TestCase { $users = []; for ($i = 0; $i < 6; $i++) { $user = $this->createMock(IUser::class); - $user->method('getUID')->willReturn('user'.$i); - $users['user'.$i] = $user; + $user->method('getUID')->willReturn('user' . $i); + $users['user' . $i] = $user; } $this->userManager->method('get')->willReturnCallback( @@ -2001,8 +2001,8 @@ class DefaultShareProviderTest extends \Test\TestCase { $users = []; for ($i = 0; $i < 6; $i++) { $user = $this->createMock(IUser::class); - $user->method('getUID')->willReturn('user'.$i); - $users['user'.$i] = $user; + $user->method('getUID')->willReturn('user' . $i); + $users['user' . $i] = $user; } $this->userManager->method('get')->willReturnCallback( @@ -2014,9 +2014,9 @@ class DefaultShareProviderTest extends \Test\TestCase { $groups = []; for ($i = 0; $i < 2; $i++) { $group = $this->createMock(IGroup::class); - $group->method('getGID')->willReturn('group'.$i); + $group->method('getGID')->willReturn('group' . $i); $group->method('getDisplayName')->willReturn('group-displayname' . $i); - $groups['group'.$i] = $group; + $groups['group' . $i] = $group; } $this->groupManager->method('get')->willReturnCallback( @@ -2080,8 +2080,8 @@ class DefaultShareProviderTest extends \Test\TestCase { $users = []; for ($i = 0; $i < 6; $i++) { $user = $this->createMock(IUser::class); - $user->method('getUID')->willReturn('user'.$i); - $users['user'.$i] = $user; + $user->method('getUID')->willReturn('user' . $i); + $users['user' . $i] = $user; } $this->userManager->method('get')->willReturnCallback( @@ -2093,9 +2093,9 @@ class DefaultShareProviderTest extends \Test\TestCase { $groups = []; for ($i = 0; $i < 2; $i++) { $group = $this->createMock(IGroup::class); - $group->method('getGID')->willReturn('group'.$i); - $group->method('getDisplayName')->willReturn('group-displayname'.$i); - $groups['group'.$i] = $group; + $group->method('getGID')->willReturn('group' . $i); + $group->method('getDisplayName')->willReturn('group-displayname' . $i); + $groups['group' . $i] = $group; } $this->groupManager->method('get')->willReturnCallback( diff --git a/tests/lib/SubAdminTest.php b/tests/lib/SubAdminTest.php index 2827fe84d78..4cda08a2945 100644 --- a/tests/lib/SubAdminTest.php +++ b/tests/lib/SubAdminTest.php @@ -46,8 +46,8 @@ class SubAdminTest extends \Test\TestCase { // Create 3 users and 3 groups for ($i = 0; $i < 3; $i++) { - $this->users[] = $this->userManager->createUser('user'.$i, 'user'); - $this->groups[] = $this->groupManager->createGroup('group'.$i); + $this->users[] = $this->userManager->createUser('user' . $i, 'user'); + $this->groups[] = $this->groupManager->createGroup('group' . $i); } // Create admin group diff --git a/tests/lib/TaskProcessing/TaskProcessingTest.php b/tests/lib/TaskProcessing/TaskProcessingTest.php index 38675e826bf..00e1da4acb5 100644 --- a/tests/lib/TaskProcessing/TaskProcessingTest.php +++ b/tests/lib/TaskProcessing/TaskProcessingTest.php @@ -625,7 +625,7 @@ class TaskProcessingTest extends \Test\TestCase { $backgroundJob->start($this->jobList); $task = $this->manager->getTask($task->getId()); - self::assertEquals(Task::STATUS_SUCCESSFUL, $task->getStatus(), 'Status is '. $task->getStatus() . ' with error message: ' . $task->getErrorMessage()); + self::assertEquals(Task::STATUS_SUCCESSFUL, $task->getStatus(), 'Status is ' . $task->getStatus() . ' with error message: ' . $task->getErrorMessage()); self::assertEquals(['output' => 'Hello'], $task->getOutput()); self::assertEquals(1, $task->getProgress()); } @@ -729,7 +729,7 @@ class TaskProcessingTest extends \Test\TestCase { self::assertEquals(1, $task->getProgress()); self::assertTrue(isset($task->getOutput()['spectrogram'])); $node = $this->rootFolder->getFirstNodeById($task->getOutput()['spectrogram']); - self::assertNotNull($node, 'fileId:' . $task->getOutput()['spectrogram']); + self::assertNotNull($node, 'fileId:' . $task->getOutput()['spectrogram']); self::assertInstanceOf(\OCP\Files\File::class, $node); self::assertEquals('World', $node->getContent()); } diff --git a/tests/lib/TestCase.php b/tests/lib/TestCase.php index 9369a20eb81..03886d4a0be 100644 --- a/tests/lib/TestCase.php +++ b/tests/lib/TestCase.php @@ -530,7 +530,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase { * @param array $vars */ protected function assertTemplate($expectedHtml, $template, $vars = []) { - require_once __DIR__.'/../../lib/private/legacy/template/functions.php'; + require_once __DIR__ . '/../../lib/private/legacy/template/functions.php'; $requestToken = 12345; /** @var Defaults|\PHPUnit\Framework\MockObject\MockObject $l10n */ diff --git a/tests/lib/Updater/VersionCheckTest.php b/tests/lib/Updater/VersionCheckTest.php index b33829a2155..94347265427 100644 --- a/tests/lib/Updater/VersionCheckTest.php +++ b/tests/lib/Updater/VersionCheckTest.php @@ -63,7 +63,7 @@ class VersionCheckTest extends \Test\TestCase { * @return string */ private function buildUpdateUrl($baseUrl) { - return $baseUrl . '?version='.implode('x', Util::getVersion()).'xinstalledatx' . time() . 'x'.\OC_Util::getChannel().'xxx'.PHP_MAJOR_VERSION.'x'.PHP_MINOR_VERSION.'x'.PHP_RELEASE_VERSION.'x0x0'; + return $baseUrl . '?version=' . implode('x', Util::getVersion()) . 'xinstalledatx' . time() . 'x' . \OC_Util::getChannel() . 'xxx' . PHP_MAJOR_VERSION . 'x' . PHP_MINOR_VERSION . 'x' . PHP_RELEASE_VERSION . 'x0x0'; } public function testCheckInCache(): void { diff --git a/tests/preseed-config.php b/tests/preseed-config.php index f9c15939469..3095690e483 100644 --- a/tests/preseed-config.php +++ b/tests/preseed-config.php @@ -15,7 +15,7 @@ $CONFIG = [ ], ]; -if (is_dir(OC::$SERVERROOT.'/apps2')) { +if (is_dir(OC::$SERVERROOT . '/apps2')) { $CONFIG['apps_paths'][] = [ 'path' => OC::$SERVERROOT . '/apps2', 'url' => '/apps2', |