@@ -92,16 +92,16 @@ |
||
92 | 92 | |
93 | 93 | public static function dataExpireLinkShare() { |
94 | 94 | return [ |
95 | - [false, '', false, false], |
|
96 | - [false, '', true, false], |
|
97 | - [true, 'P1D', false, true], |
|
98 | - [true, 'P1D', true, false], |
|
99 | - [true, 'P1W', false, true], |
|
100 | - [true, 'P1W', true, false], |
|
101 | - [true, 'P1M', false, true], |
|
102 | - [true, 'P1M', true, false], |
|
103 | - [true, 'P1Y', false, true], |
|
104 | - [true, 'P1Y', true, false], |
|
95 | + [false, '', false, false], |
|
96 | + [false, '', true, false], |
|
97 | + [true, 'P1D', false, true], |
|
98 | + [true, 'P1D', true, false], |
|
99 | + [true, 'P1W', false, true], |
|
100 | + [true, 'P1W', true, false], |
|
101 | + [true, 'P1M', false, true], |
|
102 | + [true, 'P1M', true, false], |
|
103 | + [true, 'P1Y', false, true], |
|
104 | + [true, 'P1Y', true, false], |
|
105 | 105 | ]; |
106 | 106 | } |
107 | 107 |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $em = $this->createMock(IEncryptionModule::class); |
67 | 67 | $em->expects($this->any())->method('getId')->willReturn('id'); |
68 | 68 | $em->expects($this->any())->method('getDisplayName')->willReturn('TestDummyModule0'); |
69 | - $this->manager->registerEncryptionModule('id', 'TestDummyModule0', function () use ($em) { |
|
69 | + $this->manager->registerEncryptionModule('id', 'TestDummyModule0', function() use ($em) { |
|
70 | 70 | return $em; |
71 | 71 | }); |
72 | 72 | $this->assertFalse($this->manager->isEnabled()); |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | $this->config->expects($this->any()) |
125 | 125 | ->method('getAppValue') |
126 | 126 | ->with('core', 'default_encryption_module') |
127 | - ->willReturnCallback(function () { |
|
127 | + ->willReturnCallback(function() { |
|
128 | 128 | global $defaultId; |
129 | 129 | return $defaultId; |
130 | 130 | }); |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | $this->config->expects($this->any()) |
149 | 149 | ->method('getAppValue') |
150 | 150 | ->with('core', 'default_encryption_module') |
151 | - ->willReturnCallback(function () { |
|
151 | + ->willReturnCallback(function() { |
|
152 | 152 | global $defaultId; |
153 | 153 | return $defaultId; |
154 | 154 | }); |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | $this->config->expects($this->any()) |
174 | 174 | ->method('getAppValue') |
175 | 175 | ->with('core', 'default_encryption_module') |
176 | - ->willReturnCallback(function () { |
|
176 | + ->willReturnCallback(function() { |
|
177 | 177 | global $defaultId; |
178 | 178 | return $defaultId; |
179 | 179 | }); |
@@ -262,12 +262,12 @@ discard block |
||
262 | 262 | $encryptionModule = $this->createMock(IEncryptionModule::class); |
263 | 263 | $encryptionModule->expects($this->any()) |
264 | 264 | ->method('getId') |
265 | - ->willReturn('ID' . $id); |
|
265 | + ->willReturn('ID'.$id); |
|
266 | 266 | $encryptionModule->expects($this->any()) |
267 | 267 | ->method('getDisplayName') |
268 | - ->willReturn('TestDummyModule' . $id); |
|
268 | + ->willReturn('TestDummyModule'.$id); |
|
269 | 269 | /** @var IEncryptionModule $encryptionModule */ |
270 | - $manager->registerEncryptionModule('ID' . $id, 'TestDummyModule' . $id, function () use ($encryptionModule) { |
|
270 | + $manager->registerEncryptionModule('ID'.$id, 'TestDummyModule'.$id, function() use ($encryptionModule) { |
|
271 | 271 | return $encryptionModule; |
272 | 272 | }); |
273 | 273 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | public function testUpdate($path, $isDir, $allFiles, $numberOfFiles): void { |
88 | 88 | $updateMock = $this->getUpdateMock(['getOwnerPath']); |
89 | 89 | $updateMock->expects($this->once())->method('getOwnerPath') |
90 | - ->willReturnCallback(fn (OCPFile|Folder $node) => '/user/' . $node->getPath()); |
|
90 | + ->willReturnCallback(fn (OCPFile | Folder $node) => '/user/'.$node->getPath()); |
|
91 | 91 | |
92 | 92 | $this->encryptionManager->expects($this->once()) |
93 | 93 | ->method('getEncryptionModule') |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | */ |
128 | 128 | #[\PHPUnit\Framework\Attributes\DataProvider('dataTestPostRename')] |
129 | 129 | public function testPostRename($source, $target): void { |
130 | - $updateMock = $this->getUpdateMock(['update','getOwnerPath']); |
|
130 | + $updateMock = $this->getUpdateMock(['update', 'getOwnerPath']); |
|
131 | 131 | |
132 | 132 | $sourceNode = $this->getFileMock($source, 'user'); |
133 | 133 | $targetNode = $this->getFileMock($target, 'user'); |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | $updateMock->expects($this->never())->method('update'); |
138 | 138 | } else { |
139 | 139 | $updateMock->expects($this->once())->method('update') |
140 | - ->willReturnCallback(fn (OCPFile|Folder $node) => $this->assertSame( |
|
140 | + ->willReturnCallback(fn (OCPFile | Folder $node) => $this->assertSame( |
|
141 | 141 | $target, |
142 | 142 | $node->getPath(), |
143 | 143 | 'update needs to be executed for the target destination' |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | $updateMock = $this->getUpdateMock(['update']); |
160 | 160 | |
161 | 161 | $updateMock->expects($this->once())->method('update') |
162 | - ->willReturnCallback(fn (OCPFile|Folder $node) => $this->assertSame( |
|
162 | + ->willReturnCallback(fn (OCPFile | Folder $node) => $this->assertSame( |
|
163 | 163 | '/folder/test.txt', |
164 | 164 | $node->getPath(), |
165 | 165 | 'update needs to be executed for the target destination' |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | |
40 | 40 | public static function getMemoryLimitTestData(): array { |
41 | 41 | return [ |
42 | - 'unlimited' => ['-1', -1,], |
|
43 | - '524288000 bytes' => ['524288000', 524288000,], |
|
44 | - '500M' => ['500M', 524288000,], |
|
45 | - '512000K' => ['512000K', 524288000,], |
|
46 | - '2G' => ['2G', 2147483648,], |
|
42 | + 'unlimited' => ['-1', -1, ], |
|
43 | + '524288000 bytes' => ['524288000', 524288000, ], |
|
44 | + '500M' => ['500M', 524288000, ], |
|
45 | + '512000K' => ['512000K', 524288000, ], |
|
46 | + '2G' => ['2G', 2147483648, ], |
|
47 | 47 | ]; |
48 | 48 | } |
49 | 49 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * @param int|float $expected The expected detected memory limit. |
55 | 55 | */ |
56 | 56 | #[\PHPUnit\Framework\Attributes\DataProvider('getMemoryLimitTestData')] |
57 | - public function testMemoryLimit(string $iniValue, int|float $expected): void { |
|
57 | + public function testMemoryLimit(string $iniValue, int | float $expected): void { |
|
58 | 58 | ini_set('memory_limit', $iniValue); |
59 | 59 | $memoryInfo = new MemoryInfo(); |
60 | 60 | self::assertEquals($expected, $memoryInfo->getMemoryLimit()); |
@@ -62,10 +62,10 @@ discard block |
||
62 | 62 | |
63 | 63 | public static function getSufficientMemoryTestData(): array { |
64 | 64 | return [ |
65 | - 'unlimited' => [-1, true,], |
|
66 | - '512M' => [512 * 1024 * 1024, true,], |
|
67 | - '1G' => [1024 * 1024 * 1024, true,], |
|
68 | - '256M' => [256 * 1024 * 1024, false,], |
|
65 | + 'unlimited' => [-1, true, ], |
|
66 | + '512M' => [512 * 1024 * 1024, true, ], |
|
67 | + '1G' => [1024 * 1024 * 1024, true, ], |
|
68 | + '256M' => [256 * 1024 * 1024, false, ], |
|
69 | 69 | ]; |
70 | 70 | } |
71 | 71 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | public function testIsMemoryLimitSufficient(int $memoryLimit, bool $expected): void { |
80 | 80 | /* @var MemoryInfo|MockObject $memoryInfo */ |
81 | 81 | $memoryInfo = $this->getMockBuilder(MemoryInfo::class) |
82 | - ->onlyMethods(['getMemoryLimit',]) |
|
82 | + ->onlyMethods(['getMemoryLimit', ]) |
|
83 | 83 | ->getMock(); |
84 | 84 | |
85 | 85 | $memoryInfo |
@@ -64,8 +64,8 @@ discard block |
||
64 | 64 | */ |
65 | 65 | #[\PHPUnit\Framework\Attributes\DataProvider('fileTypeProvider')] |
66 | 66 | public function testFile(string $type): void { |
67 | - $datadir = \OC::$SERVERROOT . '/data'; |
|
68 | - $defaultLog = $datadir . '/nextcloud.log'; |
|
67 | + $datadir = \OC::$SERVERROOT.'/data'; |
|
68 | + $defaultLog = $datadir.'/nextcloud.log'; |
|
69 | 69 | |
70 | 70 | $this->systemConfig->expects($this->exactly(3)) |
71 | 71 | ->method('getValue') |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | ], |
88 | 88 | [ |
89 | 89 | '/xdev/youshallfallback', |
90 | - \OC::$SERVERROOT . '/data/nextcloud.log' |
|
90 | + \OC::$SERVERROOT.'/data/nextcloud.log' |
|
91 | 91 | ] |
92 | 92 | ]; |
93 | 93 | } |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | */ |
98 | 98 | #[\PHPUnit\Framework\Attributes\DataProvider('logFilePathProvider')] |
99 | 99 | public function testFileCustomPath($path, $expected): void { |
100 | - $datadir = \OC::$SERVERROOT . '/data'; |
|
101 | - $defaultLog = $datadir . '/nextcloud.log'; |
|
100 | + $datadir = \OC::$SERVERROOT.'/data'; |
|
101 | + $defaultLog = $datadir.'/nextcloud.log'; |
|
102 | 102 | |
103 | 103 | $this->systemConfig->expects($this->exactly(3)) |
104 | 104 | ->method('getValue') |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $fileMock->expects($this->never())->method('getAccessList'); |
129 | 129 | } else { |
130 | 130 | $fileMock->expects($this->once())->method('getAccessList') |
131 | - ->willReturnCallback(function ($sharePath) use ($expectedSharePath) { |
|
131 | + ->willReturnCallback(function($sharePath) use ($expectedSharePath) { |
|
132 | 132 | $this->assertSame($expectedSharePath, $sharePath); |
133 | 133 | return []; |
134 | 134 | }); |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | |
278 | 278 | #[\PHPUnit\Framework\Attributes\DataProvider('dataFilesProvider')] |
279 | 279 | public function testWriteReadBigFile($testFile): void { |
280 | - $expectedData = file_get_contents(\OC::$SERVERROOT . '/tests/data/' . $testFile); |
|
280 | + $expectedData = file_get_contents(\OC::$SERVERROOT.'/tests/data/'.$testFile); |
|
281 | 281 | // write it |
282 | 282 | $fileName = tempnam('/tmp', 'FOO'); |
283 | 283 | $stream = $this->getStream($fileName, 'w+', 0, self::DEFAULT_WRAPPER, strlen($expectedData)); |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | ->method('parentStreamSeek') |
321 | 321 | ->willReturn(false); |
322 | 322 | |
323 | - $expectedData = file_get_contents(\OC::$SERVERROOT . '/tests/data/' . $testFile); |
|
323 | + $expectedData = file_get_contents(\OC::$SERVERROOT.'/tests/data/'.$testFile); |
|
324 | 324 | // write it |
325 | 325 | $fileName = tempnam('/tmp', 'FOO'); |
326 | 326 | $stream = $this->getStream($fileName, 'w+', 0, '\Test\Files\Stream\DummyEncryptionWrapper', strlen($expectedData)); |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | $encryptionModule->expects($this->any())->method('end')->willReturn(''); |
364 | 364 | $encryptionModule->expects($this->any())->method('isReadable')->willReturn(true); |
365 | 365 | $encryptionModule->expects($this->any())->method('needDetailedAccessList')->willReturn(false); |
366 | - $encryptionModule->expects($this->any())->method('encrypt')->willReturnCallback(function ($data) { |
|
366 | + $encryptionModule->expects($this->any())->method('encrypt')->willReturnCallback(function($data) { |
|
367 | 367 | // simulate different block size by adding some padding to the data |
368 | 368 | if (isset($data[6125])) { |
369 | 369 | return str_pad($data, 8192, 'X'); |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | // last block |
372 | 372 | return $data; |
373 | 373 | }); |
374 | - $encryptionModule->expects($this->any())->method('decrypt')->willReturnCallback(function ($data) { |
|
374 | + $encryptionModule->expects($this->any())->method('decrypt')->willReturnCallback(function($data) { |
|
375 | 375 | if (isset($data[8191])) { |
376 | 376 | return substr($data, 0, 6126); |
377 | 377 | } |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | $this->detection = new Detection( |
23 | 23 | Server::get(IURLGenerator::class), |
24 | 24 | Server::get(LoggerInterface::class), |
25 | - \OC::$SERVERROOT . '/config/', |
|
26 | - \OC::$SERVERROOT . '/resources/config/' |
|
25 | + \OC::$SERVERROOT.'/config/', |
|
26 | + \OC::$SERVERROOT.'/resources/config/' |
|
27 | 27 | ); |
28 | 28 | } |
29 | 29 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | */ |
74 | 74 | #[\PHPUnit\Framework\Attributes\DataProvider('dataDetectContent')] |
75 | 75 | public function testDetectContent(string $path, string $expected): void { |
76 | - $this->assertEquals($expected, $this->detection->detectContent(\OC::$SERVERROOT . '/tests/data' . $path)); |
|
76 | + $this->assertEquals($expected, $this->detection->detectContent(\OC::$SERVERROOT.'/tests/data'.$path)); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | public static function dataDetect(): array { |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | */ |
94 | 94 | #[\PHPUnit\Framework\Attributes\DataProvider('dataDetect')] |
95 | 95 | public function testDetect(string $path, string $expected): void { |
96 | - $this->assertEquals($expected, $this->detection->detect(\OC::$SERVERROOT . '/tests/data' . $path)); |
|
96 | + $this->assertEquals($expected, $this->detection->detect(\OC::$SERVERROOT.'/tests/data'.$path)); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | public function testDetectString(): void { |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | #[\PHPUnit\Framework\Attributes\DataProvider('dataMimeTypeCustom')] |
119 | 119 | public function testDetectMimeTypeCustom(string $ext, string $mime): void { |
120 | 120 | $confDir = sys_get_temp_dir(); |
121 | - file_put_contents($confDir . '/mimetypemapping.dist.json', json_encode([])); |
|
121 | + file_put_contents($confDir.'/mimetypemapping.dist.json', json_encode([])); |
|
122 | 122 | |
123 | 123 | /** @var IURLGenerator $urlGenerator */ |
124 | 124 | $urlGenerator = $this->getMockBuilder(IURLGenerator::class) |
@@ -129,12 +129,12 @@ discard block |
||
129 | 129 | $logger = $this->createMock(LoggerInterface::class); |
130 | 130 | |
131 | 131 | // Create new mapping file |
132 | - file_put_contents($confDir . '/mimetypemapping.dist.json', json_encode([$ext => [$mime]])); |
|
132 | + file_put_contents($confDir.'/mimetypemapping.dist.json', json_encode([$ext => [$mime]])); |
|
133 | 133 | |
134 | 134 | $detection = new Detection($urlGenerator, $logger, $confDir, $confDir); |
135 | 135 | $mappings = $detection->getAllMappings(); |
136 | 136 | $this->assertArrayHasKey($ext, $mappings); |
137 | - $this->assertEquals($mime, $detection->detectPath('foo.' . $ext)); |
|
137 | + $this->assertEquals($mime, $detection->detectPath('foo.'.$ext)); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | public static function dataGetSecureMimeType(): array { |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | $urlGenerator->expects($this->exactly(2)) |
265 | 265 | ->method('imagePath') |
266 | 266 | ->willReturnCallback( |
267 | - function ($appName, $file) use (&$calls) { |
|
267 | + function($appName, $file) use (&$calls) { |
|
268 | 268 | $expected = array_shift($calls); |
269 | 269 | $this->assertEquals($expected, [$appName, $file]); |
270 | 270 | if ($file === 'filetypes/my.png') { |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | $urlGenerator->expects($this->exactly(3)) |
298 | 298 | ->method('imagePath') |
299 | 299 | ->willReturnCallback( |
300 | - function ($appName, $file) use (&$calls) { |
|
300 | + function($appName, $file) use (&$calls) { |
|
301 | 301 | $expected = array_shift($calls); |
302 | 302 | $this->assertEquals($expected, [$appName, $file]); |
303 | 303 | if ($file === 'filetypes/file.png') { |
@@ -53,17 +53,17 @@ discard block |
||
53 | 53 | |
54 | 54 | #[\PHPUnit\Framework\Attributes\DataProvider('directoryProvider')] |
55 | 55 | public function testDirectories($directory): void { |
56 | - $this->assertFalse($this->instance->file_exists('/' . $directory)); |
|
56 | + $this->assertFalse($this->instance->file_exists('/'.$directory)); |
|
57 | 57 | |
58 | - $this->assertTrue($this->instance->mkdir('/' . $directory)); |
|
58 | + $this->assertTrue($this->instance->mkdir('/'.$directory)); |
|
59 | 59 | |
60 | - $this->assertTrue($this->instance->file_exists('/' . $directory)); |
|
61 | - $this->assertTrue($this->instance->is_dir('/' . $directory)); |
|
62 | - $this->assertFalse($this->instance->is_file('/' . $directory)); |
|
63 | - $this->assertEquals('dir', $this->instance->filetype('/' . $directory)); |
|
64 | - $this->assertEquals(0, $this->instance->filesize('/' . $directory)); |
|
65 | - $this->assertTrue($this->instance->isReadable('/' . $directory)); |
|
66 | - $this->assertTrue($this->instance->isUpdatable('/' . $directory)); |
|
60 | + $this->assertTrue($this->instance->file_exists('/'.$directory)); |
|
61 | + $this->assertTrue($this->instance->is_dir('/'.$directory)); |
|
62 | + $this->assertFalse($this->instance->is_file('/'.$directory)); |
|
63 | + $this->assertEquals('dir', $this->instance->filetype('/'.$directory)); |
|
64 | + $this->assertEquals(0, $this->instance->filesize('/'.$directory)); |
|
65 | + $this->assertTrue($this->instance->isReadable('/'.$directory)); |
|
66 | + $this->assertTrue($this->instance->isUpdatable('/'.$directory)); |
|
67 | 67 | |
68 | 68 | $dh = $this->instance->opendir('/'); |
69 | 69 | $content = []; |
@@ -90,13 +90,13 @@ discard block |
||
90 | 90 | 'permissions' => $this->instance->getPermissions($directory), |
91 | 91 | ], $dirEntry); |
92 | 92 | |
93 | - $this->assertFalse($this->instance->mkdir('/' . $directory)); //can't create existing folders |
|
94 | - $this->assertTrue($this->instance->rmdir('/' . $directory)); |
|
93 | + $this->assertFalse($this->instance->mkdir('/'.$directory)); //can't create existing folders |
|
94 | + $this->assertTrue($this->instance->rmdir('/'.$directory)); |
|
95 | 95 | |
96 | 96 | $this->wait(); |
97 | - $this->assertFalse($this->instance->file_exists('/' . $directory)); |
|
97 | + $this->assertFalse($this->instance->file_exists('/'.$directory)); |
|
98 | 98 | |
99 | - $this->assertFalse($this->instance->rmdir('/' . $directory)); //can't remove non existing folders |
|
99 | + $this->assertFalse($this->instance->rmdir('/'.$directory)); //can't remove non existing folders |
|
100 | 100 | |
101 | 101 | $dh = $this->instance->opendir('/'); |
102 | 102 | $content = []; |
@@ -131,12 +131,12 @@ discard block |
||
131 | 131 | } |
132 | 132 | |
133 | 133 | public static function loremFileProvider(): array { |
134 | - $root = \OC::$SERVERROOT . '/tests/data/'; |
|
134 | + $root = \OC::$SERVERROOT.'/tests/data/'; |
|
135 | 135 | return [ |
136 | 136 | // small file |
137 | - [$root . 'lorem.txt'], |
|
137 | + [$root.'lorem.txt'], |
|
138 | 138 | // bigger file (> 8 KB which is the standard PHP block size) |
139 | - [$root . 'lorem-big.txt'] |
|
139 | + [$root.'lorem-big.txt'] |
|
140 | 140 | ]; |
141 | 141 | } |
142 | 142 | |
@@ -164,15 +164,15 @@ discard block |
||
164 | 164 | $this->assertEquals('httpd/unix-directory', $this->instance->getMimeType('/')); |
165 | 165 | $this->assertEquals(false, $this->instance->getMimeType('/non/existing/file')); |
166 | 166 | |
167 | - $textFile = \OC::$SERVERROOT . '/tests/data/lorem.txt'; |
|
167 | + $textFile = \OC::$SERVERROOT.'/tests/data/lorem.txt'; |
|
168 | 168 | $this->instance->file_put_contents('/lorem.txt', file_get_contents($textFile, 'r')); |
169 | 169 | $this->assertEquals('text/plain', $this->instance->getMimeType('/lorem.txt')); |
170 | 170 | |
171 | - $pngFile = \OC::$SERVERROOT . '/tests/data/desktopapp.png'; |
|
171 | + $pngFile = \OC::$SERVERROOT.'/tests/data/desktopapp.png'; |
|
172 | 172 | $this->instance->file_put_contents('/desktopapp.png', file_get_contents($pngFile, 'r')); |
173 | 173 | $this->assertEquals('image/png', $this->instance->getMimeType('/desktopapp.png')); |
174 | 174 | |
175 | - $svgFile = \OC::$SERVERROOT . '/tests/data/desktopapp.svg'; |
|
175 | + $svgFile = \OC::$SERVERROOT.'/tests/data/desktopapp.svg'; |
|
176 | 176 | $this->instance->file_put_contents('/desktopapp.svg', file_get_contents($svgFile, 'r')); |
177 | 177 | $this->assertEquals('image/svg+xml', $this->instance->getMimeType('/desktopapp.svg')); |
178 | 178 | } |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | } |
193 | 193 | |
194 | 194 | public function initSourceAndTarget($source, $target = null) { |
195 | - $textFile = \OC::$SERVERROOT . '/tests/data/lorem.txt'; |
|
195 | + $textFile = \OC::$SERVERROOT.'/tests/data/lorem.txt'; |
|
196 | 196 | $this->instance->file_put_contents($source, file_get_contents($textFile)); |
197 | 197 | if ($target) { |
198 | 198 | $testContents = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; |
@@ -201,11 +201,11 @@ discard block |
||
201 | 201 | } |
202 | 202 | |
203 | 203 | public function assertSameAsLorem($file) { |
204 | - $textFile = \OC::$SERVERROOT . '/tests/data/lorem.txt'; |
|
204 | + $textFile = \OC::$SERVERROOT.'/tests/data/lorem.txt'; |
|
205 | 205 | $this->assertEquals( |
206 | 206 | file_get_contents($textFile), |
207 | 207 | $this->instance->file_get_contents($file), |
208 | - 'Expected ' . $file . ' to be a copy of ' . $textFile |
|
208 | + 'Expected '.$file.' to be a copy of '.$textFile |
|
209 | 209 | ); |
210 | 210 | } |
211 | 211 | |
@@ -215,9 +215,9 @@ discard block |
||
215 | 215 | |
216 | 216 | $this->instance->copy($source, $target); |
217 | 217 | |
218 | - $this->assertTrue($this->instance->file_exists($target), $target . ' was not created'); |
|
218 | + $this->assertTrue($this->instance->file_exists($target), $target.' was not created'); |
|
219 | 219 | $this->assertSameAsLorem($target); |
220 | - $this->assertTrue($this->instance->file_exists($source), $source . ' was deleted'); |
|
220 | + $this->assertTrue($this->instance->file_exists($source), $source.' was deleted'); |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | #[\PHPUnit\Framework\Attributes\DataProvider('copyAndMoveProvider')] |
@@ -227,8 +227,8 @@ discard block |
||
227 | 227 | $this->instance->rename($source, $target); |
228 | 228 | |
229 | 229 | $this->wait(); |
230 | - $this->assertTrue($this->instance->file_exists($target), $target . ' was not created'); |
|
231 | - $this->assertFalse($this->instance->file_exists($source), $source . ' still exists'); |
|
230 | + $this->assertTrue($this->instance->file_exists($target), $target.' was not created'); |
|
231 | + $this->assertFalse($this->instance->file_exists($source), $source.' still exists'); |
|
232 | 232 | $this->assertSameAsLorem($target); |
233 | 233 | } |
234 | 234 | |
@@ -238,8 +238,8 @@ discard block |
||
238 | 238 | |
239 | 239 | $this->instance->copy($source, $target); |
240 | 240 | |
241 | - $this->assertTrue($this->instance->file_exists($target), $target . ' was not created'); |
|
242 | - $this->assertTrue($this->instance->file_exists($source), $source . ' was deleted'); |
|
241 | + $this->assertTrue($this->instance->file_exists($target), $target.' was not created'); |
|
242 | + $this->assertTrue($this->instance->file_exists($source), $source.' was deleted'); |
|
243 | 243 | $this->assertSameAsLorem($target); |
244 | 244 | $this->assertSameAsLorem($source); |
245 | 245 | } |
@@ -250,13 +250,13 @@ discard block |
||
250 | 250 | |
251 | 251 | $this->instance->rename($source, $target); |
252 | 252 | |
253 | - $this->assertTrue($this->instance->file_exists($target), $target . ' was not created'); |
|
254 | - $this->assertFalse($this->instance->file_exists($source), $source . ' still exists'); |
|
253 | + $this->assertTrue($this->instance->file_exists($target), $target.' was not created'); |
|
254 | + $this->assertFalse($this->instance->file_exists($source), $source.' still exists'); |
|
255 | 255 | $this->assertSameAsLorem($target); |
256 | 256 | } |
257 | 257 | |
258 | 258 | public function testLocal(): void { |
259 | - $textFile = \OC::$SERVERROOT . '/tests/data/lorem.txt'; |
|
259 | + $textFile = \OC::$SERVERROOT.'/tests/data/lorem.txt'; |
|
260 | 260 | $this->instance->file_put_contents('/lorem.txt', file_get_contents($textFile)); |
261 | 261 | $localFile = $this->instance->getLocalFile('/lorem.txt'); |
262 | 262 | $this->assertTrue(file_exists($localFile)); |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | } |
284 | 284 | |
285 | 285 | public function testStat(): void { |
286 | - $textFile = \OC::$SERVERROOT . '/tests/data/lorem.txt'; |
|
286 | + $textFile = \OC::$SERVERROOT.'/tests/data/lorem.txt'; |
|
287 | 287 | $ctimeStart = time(); |
288 | 288 | $this->instance->file_put_contents('/lorem.txt', file_get_contents($textFile)); |
289 | 289 | $this->assertTrue($this->instance->isReadable('/lorem.txt')); |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | if ($this->instance instanceof Wrapper) { |
322 | 322 | $this->markTestSkipped('Cannot test update check on wrappers'); |
323 | 323 | } |
324 | - $textFile = \OC::$SERVERROOT . '/tests/data/lorem.txt'; |
|
324 | + $textFile = \OC::$SERVERROOT.'/tests/data/lorem.txt'; |
|
325 | 325 | $watcher = $this->instance->getWatcher(); |
326 | 326 | $watcher->setPolicy(Watcher::CHECK_ALWAYS); |
327 | 327 | $this->instance->file_put_contents('/lorem.txt', file_get_contents($textFile)); |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | } |
331 | 331 | |
332 | 332 | public function testUnlink(): void { |
333 | - $textFile = \OC::$SERVERROOT . '/tests/data/lorem.txt'; |
|
333 | + $textFile = \OC::$SERVERROOT.'/tests/data/lorem.txt'; |
|
334 | 334 | $this->instance->file_put_contents('/lorem.txt', file_get_contents($textFile)); |
335 | 335 | |
336 | 336 | $this->assertTrue($this->instance->file_exists('/lorem.txt')); |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | |
344 | 344 | #[\PHPUnit\Framework\Attributes\DataProvider('fileNameProvider')] |
345 | 345 | public function testFOpen($fileName): void { |
346 | - $textFile = \OC::$SERVERROOT . '/tests/data/lorem.txt'; |
|
346 | + $textFile = \OC::$SERVERROOT.'/tests/data/lorem.txt'; |
|
347 | 347 | |
348 | 348 | $fh = @$this->instance->fopen($fileName, 'r'); |
349 | 349 | if ($fh) { |
@@ -571,9 +571,9 @@ discard block |
||
571 | 571 | |
572 | 572 | $this->instance->copyFromStorage($this->instance, $source, $target); |
573 | 573 | |
574 | - $this->assertTrue($this->instance->file_exists($target), $target . ' was not created'); |
|
574 | + $this->assertTrue($this->instance->file_exists($target), $target.' was not created'); |
|
575 | 575 | $this->assertSameAsLorem($target); |
576 | - $this->assertTrue($this->instance->file_exists($source), $source . ' was deleted'); |
|
576 | + $this->assertTrue($this->instance->file_exists($source), $source.' was deleted'); |
|
577 | 577 | } |
578 | 578 | |
579 | 579 | public function testIsCreatable(): void { |
@@ -621,7 +621,7 @@ discard block |
||
621 | 621 | } |
622 | 622 | |
623 | 623 | public function testWriteStream(): void { |
624 | - $textFile = \OC::$SERVERROOT . '/tests/data/lorem.txt'; |
|
624 | + $textFile = \OC::$SERVERROOT.'/tests/data/lorem.txt'; |
|
625 | 625 | |
626 | 626 | if (!$this->instance->instanceOfStorage(IWriteStreamStorage::class)) { |
627 | 627 | $this->markTestSkipped('Not a WriteSteamStorage'); |
@@ -638,7 +638,7 @@ discard block |
||
638 | 638 | } |
639 | 639 | |
640 | 640 | public function testFseekSize(): void { |
641 | - $textFile = \OC::$SERVERROOT . '/tests/data/lorem.txt'; |
|
641 | + $textFile = \OC::$SERVERROOT.'/tests/data/lorem.txt'; |
|
642 | 642 | $this->instance->file_put_contents('bar.txt', file_get_contents($textFile)); |
643 | 643 | |
644 | 644 | $size = $this->instance->filesize('bar.txt'); |
@@ -41,13 +41,13 @@ discard block |
||
41 | 41 | |
42 | 42 | public static function fileNameProvider(): array { |
43 | 43 | $a = parent::fileNameProvider(); |
44 | - $a[] = [self::NFD_NAME . '.txt']; |
|
44 | + $a[] = [self::NFD_NAME.'.txt']; |
|
45 | 45 | return $a; |
46 | 46 | } |
47 | 47 | |
48 | 48 | public static function copyAndMoveProvider(): array { |
49 | 49 | $a = parent::copyAndMoveProvider(); |
50 | - $a[] = [self::NFD_NAME . '.txt', self::NFC_NAME . '-renamed.txt']; |
|
50 | + $a[] = [self::NFD_NAME.'.txt', self::NFC_NAME.'-renamed.txt']; |
|
51 | 51 | return $a; |
52 | 52 | } |
53 | 53 | |
@@ -107,27 +107,27 @@ discard block |
||
107 | 107 | public static function encodedDirectoriesProvider(): array { |
108 | 108 | return [ |
109 | 109 | [self::NFD_NAME, self::NFC_NAME], |
110 | - [self::NFD_NAME . '/' . self::NFD_NAME, self::NFC_NAME . '/' . self::NFC_NAME], |
|
111 | - [self::NFD_NAME . '/' . self::NFC_NAME . '/' . self::NFD_NAME, self::NFC_NAME . '/' . self::NFC_NAME . '/' . self::NFC_NAME], |
|
110 | + [self::NFD_NAME.'/'.self::NFD_NAME, self::NFC_NAME.'/'.self::NFC_NAME], |
|
111 | + [self::NFD_NAME.'/'.self::NFC_NAME.'/'.self::NFD_NAME, self::NFC_NAME.'/'.self::NFC_NAME.'/'.self::NFC_NAME], |
|
112 | 112 | ]; |
113 | 113 | } |
114 | 114 | |
115 | 115 | #[\PHPUnit\Framework\Attributes\DataProvider('encodedDirectoriesProvider')] |
116 | 116 | public function testOperationInsideDirectory($sourceDir, $accessDir): void { |
117 | 117 | $this->sourceStorage->mkdir($sourceDir); |
118 | - $this->instance->file_put_contents($accessDir . '/test.txt', 'bar'); |
|
119 | - $this->assertTrue($this->instance->file_exists($accessDir . '/test.txt')); |
|
120 | - $this->assertEquals('bar', $this->instance->file_get_contents($accessDir . '/test.txt')); |
|
118 | + $this->instance->file_put_contents($accessDir.'/test.txt', 'bar'); |
|
119 | + $this->assertTrue($this->instance->file_exists($accessDir.'/test.txt')); |
|
120 | + $this->assertEquals('bar', $this->instance->file_get_contents($accessDir.'/test.txt')); |
|
121 | 121 | |
122 | - $this->sourceStorage->file_put_contents($sourceDir . '/' . self::NFD_NAME, 'foo'); |
|
123 | - $this->assertTrue($this->instance->file_exists($accessDir . '/' . self::NFC_NAME)); |
|
124 | - $this->assertEquals('foo', $this->instance->file_get_contents($accessDir . '/' . self::NFC_NAME)); |
|
122 | + $this->sourceStorage->file_put_contents($sourceDir.'/'.self::NFD_NAME, 'foo'); |
|
123 | + $this->assertTrue($this->instance->file_exists($accessDir.'/'.self::NFC_NAME)); |
|
124 | + $this->assertEquals('foo', $this->instance->file_get_contents($accessDir.'/'.self::NFC_NAME)); |
|
125 | 125 | |
126 | 126 | // try again to make it use cached path |
127 | - $this->assertEquals('bar', $this->instance->file_get_contents($accessDir . '/test.txt')); |
|
128 | - $this->assertTrue($this->instance->file_exists($accessDir . '/test.txt')); |
|
129 | - $this->assertEquals('foo', $this->instance->file_get_contents($accessDir . '/' . self::NFC_NAME)); |
|
130 | - $this->assertTrue($this->instance->file_exists($accessDir . '/' . self::NFC_NAME)); |
|
127 | + $this->assertEquals('bar', $this->instance->file_get_contents($accessDir.'/test.txt')); |
|
128 | + $this->assertTrue($this->instance->file_exists($accessDir.'/test.txt')); |
|
129 | + $this->assertEquals('foo', $this->instance->file_get_contents($accessDir.'/'.self::NFC_NAME)); |
|
130 | + $this->assertTrue($this->instance->file_exists($accessDir.'/'.self::NFC_NAME)); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | public function testCacheExtraSlash(): void { |
@@ -135,19 +135,19 @@ discard block |
||
135 | 135 | $this->assertEquals(3, $this->instance->file_put_contents(self::NFC_NAME, 'bar')); |
136 | 136 | $this->assertEquals('bar', $this->instance->file_get_contents(self::NFC_NAME)); |
137 | 137 | clearstatcache(); |
138 | - $this->assertEquals(5, $this->instance->file_put_contents('/' . self::NFC_NAME, 'baric')); |
|
138 | + $this->assertEquals(5, $this->instance->file_put_contents('/'.self::NFC_NAME, 'baric')); |
|
139 | 139 | $this->assertEquals('baric', $this->instance->file_get_contents(self::NFC_NAME)); |
140 | 140 | clearstatcache(); |
141 | - $this->assertEquals(8, $this->instance->file_put_contents('/' . self::NFC_NAME, 'barbaric')); |
|
142 | - $this->assertEquals('barbaric', $this->instance->file_get_contents('//' . self::NFC_NAME)); |
|
141 | + $this->assertEquals(8, $this->instance->file_put_contents('/'.self::NFC_NAME, 'barbaric')); |
|
142 | + $this->assertEquals('barbaric', $this->instance->file_get_contents('//'.self::NFC_NAME)); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | public static function sourceAndTargetDirectoryProvider(): array { |
146 | 146 | return [ |
147 | - [self::NFC_NAME . '1', self::NFC_NAME . '2'], |
|
148 | - [self::NFD_NAME . '1', self::NFC_NAME . '2'], |
|
149 | - [self::NFC_NAME . '1', self::NFD_NAME . '2'], |
|
150 | - [self::NFD_NAME . '1', self::NFD_NAME . '2'], |
|
147 | + [self::NFC_NAME.'1', self::NFC_NAME.'2'], |
|
148 | + [self::NFD_NAME.'1', self::NFC_NAME.'2'], |
|
149 | + [self::NFC_NAME.'1', self::NFD_NAME.'2'], |
|
150 | + [self::NFD_NAME.'1', self::NFD_NAME.'2'], |
|
151 | 151 | ]; |
152 | 152 | } |
153 | 153 | |
@@ -155,44 +155,44 @@ discard block |
||
155 | 155 | public function testCopyAndMoveEncodedFolder($sourceDir, $targetDir): void { |
156 | 156 | $this->sourceStorage->mkdir($sourceDir); |
157 | 157 | $this->sourceStorage->mkdir($targetDir); |
158 | - $this->sourceStorage->file_put_contents($sourceDir . '/test.txt', 'bar'); |
|
159 | - $this->assertTrue($this->instance->copy(self::NFC_NAME . '1/test.txt', self::NFC_NAME . '2/test.txt')); |
|
158 | + $this->sourceStorage->file_put_contents($sourceDir.'/test.txt', 'bar'); |
|
159 | + $this->assertTrue($this->instance->copy(self::NFC_NAME.'1/test.txt', self::NFC_NAME.'2/test.txt')); |
|
160 | 160 | |
161 | - $this->assertTrue($this->instance->file_exists(self::NFC_NAME . '1/test.txt')); |
|
162 | - $this->assertTrue($this->instance->file_exists(self::NFC_NAME . '2/test.txt')); |
|
163 | - $this->assertEquals('bar', $this->instance->file_get_contents(self::NFC_NAME . '2/test.txt')); |
|
161 | + $this->assertTrue($this->instance->file_exists(self::NFC_NAME.'1/test.txt')); |
|
162 | + $this->assertTrue($this->instance->file_exists(self::NFC_NAME.'2/test.txt')); |
|
163 | + $this->assertEquals('bar', $this->instance->file_get_contents(self::NFC_NAME.'2/test.txt')); |
|
164 | 164 | |
165 | - $this->assertTrue($this->instance->rename(self::NFC_NAME . '1/test.txt', self::NFC_NAME . '2/test2.txt')); |
|
166 | - $this->assertFalse($this->instance->file_exists(self::NFC_NAME . '1/test.txt')); |
|
167 | - $this->assertTrue($this->instance->file_exists(self::NFC_NAME . '2/test2.txt')); |
|
165 | + $this->assertTrue($this->instance->rename(self::NFC_NAME.'1/test.txt', self::NFC_NAME.'2/test2.txt')); |
|
166 | + $this->assertFalse($this->instance->file_exists(self::NFC_NAME.'1/test.txt')); |
|
167 | + $this->assertTrue($this->instance->file_exists(self::NFC_NAME.'2/test2.txt')); |
|
168 | 168 | |
169 | - $this->assertEquals('bar', $this->instance->file_get_contents(self::NFC_NAME . '2/test2.txt')); |
|
169 | + $this->assertEquals('bar', $this->instance->file_get_contents(self::NFC_NAME.'2/test2.txt')); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | #[\PHPUnit\Framework\Attributes\DataProvider('sourceAndTargetDirectoryProvider')] |
173 | 173 | public function testCopyAndMoveFromStorageEncodedFolder($sourceDir, $targetDir): void { |
174 | 174 | $this->sourceStorage->mkdir($sourceDir); |
175 | 175 | $this->sourceStorage->mkdir($targetDir); |
176 | - $this->sourceStorage->file_put_contents($sourceDir . '/test.txt', 'bar'); |
|
177 | - $this->assertTrue($this->instance->copyFromStorage($this->instance, self::NFC_NAME . '1/test.txt', self::NFC_NAME . '2/test.txt')); |
|
176 | + $this->sourceStorage->file_put_contents($sourceDir.'/test.txt', 'bar'); |
|
177 | + $this->assertTrue($this->instance->copyFromStorage($this->instance, self::NFC_NAME.'1/test.txt', self::NFC_NAME.'2/test.txt')); |
|
178 | 178 | |
179 | - $this->assertTrue($this->instance->file_exists(self::NFC_NAME . '1/test.txt')); |
|
180 | - $this->assertTrue($this->instance->file_exists(self::NFC_NAME . '2/test.txt')); |
|
181 | - $this->assertEquals('bar', $this->instance->file_get_contents(self::NFC_NAME . '2/test.txt')); |
|
179 | + $this->assertTrue($this->instance->file_exists(self::NFC_NAME.'1/test.txt')); |
|
180 | + $this->assertTrue($this->instance->file_exists(self::NFC_NAME.'2/test.txt')); |
|
181 | + $this->assertEquals('bar', $this->instance->file_get_contents(self::NFC_NAME.'2/test.txt')); |
|
182 | 182 | |
183 | - $this->assertTrue($this->instance->moveFromStorage($this->instance, self::NFC_NAME . '1/test.txt', self::NFC_NAME . '2/test2.txt')); |
|
184 | - $this->assertFalse($this->instance->file_exists(self::NFC_NAME . '1/test.txt')); |
|
185 | - $this->assertTrue($this->instance->file_exists(self::NFC_NAME . '2/test2.txt')); |
|
183 | + $this->assertTrue($this->instance->moveFromStorage($this->instance, self::NFC_NAME.'1/test.txt', self::NFC_NAME.'2/test2.txt')); |
|
184 | + $this->assertFalse($this->instance->file_exists(self::NFC_NAME.'1/test.txt')); |
|
185 | + $this->assertTrue($this->instance->file_exists(self::NFC_NAME.'2/test2.txt')); |
|
186 | 186 | |
187 | - $this->assertEquals('bar', $this->instance->file_get_contents(self::NFC_NAME . '2/test2.txt')); |
|
187 | + $this->assertEquals('bar', $this->instance->file_get_contents(self::NFC_NAME.'2/test2.txt')); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | public function testNormalizedDirectoryEntriesOpenDir(): void { |
191 | 191 | $this->sourceStorage->mkdir('/test'); |
192 | - $this->sourceStorage->mkdir('/test/' . self::NFD_NAME); |
|
192 | + $this->sourceStorage->mkdir('/test/'.self::NFD_NAME); |
|
193 | 193 | |
194 | - $this->assertTrue($this->instance->file_exists('/test/' . self::NFC_NAME)); |
|
195 | - $this->assertTrue($this->instance->file_exists('/test/' . self::NFD_NAME)); |
|
194 | + $this->assertTrue($this->instance->file_exists('/test/'.self::NFC_NAME)); |
|
195 | + $this->assertTrue($this->instance->file_exists('/test/'.self::NFD_NAME)); |
|
196 | 196 | |
197 | 197 | $dh = $this->instance->opendir('/test'); |
198 | 198 | $content = []; |
@@ -208,10 +208,10 @@ discard block |
||
208 | 208 | |
209 | 209 | public function testNormalizedDirectoryEntriesGetDirectoryContent(): void { |
210 | 210 | $this->sourceStorage->mkdir('/test'); |
211 | - $this->sourceStorage->mkdir('/test/' . self::NFD_NAME); |
|
211 | + $this->sourceStorage->mkdir('/test/'.self::NFD_NAME); |
|
212 | 212 | |
213 | - $this->assertTrue($this->instance->file_exists('/test/' . self::NFC_NAME)); |
|
214 | - $this->assertTrue($this->instance->file_exists('/test/' . self::NFD_NAME)); |
|
213 | + $this->assertTrue($this->instance->file_exists('/test/'.self::NFC_NAME)); |
|
214 | + $this->assertTrue($this->instance->file_exists('/test/'.self::NFD_NAME)); |
|
215 | 215 | |
216 | 216 | $content = iterator_to_array($this->instance->getDirectoryContent('/test')); |
217 | 217 | $this->assertCount(1, $content); |
@@ -220,12 +220,12 @@ discard block |
||
220 | 220 | |
221 | 221 | public function testNormalizedGetMetaData(): void { |
222 | 222 | $this->sourceStorage->mkdir('/test'); |
223 | - $this->sourceStorage->mkdir('/test/' . self::NFD_NAME); |
|
223 | + $this->sourceStorage->mkdir('/test/'.self::NFD_NAME); |
|
224 | 224 | |
225 | - $entry = $this->instance->getMetaData('/test/' . self::NFC_NAME); |
|
225 | + $entry = $this->instance->getMetaData('/test/'.self::NFC_NAME); |
|
226 | 226 | $this->assertEquals(self::NFC_NAME, $entry['name']); |
227 | 227 | |
228 | - $entry = $this->instance->getMetaData('/test/' . self::NFD_NAME); |
|
228 | + $entry = $this->instance->getMetaData('/test/'.self::NFD_NAME); |
|
229 | 229 | $this->assertEquals(self::NFC_NAME, $entry['name']); |
230 | 230 | } |
231 | 231 |