@@ -53,35 +53,35 @@ |
||
| 53 | 53 | public static function providerTestConcatString(): array { |
| 54 | 54 | return [ |
| 55 | 55 | '1 column: string param unicode' |
| 56 | - => [function ($q) { |
|
| 56 | + => [function($q) { |
|
| 57 | 57 | return [false, [$q->createNamedParameter(' |
@@ -15,27 +15,27 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | class ImageTest extends \Test\TestCase { |
| 17 | 17 | public static function tearDownAfterClass(): void { |
| 18 | - @unlink(OC::$SERVERROOT . '/tests/data/testimage2.png'); |
|
| 19 | - @unlink(OC::$SERVERROOT . '/tests/data/testimage2.jpg'); |
|
| 18 | + @unlink(OC::$SERVERROOT.'/tests/data/testimage2.png'); |
|
| 19 | + @unlink(OC::$SERVERROOT.'/tests/data/testimage2.jpg'); |
|
| 20 | 20 | |
| 21 | 21 | parent::tearDownAfterClass(); |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | public function testConstructDestruct(): void { |
| 25 | 25 | $img = new Image(); |
| 26 | - $img->loadFromFile(OC::$SERVERROOT . '/tests/data/testimage.png'); |
|
| 26 | + $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); |
|
| 27 | 27 | $this->assertInstanceOf('\OC\Image', $img); |
| 28 | 28 | $this->assertInstanceOf('\OCP\IImage', $img); |
| 29 | 29 | unset($img); |
| 30 | 30 | |
| 31 | - $imgcreate = imagecreatefromjpeg(OC::$SERVERROOT . '/tests/data/testimage.jpg'); |
|
| 31 | + $imgcreate = imagecreatefromjpeg(OC::$SERVERROOT.'/tests/data/testimage.jpg'); |
|
| 32 | 32 | $img = new Image(); |
| 33 | 33 | $img->setResource($imgcreate); |
| 34 | 34 | $this->assertInstanceOf('\OC\Image', $img); |
| 35 | 35 | $this->assertInstanceOf('\OCP\IImage', $img); |
| 36 | 36 | unset($img); |
| 37 | 37 | |
| 38 | - $base64 = base64_encode(file_get_contents(OC::$SERVERROOT . '/tests/data/testimage.gif')); |
|
| 38 | + $base64 = base64_encode(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.gif')); |
|
| 39 | 39 | $img = new Image(); |
| 40 | 40 | $img->loadFromBase64($base64); |
| 41 | 41 | $this->assertInstanceOf('\OC\Image', $img); |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | public function testValid(): void { |
| 52 | 52 | $img = new Image(); |
| 53 | - $img->loadFromFile(OC::$SERVERROOT . '/tests/data/testimage.png'); |
|
| 53 | + $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); |
|
| 54 | 54 | $this->assertTrue($img->valid()); |
| 55 | 55 | |
| 56 | 56 | $text = base64_encode('Lorem ipsum dolor sir amet …'); |
@@ -64,32 +64,32 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | public function testMimeType(): void { |
| 66 | 66 | $img = new Image(); |
| 67 | - $img->loadFromFile(OC::$SERVERROOT . '/tests/data/testimage.png'); |
|
| 67 | + $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); |
|
| 68 | 68 | $this->assertEquals('image/png', $img->mimeType()); |
| 69 | 69 | |
| 70 | 70 | $img = new Image(); |
| 71 | 71 | $this->assertEquals('', $img->mimeType()); |
| 72 | 72 | |
| 73 | 73 | $img = new Image(); |
| 74 | - $img->loadFromData(file_get_contents(OC::$SERVERROOT . '/tests/data/testimage.jpg')); |
|
| 74 | + $img->loadFromData(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.jpg')); |
|
| 75 | 75 | $this->assertEquals('image/jpeg', $img->mimeType()); |
| 76 | 76 | |
| 77 | 77 | $img = new Image(); |
| 78 | - $img->loadFromBase64(base64_encode(file_get_contents(OC::$SERVERROOT . '/tests/data/testimage.gif'))); |
|
| 78 | + $img->loadFromBase64(base64_encode(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.gif'))); |
|
| 79 | 79 | $this->assertEquals('image/gif', $img->mimeType()); |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | public function testWidth(): void { |
| 83 | 83 | $img = new Image(); |
| 84 | - $img->loadFromFile(OC::$SERVERROOT . '/tests/data/testimage.png'); |
|
| 84 | + $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); |
|
| 85 | 85 | $this->assertEquals(128, $img->width()); |
| 86 | 86 | |
| 87 | 87 | $img = new Image(); |
| 88 | - $img->loadFromData(file_get_contents(OC::$SERVERROOT . '/tests/data/testimage.jpg')); |
|
| 88 | + $img->loadFromData(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.jpg')); |
|
| 89 | 89 | $this->assertEquals(1680, $img->width()); |
| 90 | 90 | |
| 91 | 91 | $img = new Image(); |
| 92 | - $img->loadFromBase64(base64_encode(file_get_contents(OC::$SERVERROOT . '/tests/data/testimage.gif'))); |
|
| 92 | + $img->loadFromBase64(base64_encode(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.gif'))); |
|
| 93 | 93 | $this->assertEquals(64, $img->width()); |
| 94 | 94 | |
| 95 | 95 | $img = new Image(); |
@@ -98,15 +98,15 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | public function testHeight(): void { |
| 100 | 100 | $img = new Image(); |
| 101 | - $img->loadFromFile(OC::$SERVERROOT . '/tests/data/testimage.png'); |
|
| 101 | + $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); |
|
| 102 | 102 | $this->assertEquals(128, $img->height()); |
| 103 | 103 | |
| 104 | 104 | $img = new Image(); |
| 105 | - $img->loadFromData(file_get_contents(OC::$SERVERROOT . '/tests/data/testimage.jpg')); |
|
| 105 | + $img->loadFromData(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.jpg')); |
|
| 106 | 106 | $this->assertEquals(1050, $img->height()); |
| 107 | 107 | |
| 108 | 108 | $img = new Image(); |
| 109 | - $img->loadFromBase64(base64_encode(file_get_contents(OC::$SERVERROOT . '/tests/data/testimage.gif'))); |
|
| 109 | + $img->loadFromBase64(base64_encode(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.gif'))); |
|
| 110 | 110 | $this->assertEquals(64, $img->height()); |
| 111 | 111 | |
| 112 | 112 | $img = new Image(); |
@@ -115,22 +115,22 @@ discard block |
||
| 115 | 115 | |
| 116 | 116 | public function testSave(): void { |
| 117 | 117 | $img = new Image(); |
| 118 | - $img->loadFromFile(OC::$SERVERROOT . '/tests/data/testimage.png'); |
|
| 118 | + $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); |
|
| 119 | 119 | $img->resize(16); |
| 120 | - $img->save(OC::$SERVERROOT . '/tests/data/testimage2.png'); |
|
| 121 | - $this->assertEquals(file_get_contents(OC::$SERVERROOT . '/tests/data/testimage2.png'), $img->data()); |
|
| 120 | + $img->save(OC::$SERVERROOT.'/tests/data/testimage2.png'); |
|
| 121 | + $this->assertEquals(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage2.png'), $img->data()); |
|
| 122 | 122 | |
| 123 | 123 | $img = new Image(); |
| 124 | - $img->loadFromFile(OC::$SERVERROOT . '/tests/data/testimage.jpg'); |
|
| 124 | + $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.jpg'); |
|
| 125 | 125 | $img->resize(128); |
| 126 | - $img->save(OC::$SERVERROOT . '/tests/data/testimage2.jpg'); |
|
| 127 | - $this->assertEquals(file_get_contents(OC::$SERVERROOT . '/tests/data/testimage2.jpg'), $img->data()); |
|
| 126 | + $img->save(OC::$SERVERROOT.'/tests/data/testimage2.jpg'); |
|
| 127 | + $this->assertEquals(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage2.jpg'), $img->data()); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | public function testData(): void { |
| 131 | 131 | $img = new Image(); |
| 132 | - $img->loadFromFile(OC::$SERVERROOT . '/tests/data/testimage.png'); |
|
| 133 | - $raw = imagecreatefromstring(file_get_contents(OC::$SERVERROOT . '/tests/data/testimage.png')); |
|
| 132 | + $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); |
|
| 133 | + $raw = imagecreatefromstring(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.png')); |
|
| 134 | 134 | // Preserve transparency |
| 135 | 135 | imagealphablending($raw, true); |
| 136 | 136 | imagesavealpha($raw, true); |
@@ -150,8 +150,8 @@ discard block |
||
| 150 | 150 | ->with('preview_max_memory', 256) |
| 151 | 151 | ->willReturn(256); |
| 152 | 152 | $img = new Image(null, $appConfig, $config); |
| 153 | - $img->loadFromFile(OC::$SERVERROOT . '/tests/data/testimage.jpg'); |
|
| 154 | - $raw = imagecreatefromstring(file_get_contents(OC::$SERVERROOT . '/tests/data/testimage.jpg')); |
|
| 153 | + $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.jpg'); |
|
| 154 | + $raw = imagecreatefromstring(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.jpg')); |
|
| 155 | 155 | imageinterlace($raw, true); |
| 156 | 156 | ob_start(); |
| 157 | 157 | imagejpeg($raw, null, 80); |
@@ -159,8 +159,8 @@ discard block |
||
| 159 | 159 | $this->assertEquals($expected, $img->data()); |
| 160 | 160 | |
| 161 | 161 | $img = new Image(); |
| 162 | - $img->loadFromFile(OC::$SERVERROOT . '/tests/data/testimage.gif'); |
|
| 163 | - $raw = imagecreatefromstring(file_get_contents(OC::$SERVERROOT . '/tests/data/testimage.gif')); |
|
| 162 | + $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.gif'); |
|
| 163 | + $raw = imagecreatefromstring(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.gif')); |
|
| 164 | 164 | ob_start(); |
| 165 | 165 | imagegif($raw); |
| 166 | 166 | $expected = ob_get_clean(); |
@@ -175,36 +175,36 @@ discard block |
||
| 175 | 175 | #[\PHPUnit\Framework\Attributes\Depends('testData')] |
| 176 | 176 | public function testToString(): void { |
| 177 | 177 | $img = new Image(); |
| 178 | - $img->loadFromFile(OC::$SERVERROOT . '/tests/data/testimage.png'); |
|
| 178 | + $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); |
|
| 179 | 179 | $expected = base64_encode($img->data()); |
| 180 | - $this->assertEquals($expected, (string)$img); |
|
| 180 | + $this->assertEquals($expected, (string) $img); |
|
| 181 | 181 | |
| 182 | 182 | $img = new Image(); |
| 183 | - $img->loadFromData(file_get_contents(OC::$SERVERROOT . '/tests/data/testimage.jpg')); |
|
| 183 | + $img->loadFromData(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.jpg')); |
|
| 184 | 184 | $expected = base64_encode($img->data()); |
| 185 | - $this->assertEquals($expected, (string)$img); |
|
| 185 | + $this->assertEquals($expected, (string) $img); |
|
| 186 | 186 | |
| 187 | 187 | $img = new Image(); |
| 188 | - $img->loadFromFile(OC::$SERVERROOT . '/tests/data/testimage.gif'); |
|
| 188 | + $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.gif'); |
|
| 189 | 189 | $expected = base64_encode($img->data()); |
| 190 | - $this->assertEquals($expected, (string)$img); |
|
| 190 | + $this->assertEquals($expected, (string) $img); |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | public function testResize(): void { |
| 194 | 194 | $img = new Image(); |
| 195 | - $img->loadFromFile(OC::$SERVERROOT . '/tests/data/testimage.png'); |
|
| 195 | + $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); |
|
| 196 | 196 | $this->assertTrue($img->resize(32)); |
| 197 | 197 | $this->assertEquals(32, $img->width()); |
| 198 | 198 | $this->assertEquals(32, $img->height()); |
| 199 | 199 | |
| 200 | 200 | $img = new Image(); |
| 201 | - $img->loadFromData(file_get_contents(OC::$SERVERROOT . '/tests/data/testimage.jpg')); |
|
| 201 | + $img->loadFromData(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.jpg')); |
|
| 202 | 202 | $this->assertTrue($img->resize(840)); |
| 203 | 203 | $this->assertEquals(840, $img->width()); |
| 204 | 204 | $this->assertEquals(525, $img->height()); |
| 205 | 205 | |
| 206 | 206 | $img = new Image(); |
| 207 | - $img->loadFromBase64(base64_encode(file_get_contents(OC::$SERVERROOT . '/tests/data/testimage.gif'))); |
|
| 207 | + $img->loadFromBase64(base64_encode(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.gif'))); |
|
| 208 | 208 | $this->assertTrue($img->resize(100)); |
| 209 | 209 | $this->assertEquals(100, $img->width()); |
| 210 | 210 | $this->assertEquals(100, $img->height()); |
@@ -212,19 +212,19 @@ discard block |
||
| 212 | 212 | |
| 213 | 213 | public function testPreciseResize(): void { |
| 214 | 214 | $img = new Image(); |
| 215 | - $img->loadFromFile(OC::$SERVERROOT . '/tests/data/testimage.png'); |
|
| 215 | + $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); |
|
| 216 | 216 | $this->assertTrue($img->preciseResize(128, 512)); |
| 217 | 217 | $this->assertEquals(128, $img->width()); |
| 218 | 218 | $this->assertEquals(512, $img->height()); |
| 219 | 219 | |
| 220 | 220 | $img = new Image(); |
| 221 | - $img->loadFromData(file_get_contents(OC::$SERVERROOT . '/tests/data/testimage.jpg')); |
|
| 221 | + $img->loadFromData(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.jpg')); |
|
| 222 | 222 | $this->assertTrue($img->preciseResize(64, 840)); |
| 223 | 223 | $this->assertEquals(64, $img->width()); |
| 224 | 224 | $this->assertEquals(840, $img->height()); |
| 225 | 225 | |
| 226 | 226 | $img = new Image(); |
| 227 | - $img->loadFromBase64(base64_encode(file_get_contents(OC::$SERVERROOT . '/tests/data/testimage.gif'))); |
|
| 227 | + $img->loadFromBase64(base64_encode(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.gif'))); |
|
| 228 | 228 | $this->assertTrue($img->preciseResize(1000, 1337)); |
| 229 | 229 | $this->assertEquals(1000, $img->width()); |
| 230 | 230 | $this->assertEquals(1337, $img->height()); |
@@ -232,19 +232,19 @@ discard block |
||
| 232 | 232 | |
| 233 | 233 | public function testCenterCrop(): void { |
| 234 | 234 | $img = new Image(); |
| 235 | - $img->loadFromFile(OC::$SERVERROOT . '/tests/data/testimage.png'); |
|
| 235 | + $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); |
|
| 236 | 236 | $img->centerCrop(); |
| 237 | 237 | $this->assertEquals(128, $img->width()); |
| 238 | 238 | $this->assertEquals(128, $img->height()); |
| 239 | 239 | |
| 240 | 240 | $img = new Image(); |
| 241 | - $img->loadFromData(file_get_contents(OC::$SERVERROOT . '/tests/data/testimage.jpg')); |
|
| 241 | + $img->loadFromData(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.jpg')); |
|
| 242 | 242 | $img->centerCrop(); |
| 243 | 243 | $this->assertEquals(1050, $img->width()); |
| 244 | 244 | $this->assertEquals(1050, $img->height()); |
| 245 | 245 | |
| 246 | 246 | $img = new Image(); |
| 247 | - $img->loadFromBase64(base64_encode(file_get_contents(OC::$SERVERROOT . '/tests/data/testimage.gif'))); |
|
| 247 | + $img->loadFromBase64(base64_encode(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.gif'))); |
|
| 248 | 248 | $img->centerCrop(512); |
| 249 | 249 | $this->assertEquals(512, $img->width()); |
| 250 | 250 | $this->assertEquals(512, $img->height()); |
@@ -252,19 +252,19 @@ discard block |
||
| 252 | 252 | |
| 253 | 253 | public function testCrop(): void { |
| 254 | 254 | $img = new Image(); |
| 255 | - $img->loadFromFile(OC::$SERVERROOT . '/tests/data/testimage.png'); |
|
| 255 | + $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); |
|
| 256 | 256 | $this->assertTrue($img->crop(0, 0, 50, 20)); |
| 257 | 257 | $this->assertEquals(50, $img->width()); |
| 258 | 258 | $this->assertEquals(20, $img->height()); |
| 259 | 259 | |
| 260 | 260 | $img = new Image(); |
| 261 | - $img->loadFromData(file_get_contents(OC::$SERVERROOT . '/tests/data/testimage.jpg')); |
|
| 261 | + $img->loadFromData(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.jpg')); |
|
| 262 | 262 | $this->assertTrue($img->crop(500, 700, 550, 300)); |
| 263 | 263 | $this->assertEquals(550, $img->width()); |
| 264 | 264 | $this->assertEquals(300, $img->height()); |
| 265 | 265 | |
| 266 | 266 | $img = new Image(); |
| 267 | - $img->loadFromBase64(base64_encode(file_get_contents(OC::$SERVERROOT . '/tests/data/testimage.gif'))); |
|
| 267 | + $img->loadFromBase64(base64_encode(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.gif'))); |
|
| 268 | 268 | $this->assertTrue($img->crop(10, 10, 15, 15)); |
| 269 | 269 | $this->assertEquals(15, $img->width()); |
| 270 | 270 | $this->assertEquals(15, $img->height()); |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | #[\PHPUnit\Framework\Attributes\DataProvider('sampleProvider')] |
| 288 | 288 | public function testFitIn($filename, $asked, $expected): void { |
| 289 | 289 | $img = new Image(); |
| 290 | - $img->loadFromFile(OC::$SERVERROOT . '/tests/data/' . $filename); |
|
| 290 | + $img->loadFromFile(OC::$SERVERROOT.'/tests/data/'.$filename); |
|
| 291 | 291 | $this->assertTrue($img->fitIn($asked[0], $asked[1])); |
| 292 | 292 | $this->assertEquals($expected[0], $img->width()); |
| 293 | 293 | $this->assertEquals($expected[1], $img->height()); |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | #[\PHPUnit\Framework\Attributes\DataProvider('sampleFilenamesProvider')] |
| 311 | 311 | public function testScaleDownToFitWhenSmallerAlready($filename): void { |
| 312 | 312 | $img = new Image(); |
| 313 | - $img->loadFromFile(OC::$SERVERROOT . '/tests/data/' . $filename); |
|
| 313 | + $img->loadFromFile(OC::$SERVERROOT.'/tests/data/'.$filename); |
|
| 314 | 314 | $currentWidth = $img->width(); |
| 315 | 315 | $currentHeight = $img->height(); |
| 316 | 316 | // We pick something larger than the image we want to scale down |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | #[\PHPUnit\Framework\Attributes\DataProvider('largeSampleProvider')] |
| 344 | 344 | public function testScaleDownWhenBigger($filename, $asked, $expected): void { |
| 345 | 345 | $img = new Image(); |
| 346 | - $img->loadFromFile(OC::$SERVERROOT . '/tests/data/' . $filename); |
|
| 346 | + $img->loadFromFile(OC::$SERVERROOT.'/tests/data/'.$filename); |
|
| 347 | 347 | //$this->assertTrue($img->scaleDownToFit($asked[0], $asked[1])); |
| 348 | 348 | $img->scaleDownToFit($asked[0], $asked[1]); |
| 349 | 349 | $this->assertEquals($expected[0], $img->width()); |
@@ -352,16 +352,16 @@ discard block |
||
| 352 | 352 | |
| 353 | 353 | public static function convertDataProvider(): array { |
| 354 | 354 | return [ |
| 355 | - [ 'image/gif'], |
|
| 356 | - [ 'image/jpeg'], |
|
| 357 | - [ 'image/png'], |
|
| 355 | + ['image/gif'], |
|
| 356 | + ['image/jpeg'], |
|
| 357 | + ['image/png'], |
|
| 358 | 358 | ]; |
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | #[\PHPUnit\Framework\Attributes\DataProvider('convertDataProvider')] |
| 362 | 362 | public function testConvert($mimeType): void { |
| 363 | 363 | $img = new Image(); |
| 364 | - $img->loadFromFile(OC::$SERVERROOT . '/tests/data/testimage.png'); |
|
| 364 | + $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); |
|
| 365 | 365 | $tempFile = tempnam(sys_get_temp_dir(), 'img-test'); |
| 366 | 366 | |
| 367 | 367 | $img->save($tempFile, $mimeType); |
@@ -370,12 +370,12 @@ discard block |
||
| 370 | 370 | |
| 371 | 371 | public function testMemoryLimitFromFile(): void { |
| 372 | 372 | $img = new Image(); |
| 373 | - $img->loadFromFile(OC::$SERVERROOT . '/tests/data/testimage-badheader.jpg'); |
|
| 373 | + $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage-badheader.jpg'); |
|
| 374 | 374 | $this->assertFalse($img->valid()); |
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | public function testMemoryLimitFromData(): void { |
| 378 | - $data = file_get_contents(OC::$SERVERROOT . '/tests/data/testimage-badheader.jpg'); |
|
| 378 | + $data = file_get_contents(OC::$SERVERROOT.'/tests/data/testimage-badheader.jpg'); |
|
| 379 | 379 | $img = new Image(); |
| 380 | 380 | $img->loadFromData($data); |
| 381 | 381 | $this->assertFalse($img->valid()); |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | |
| 48 | 48 | $this->jobList = $this->createMock(JobList::class); |
| 49 | 49 | $this->eventDispatcher = $this->createMock(IEventDispatcher::class); |
| 50 | - $this->eventDispatcher->method('dispatchTyped')->willReturnCallback(function (Event $event): void { |
|
| 50 | + $this->eventDispatcher->method('dispatchTyped')->willReturnCallback(function(Event $event): void { |
|
| 51 | 51 | if ($event instanceof AMetadataEvent) { |
| 52 | 52 | $name = $event->getNode()->getName(); |
| 53 | 53 | if (isset($this->metadata[$name])) { |
@@ -27,13 +27,13 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | #[\PHPUnit\Framework\Attributes\Group('DB')] |
| 29 | 29 | class RateLimitingMiddlewareTest extends TestCase { |
| 30 | - private IRequest|MockObject $request; |
|
| 31 | - private IUserSession|MockObject $userSession; |
|
| 30 | + private IRequest | MockObject $request; |
|
| 31 | + private IUserSession | MockObject $userSession; |
|
| 32 | 32 | private ControllerMethodReflector $reflector; |
| 33 | - private Limiter|MockObject $limiter; |
|
| 34 | - private ISession|MockObject $session; |
|
| 35 | - private IAppConfig|MockObject $appConfig; |
|
| 36 | - private BruteforceAllowList|MockObject $bruteForceAllowList; |
|
| 33 | + private Limiter | MockObject $limiter; |
|
| 34 | + private ISession | MockObject $session; |
|
| 35 | + private IAppConfig | MockObject $appConfig; |
|
| 36 | + private BruteforceAllowList | MockObject $bruteForceAllowList; |
|
| 37 | 37 | private RateLimitingMiddleware $rateLimitingMiddleware; |
| 38 | 38 | |
| 39 | 39 | protected function setUp(): void { |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | $this->limiter |
| 113 | 113 | ->expects($this->once()) |
| 114 | 114 | ->method('registerAnonRequest') |
| 115 | - ->with(get_class($controller) . '::testMethodWithAnnotation', '10', '100', '127.0.0.1'); |
|
| 115 | + ->with(get_class($controller).'::testMethodWithAnnotation', '10', '100', '127.0.0.1'); |
|
| 116 | 116 | |
| 117 | 117 | $this->reflector->reflect($controller, 'testMethodWithAnnotation'); |
| 118 | 118 | $this->rateLimitingMiddleware->beforeController($controller, 'testMethodWithAnnotation'); |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | $this->limiter |
| 139 | 139 | ->expects($this->once()) |
| 140 | 140 | ->method('registerUserRequest') |
| 141 | - ->with(get_class($controller) . '::testMethodWithAnnotation', '20', '200', $user); |
|
| 141 | + ->with(get_class($controller).'::testMethodWithAnnotation', '20', '200', $user); |
|
| 142 | 142 | |
| 143 | 143 | |
| 144 | 144 | $this->reflector->reflect($controller, 'testMethodWithAnnotation'); |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | $this->limiter |
| 165 | 165 | ->expects($this->once()) |
| 166 | 166 | ->method('registerAnonRequest') |
| 167 | - ->with(get_class($controller) . '::testMethodWithAnnotationFallback', '10', '100', '127.0.0.1'); |
|
| 167 | + ->with(get_class($controller).'::testMethodWithAnnotationFallback', '10', '100', '127.0.0.1'); |
|
| 168 | 168 | |
| 169 | 169 | $this->reflector->reflect($controller, 'testMethodWithAnnotationFallback'); |
| 170 | 170 | $this->rateLimitingMiddleware->beforeController($controller, 'testMethodWithAnnotationFallback'); |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | $this->limiter |
| 189 | 189 | ->expects($this->once()) |
| 190 | 190 | ->method('registerAnonRequest') |
| 191 | - ->with(get_class($controller) . '::testMethodWithAttributes', '10', '100', '127.0.0.1'); |
|
| 191 | + ->with(get_class($controller).'::testMethodWithAttributes', '10', '100', '127.0.0.1'); |
|
| 192 | 192 | |
| 193 | 193 | $this->reflector->reflect($controller, 'testMethodWithAttributes'); |
| 194 | 194 | $this->rateLimitingMiddleware->beforeController($controller, 'testMethodWithAttributes'); |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | $this->limiter |
| 215 | 215 | ->expects($this->once()) |
| 216 | 216 | ->method('registerUserRequest') |
| 217 | - ->with(get_class($controller) . '::testMethodWithAttributes', '20', '200', $user); |
|
| 217 | + ->with(get_class($controller).'::testMethodWithAttributes', '20', '200', $user); |
|
| 218 | 218 | |
| 219 | 219 | |
| 220 | 220 | $this->reflector->reflect($controller, 'testMethodWithAttributes'); |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | $this->limiter |
| 241 | 241 | ->expects($this->once()) |
| 242 | 242 | ->method('registerAnonRequest') |
| 243 | - ->with(get_class($controller) . '::testMethodWithAttributesFallback', '10', '100', '127.0.0.1'); |
|
| 243 | + ->with(get_class($controller).'::testMethodWithAttributesFallback', '10', '100', '127.0.0.1'); |
|
| 244 | 244 | |
| 245 | 245 | $this->reflector->reflect($controller, 'testMethodWithAttributesFallback'); |
| 246 | 246 | $this->rateLimitingMiddleware->beforeController($controller, 'testMethodWithAttributesFallback'); |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | private function prepareMockForUserExists(): void { |
| 84 | 84 | $this->access->expects($this->any()) |
| 85 | 85 | ->method('username2dn') |
| 86 | - ->willReturnCallback(function ($uid) { |
|
| 86 | + ->willReturnCallback(function($uid) { |
|
| 87 | 87 | switch ($uid) { |
| 88 | 88 | case 'gunslinger': |
| 89 | 89 | return 'dnOfRoland,dc=test'; |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | private function prepareAccessForCheckPassword(bool $noDisplayName = false): void { |
| 113 | 113 | $this->connection->expects($this->any()) |
| 114 | 114 | ->method('__get') |
| 115 | - ->willReturnCallback(function ($name) { |
|
| 115 | + ->willReturnCallback(function($name) { |
|
| 116 | 116 | if ($name === 'ldapLoginFilter') { |
| 117 | 117 | return '%uid'; |
| 118 | 118 | } |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | |
| 122 | 122 | $this->access->expects($this->any()) |
| 123 | 123 | ->method('fetchListOfUsers') |
| 124 | - ->willReturnCallback(function ($filter) { |
|
| 124 | + ->willReturnCallback(function($filter) { |
|
| 125 | 125 | if ($filter === 'roland') { |
| 126 | 126 | return [['dn' => ['dnOfRoland,dc=test']]]; |
| 127 | 127 | } |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | }); |
| 130 | 130 | $this->access->expects($this->any()) |
| 131 | 131 | ->method('fetchUsersByLoginName') |
| 132 | - ->willReturnCallback(function ($uid) { |
|
| 132 | + ->willReturnCallback(function($uid) { |
|
| 133 | 133 | if ($uid === 'roland') { |
| 134 | 134 | return [['dn' => ['dnOfRoland,dc=test']]]; |
| 135 | 135 | } |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | ->willReturn(true); |
| 155 | 155 | $this->access->expects($this->any()) |
| 156 | 156 | ->method('areCredentialsValid') |
| 157 | - ->willReturnCallback(function ($dn, $pwd) { |
|
| 157 | + ->willReturnCallback(function($dn, $pwd) { |
|
| 158 | 158 | if ($pwd === 'dt19') { |
| 159 | 159 | return true; |
| 160 | 160 | } |
@@ -348,22 +348,22 @@ discard block |
||
| 348 | 348 | private function prepareAccessForGetUsers() { |
| 349 | 349 | $this->access->expects($this->once()) |
| 350 | 350 | ->method('escapeFilterPart') |
| 351 | - ->willReturnCallback(function ($search) { |
|
| 351 | + ->willReturnCallback(function($search) { |
|
| 352 | 352 | return $search; |
| 353 | 353 | }); |
| 354 | 354 | $this->access->expects($this->any()) |
| 355 | 355 | ->method('getFilterPartForUserSearch') |
| 356 | - ->willReturnCallback(function ($search) { |
|
| 356 | + ->willReturnCallback(function($search) { |
|
| 357 | 357 | return $search; |
| 358 | 358 | }); |
| 359 | 359 | $this->access->expects($this->any()) |
| 360 | 360 | ->method('combineFilterWithAnd') |
| 361 | - ->willReturnCallback(function ($param) { |
|
| 361 | + ->willReturnCallback(function($param) { |
|
| 362 | 362 | return $param[2]; |
| 363 | 363 | }); |
| 364 | 364 | $this->access->expects($this->any()) |
| 365 | 365 | ->method('fetchListOfUsers') |
| 366 | - ->willReturnCallback(function ($search, $a, $l, $o) { |
|
| 366 | + ->willReturnCallback(function($search, $a, $l, $o) { |
|
| 367 | 367 | $users = ['gunslinger', 'newyorker', 'ladyofshadows']; |
| 368 | 368 | if (empty($search)) { |
| 369 | 369 | $result = $users; |
@@ -433,7 +433,7 @@ discard block |
||
| 433 | 433 | |
| 434 | 434 | private function getUsers($search = '', $limit = null, $offset = null) { |
| 435 | 435 | $users = Server::get(IUserManager::class)->search($search, $limit, $offset); |
| 436 | - $uids = array_map(function (IUser $user) { |
|
| 436 | + $uids = array_map(function(IUser $user) { |
|
| 437 | 437 | return $user->getUID(); |
| 438 | 438 | }, $users); |
| 439 | 439 | return $uids; |
@@ -535,7 +535,7 @@ discard block |
||
| 535 | 535 | |
| 536 | 536 | $this->access->expects($this->any()) |
| 537 | 537 | ->method('readAttribute') |
| 538 | - ->willReturnCallback(function ($dn) { |
|
| 538 | + ->willReturnCallback(function($dn) { |
|
| 539 | 539 | if ($dn === 'dnOfRoland,dc=test') { |
| 540 | 540 | return []; |
| 541 | 541 | } |
@@ -560,7 +560,7 @@ discard block |
||
| 560 | 560 | |
| 561 | 561 | $this->access->expects($this->any()) |
| 562 | 562 | ->method('readAttribute') |
| 563 | - ->willReturnCallback(function ($dn) { |
|
| 563 | + ->willReturnCallback(function($dn) { |
|
| 564 | 564 | if ($dn === 'dnOfRoland,dc=test') { |
| 565 | 565 | return []; |
| 566 | 566 | } |
@@ -595,7 +595,7 @@ discard block |
||
| 595 | 595 | |
| 596 | 596 | $this->connection->expects($this->any()) |
| 597 | 597 | ->method('__get') |
| 598 | - ->willReturnCallback(function ($name) { |
|
| 598 | + ->willReturnCallback(function($name) { |
|
| 599 | 599 | if ($name === 'homeFolderNamingRule') { |
| 600 | 600 | return 'attr:testAttribute'; |
| 601 | 601 | } |
@@ -604,7 +604,7 @@ discard block |
||
| 604 | 604 | |
| 605 | 605 | $this->access->expects($this->any()) |
| 606 | 606 | ->method('readAttribute') |
| 607 | - ->willReturnCallback(function ($dn, $attr) { |
|
| 607 | + ->willReturnCallback(function($dn, $attr) { |
|
| 608 | 608 | switch ($dn) { |
| 609 | 609 | case 'dnOfRoland,dc=test': |
| 610 | 610 | if ($attr === 'testAttribute') { |
@@ -648,11 +648,11 @@ discard block |
||
| 648 | 648 | $this->prepareMockForUserExists(); |
| 649 | 649 | |
| 650 | 650 | $dataDir = Server::get(IConfig::class)->getSystemValue( |
| 651 | - 'datadirectory', \OC::$SERVERROOT . '/data'); |
|
| 651 | + 'datadirectory', \OC::$SERVERROOT.'/data'); |
|
| 652 | 652 | |
| 653 | 653 | $this->connection->expects($this->any()) |
| 654 | 654 | ->method('__get') |
| 655 | - ->willReturnCallback(function ($name) { |
|
| 655 | + ->willReturnCallback(function($name) { |
|
| 656 | 656 | if ($name === 'homeFolderNamingRule') { |
| 657 | 657 | return 'attr:testAttribute'; |
| 658 | 658 | } |
@@ -661,7 +661,7 @@ discard block |
||
| 661 | 661 | |
| 662 | 662 | $this->access->expects($this->any()) |
| 663 | 663 | ->method('readAttribute') |
| 664 | - ->willReturnCallback(function ($dn, $attr) { |
|
| 664 | + ->willReturnCallback(function($dn, $attr) { |
|
| 665 | 665 | switch ($dn) { |
| 666 | 666 | case 'dnOfLadyOfShadows,dc=test': |
| 667 | 667 | if ($attr === 'testAttribute') { |
@@ -683,7 +683,7 @@ discard block |
||
| 683 | 683 | ->willReturn('dnOfLadyOfShadows,dc=test'); |
| 684 | 684 | $user->expects($this->any()) |
| 685 | 685 | ->method('getHomePath') |
| 686 | - ->willReturn($dataDir . '/susannah/'); |
|
| 686 | + ->willReturn($dataDir.'/susannah/'); |
|
| 687 | 687 | |
| 688 | 688 | $this->userManager->expects($this->atLeastOnce()) |
| 689 | 689 | ->method('get') |
@@ -695,7 +695,7 @@ discard block |
||
| 695 | 695 | |
| 696 | 696 | /** @noinspection PhpUnhandledExceptionInspection */ |
| 697 | 697 | $result = $backend->getHome('ladyofshadows'); |
| 698 | - $this->assertEquals($dataDir . '/susannah/', $result); |
|
| 698 | + $this->assertEquals($dataDir.'/susannah/', $result); |
|
| 699 | 699 | } |
| 700 | 700 | |
| 701 | 701 | |
@@ -707,7 +707,7 @@ discard block |
||
| 707 | 707 | |
| 708 | 708 | $this->connection->expects($this->any()) |
| 709 | 709 | ->method('__get') |
| 710 | - ->willReturnCallback(function ($name) { |
|
| 710 | + ->willReturnCallback(function($name) { |
|
| 711 | 711 | if ($name === 'homeFolderNamingRule') { |
| 712 | 712 | return 'attr:testAttribute'; |
| 713 | 713 | } |
@@ -715,7 +715,7 @@ discard block |
||
| 715 | 715 | }); |
| 716 | 716 | $this->access->expects($this->any()) |
| 717 | 717 | ->method('readAttribute') |
| 718 | - ->willReturnCallback(function ($dn, $attr) { |
|
| 718 | + ->willReturnCallback(function($dn, $attr) { |
|
| 719 | 719 | switch ($dn) { |
| 720 | 720 | default: |
| 721 | 721 | return false; |
@@ -752,7 +752,7 @@ discard block |
||
| 752 | 752 | |
| 753 | 753 | $this->connection->expects($this->any()) |
| 754 | 754 | ->method('__get') |
| 755 | - ->willReturnCallback(function ($name) { |
|
| 755 | + ->willReturnCallback(function($name) { |
|
| 756 | 756 | if ($name === 'homeFolderNamingRule') { |
| 757 | 757 | return 'attr:testAttribute'; |
| 758 | 758 | } |
@@ -799,7 +799,7 @@ discard block |
||
| 799 | 799 | |
| 800 | 800 | $this->connection->expects($this->any()) |
| 801 | 801 | ->method('getFromCache') |
| 802 | - ->willReturnCallback(function ($uid) { |
|
| 802 | + ->willReturnCallback(function($uid) { |
|
| 803 | 803 | return true; |
| 804 | 804 | }); |
| 805 | 805 | |
@@ -810,7 +810,7 @@ discard block |
||
| 810 | 810 | private function prepareAccessForGetDisplayName() { |
| 811 | 811 | $this->connection->expects($this->any()) |
| 812 | 812 | ->method('__get') |
| 813 | - ->willReturnCallback(function ($name) { |
|
| 813 | + ->willReturnCallback(function($name) { |
|
| 814 | 814 | if ($name === 'ldapUserDisplayName') { |
| 815 | 815 | return 'displayname'; |
| 816 | 816 | } elseif ($name === 'ldapUserDisplayName2') { |
@@ -821,7 +821,7 @@ discard block |
||
| 821 | 821 | |
| 822 | 822 | $this->access->expects($this->any()) |
| 823 | 823 | ->method('readAttribute') |
| 824 | - ->willReturnCallback(function ($dn, $attr) { |
|
| 824 | + ->willReturnCallback(function($dn, $attr) { |
|
| 825 | 825 | switch ($dn) { |
| 826 | 826 | case 'dnOfRoland,dc=test': |
| 827 | 827 | if ($attr === 'displayname') { |
@@ -845,7 +845,7 @@ discard block |
||
| 845 | 845 | |
| 846 | 846 | $this->connection->expects($this->any()) |
| 847 | 847 | ->method('getConnectionResource') |
| 848 | - ->willReturnCallback(function () { |
|
| 848 | + ->willReturnCallback(function() { |
|
| 849 | 849 | return true; |
| 850 | 850 | }); |
| 851 | 851 | |
@@ -867,13 +867,13 @@ discard block |
||
| 867 | 867 | $mapper = $this->createMock(UserMapping::class); |
| 868 | 868 | $mapper->expects($this->any()) |
| 869 | 869 | ->method('getUUIDByDN') |
| 870 | - ->willReturnCallback(function ($dn) { |
|
| 870 | + ->willReturnCallback(function($dn) { |
|
| 871 | 871 | return $dn; |
| 872 | 872 | }); |
| 873 | 873 | |
| 874 | 874 | $this->userManager->expects($this->any()) |
| 875 | 875 | ->method('get') |
| 876 | - ->willReturnCallback(function ($uid) use ($user1, $user2) { |
|
| 876 | + ->willReturnCallback(function($uid) use ($user1, $user2) { |
|
| 877 | 877 | if ($uid === 'gunslinger') { |
| 878 | 878 | return $user1; |
| 879 | 879 | } elseif ($uid === 'newyorker') { |
@@ -883,7 +883,7 @@ discard block |
||
| 883 | 883 | }); |
| 884 | 884 | $this->userManager->expects($this->any()) |
| 885 | 885 | ->method('exists') |
| 886 | - ->willReturnCallback(function ($uid) use ($user1, $user2) { |
|
| 886 | + ->willReturnCallback(function($uid) use ($user1, $user2) { |
|
| 887 | 887 | if ($uid === 'gunslinger') { |
| 888 | 888 | return true; |
| 889 | 889 | } elseif ($uid === 'newyorker') { |
@@ -896,8 +896,8 @@ discard block |
||
| 896 | 896 | ->willReturn($mapper); |
| 897 | 897 | $this->access->expects($this->any()) |
| 898 | 898 | ->method('getUserDnByUuid') |
| 899 | - ->willReturnCallback(function ($uuid) { |
|
| 900 | - return $uuid . '1'; |
|
| 899 | + ->willReturnCallback(function($uuid) { |
|
| 900 | + return $uuid.'1'; |
|
| 901 | 901 | }); |
| 902 | 902 | |
| 903 | 903 | //with displayName |
@@ -912,7 +912,7 @@ discard block |
||
| 912 | 912 | public function testGetDisplayNamePublicAPI(): void { |
| 913 | 913 | $this->access->expects($this->any()) |
| 914 | 914 | ->method('username2dn') |
| 915 | - ->willReturnCallback(function ($uid) { |
|
| 915 | + ->willReturnCallback(function($uid) { |
|
| 916 | 916 | switch ($uid) { |
| 917 | 917 | case 'gunslinger': |
| 918 | 918 | return 'dnOfRoland,dc=test'; |
@@ -936,7 +936,7 @@ discard block |
||
| 936 | 936 | |
| 937 | 937 | $this->connection->expects($this->any()) |
| 938 | 938 | ->method('getConnectionResource') |
| 939 | - ->willReturnCallback(function () { |
|
| 939 | + ->willReturnCallback(function() { |
|
| 940 | 940 | return true; |
| 941 | 941 | }); |
| 942 | 942 | |
@@ -960,13 +960,13 @@ discard block |
||
| 960 | 960 | $mapper = $this->createMock(UserMapping::class); |
| 961 | 961 | $mapper->expects($this->any()) |
| 962 | 962 | ->method('getUUIDByDN') |
| 963 | - ->willReturnCallback(function ($dn) { |
|
| 963 | + ->willReturnCallback(function($dn) { |
|
| 964 | 964 | return $dn; |
| 965 | 965 | }); |
| 966 | 966 | |
| 967 | 967 | $this->userManager->expects($this->any()) |
| 968 | 968 | ->method('get') |
| 969 | - ->willReturnCallback(function ($uid) use ($user1, $user2) { |
|
| 969 | + ->willReturnCallback(function($uid) use ($user1, $user2) { |
|
| 970 | 970 | if ($uid === 'gunslinger') { |
| 971 | 971 | return $user1; |
| 972 | 972 | } elseif ($uid === 'newyorker') { |
@@ -976,7 +976,7 @@ discard block |
||
| 976 | 976 | }); |
| 977 | 977 | $this->userManager->expects($this->any()) |
| 978 | 978 | ->method('exists') |
| 979 | - ->willReturnCallback(function ($uid) use ($user1, $user2) { |
|
| 979 | + ->willReturnCallback(function($uid) use ($user1, $user2) { |
|
| 980 | 980 | if ($uid === 'gunslinger') { |
| 981 | 981 | return true; |
| 982 | 982 | } elseif ($uid === 'newyorker') { |
@@ -989,8 +989,8 @@ discard block |
||
| 989 | 989 | ->willReturn($mapper); |
| 990 | 990 | $this->access->expects($this->any()) |
| 991 | 991 | ->method('getUserDnByUuid') |
| 992 | - ->willReturnCallback(function ($uuid) { |
|
| 993 | - return $uuid . '1'; |
|
| 992 | + ->willReturnCallback(function($uuid) { |
|
| 993 | + return $uuid.'1'; |
|
| 994 | 994 | }); |
| 995 | 995 | |
| 996 | 996 | //with displayName |
@@ -1072,11 +1072,11 @@ discard block |
||
| 1072 | 1072 | |
| 1073 | 1073 | $this->connection->expects($this->exactly(2)) |
| 1074 | 1074 | ->method('getFromCache') |
| 1075 | - ->with($this->equalTo('loginName2UserName-' . $loginName)) |
|
| 1075 | + ->with($this->equalTo('loginName2UserName-'.$loginName)) |
|
| 1076 | 1076 | ->willReturnOnConsecutiveCalls(null, $username); |
| 1077 | 1077 | $this->connection->expects($this->once()) |
| 1078 | 1078 | ->method('writeToCache') |
| 1079 | - ->with($this->equalTo('loginName2UserName-' . $loginName), $this->equalTo($username)); |
|
| 1079 | + ->with($this->equalTo('loginName2UserName-'.$loginName), $this->equalTo($username)); |
|
| 1080 | 1080 | |
| 1081 | 1081 | $backend = new User_LDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
| 1082 | 1082 | $user = $this->createMock(User::class); |
@@ -1115,11 +1115,11 @@ discard block |
||
| 1115 | 1115 | |
| 1116 | 1116 | $this->connection->expects($this->exactly(2)) |
| 1117 | 1117 | ->method('getFromCache') |
| 1118 | - ->with($this->equalTo('loginName2UserName-' . $loginName)) |
|
| 1118 | + ->with($this->equalTo('loginName2UserName-'.$loginName)) |
|
| 1119 | 1119 | ->willReturnOnConsecutiveCalls(null, false); |
| 1120 | 1120 | $this->connection->expects($this->once()) |
| 1121 | 1121 | ->method('writeToCache') |
| 1122 | - ->with($this->equalTo('loginName2UserName-' . $loginName), false); |
|
| 1122 | + ->with($this->equalTo('loginName2UserName-'.$loginName), false); |
|
| 1123 | 1123 | |
| 1124 | 1124 | $this->userManager->expects($this->any()) |
| 1125 | 1125 | ->method('getAttributes') |
@@ -1148,11 +1148,11 @@ discard block |
||
| 1148 | 1148 | |
| 1149 | 1149 | $this->connection->expects($this->exactly(2)) |
| 1150 | 1150 | ->method('getFromCache') |
| 1151 | - ->with($this->equalTo('loginName2UserName-' . $loginName)) |
|
| 1151 | + ->with($this->equalTo('loginName2UserName-'.$loginName)) |
|
| 1152 | 1152 | ->willReturnOnConsecutiveCalls(null, false); |
| 1153 | 1153 | $this->connection->expects($this->once()) |
| 1154 | 1154 | ->method('writeToCache') |
| 1155 | - ->with($this->equalTo('loginName2UserName-' . $loginName), $this->equalTo(false)); |
|
| 1155 | + ->with($this->equalTo('loginName2UserName-'.$loginName), $this->equalTo(false)); |
|
| 1156 | 1156 | |
| 1157 | 1157 | $this->userManager->expects($this->any()) |
| 1158 | 1158 | ->method('get') |
@@ -1176,19 +1176,19 @@ discard block |
||
| 1176 | 1176 | private function prepareAccessForSetPassword($enablePasswordChange = true) { |
| 1177 | 1177 | $this->connection->expects($this->any()) |
| 1178 | 1178 | ->method('__get') |
| 1179 | - ->willReturnCallback(function ($name) use (&$enablePasswordChange) { |
|
| 1179 | + ->willReturnCallback(function($name) use (&$enablePasswordChange) { |
|
| 1180 | 1180 | if ($name === 'ldapLoginFilter') { |
| 1181 | 1181 | return '%uid'; |
| 1182 | 1182 | } |
| 1183 | 1183 | if ($name === 'turnOnPasswordChange') { |
| 1184 | - return $enablePasswordChange?1:0; |
|
| 1184 | + return $enablePasswordChange ? 1 : 0; |
|
| 1185 | 1185 | } |
| 1186 | 1186 | return null; |
| 1187 | 1187 | }); |
| 1188 | 1188 | $this->connection->expects($this->any()) |
| 1189 | 1189 | ->method('getFromCache') |
| 1190 | - ->willReturnCallback(function ($uid) { |
|
| 1191 | - if ($uid === 'userExists' . 'roland') { |
|
| 1190 | + ->willReturnCallback(function($uid) { |
|
| 1191 | + if ($uid === 'userExists'.'roland') { |
|
| 1192 | 1192 | return true; |
| 1193 | 1193 | } |
| 1194 | 1194 | return null; |
@@ -1196,7 +1196,7 @@ discard block |
||
| 1196 | 1196 | |
| 1197 | 1197 | $this->access->expects($this->any()) |
| 1198 | 1198 | ->method('fetchListOfUsers') |
| 1199 | - ->willReturnCallback(function ($filter) { |
|
| 1199 | + ->willReturnCallback(function($filter) { |
|
| 1200 | 1200 | if ($filter === 'roland') { |
| 1201 | 1201 | return [['dn' => ['dnOfRoland,dc=test']]]; |
| 1202 | 1202 | } |
@@ -1204,7 +1204,7 @@ discard block |
||
| 1204 | 1204 | }); |
| 1205 | 1205 | $this->access->expects($this->any()) |
| 1206 | 1206 | ->method('fetchUsersByLoginName') |
| 1207 | - ->willReturnCallback(function ($uid) { |
|
| 1207 | + ->willReturnCallback(function($uid) { |
|
| 1208 | 1208 | if ($uid === 'roland') { |
| 1209 | 1209 | return [['dn' => ['dnOfRoland,dc=test']]]; |
| 1210 | 1210 | } |
@@ -1220,7 +1220,7 @@ discard block |
||
| 1220 | 1220 | ->willReturn(true); |
| 1221 | 1221 | $this->access->expects($this->any()) |
| 1222 | 1222 | ->method('setPassword') |
| 1223 | - ->willReturnCallback(function ($uid, $password) { |
|
| 1223 | + ->willReturnCallback(function($uid, $password) { |
|
| 1224 | 1224 | if (strlen($password) <= 5) { |
| 1225 | 1225 | throw new HintException('Password fails quality checking policy', '', 19); |
| 1226 | 1226 | } |
@@ -1318,15 +1318,15 @@ discard block |
||
| 1318 | 1318 | |
| 1319 | 1319 | public static function avatarDataProvider(): array { |
| 1320 | 1320 | return [ |
| 1321 | - [ 'validImageData', false ], |
|
| 1322 | - [ 'corruptImageData', true ], |
|
| 1323 | - [ false, true] |
|
| 1321 | + ['validImageData', false], |
|
| 1322 | + ['corruptImageData', true], |
|
| 1323 | + [false, true] |
|
| 1324 | 1324 | ]; |
| 1325 | 1325 | } |
| 1326 | 1326 | |
| 1327 | 1327 | #[\PHPUnit\Framework\Attributes\DataProvider('avatarDataProvider')] |
| 1328 | - public function testCanChangeAvatar(string|bool $imageData, bool $expected): void { |
|
| 1329 | - $isValidImage = str_starts_with((string)$imageData, 'valid'); |
|
| 1328 | + public function testCanChangeAvatar(string | bool $imageData, bool $expected): void { |
|
| 1329 | + $isValidImage = str_starts_with((string) $imageData, 'valid'); |
|
| 1330 | 1330 | |
| 1331 | 1331 | $user = $this->createMock(User::class); |
| 1332 | 1332 | $user->expects($this->once()) |
@@ -1441,16 +1441,16 @@ discard block |
||
| 1441 | 1441 | |
| 1442 | 1442 | public static function actionProvider(): array { |
| 1443 | 1443 | return [ |
| 1444 | - [ 'ldapUserAvatarRule', 'default', Backend::PROVIDE_AVATAR, true], |
|
| 1445 | - [ 'ldapUserAvatarRule', 'data:selfiePhoto', Backend::PROVIDE_AVATAR, true], |
|
| 1446 | - [ 'ldapUserAvatarRule', 'none', Backend::PROVIDE_AVATAR, false], |
|
| 1447 | - [ 'turnOnPasswordChange', 0, Backend::SET_PASSWORD, false], |
|
| 1448 | - [ 'turnOnPasswordChange', 1, Backend::SET_PASSWORD, true], |
|
| 1444 | + ['ldapUserAvatarRule', 'default', Backend::PROVIDE_AVATAR, true], |
|
| 1445 | + ['ldapUserAvatarRule', 'data:selfiePhoto', Backend::PROVIDE_AVATAR, true], |
|
| 1446 | + ['ldapUserAvatarRule', 'none', Backend::PROVIDE_AVATAR, false], |
|
| 1447 | + ['turnOnPasswordChange', 0, Backend::SET_PASSWORD, false], |
|
| 1448 | + ['turnOnPasswordChange', 1, Backend::SET_PASSWORD, true], |
|
| 1449 | 1449 | ]; |
| 1450 | 1450 | } |
| 1451 | 1451 | |
| 1452 | 1452 | #[\PHPUnit\Framework\Attributes\DataProvider('actionProvider')] |
| 1453 | - public function testImplementsAction(string $configurable, string|int $value, int $actionCode, bool $expected): void { |
|
| 1453 | + public function testImplementsAction(string $configurable, string | int $value, int $actionCode, bool $expected): void { |
|
| 1454 | 1454 | $this->pluginManager->expects($this->once()) |
| 1455 | 1455 | ->method('getImplementedActions') |
| 1456 | 1456 | ->willReturn(0); |
@@ -78,10 +78,10 @@ discard block |
||
| 78 | 78 | // save file with content |
| 79 | 79 | $this->view->file_put_contents($this->filename, $this->data); |
| 80 | 80 | $this->view->mkdir($this->folder); |
| 81 | - $this->view->mkdir($this->folder . $this->subfolder); |
|
| 82 | - $this->view->mkdir($this->folder . $this->subfolder . $this->subsubfolder); |
|
| 83 | - $this->view->file_put_contents($this->folder . $this->filename, $this->data); |
|
| 84 | - $this->view->file_put_contents($this->folder . $this->subfolder . $this->filename, $this->data); |
|
| 81 | + $this->view->mkdir($this->folder.$this->subfolder); |
|
| 82 | + $this->view->mkdir($this->folder.$this->subfolder.$this->subsubfolder); |
|
| 83 | + $this->view->file_put_contents($this->folder.$this->filename, $this->data); |
|
| 84 | + $this->view->file_put_contents($this->folder.$this->subfolder.$this->filename, $this->data); |
|
| 85 | 85 | $mount = $this->view->getMount($this->filename); |
| 86 | 86 | $mount->getStorage()->getScanner()->scan('', Scanner::SCAN_RECURSIVE); |
| 87 | 87 | |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | private function createOCS($userId) { |
| 109 | 109 | $l = $this->getMockBuilder(IL10N::class)->getMock(); |
| 110 | 110 | $l->method('t') |
| 111 | - ->willReturnCallback(function ($text, $parameters = []) { |
|
| 111 | + ->willReturnCallback(function($text, $parameters = []) { |
|
| 112 | 112 | return vsprintf($text, $parameters); |
| 113 | 113 | }); |
| 114 | 114 | $config = $this->createMock(IConfig::class); |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | $this->assertEquals(19, $data['permissions']); |
| 161 | 161 | $this->assertEmpty($data['expiration']); |
| 162 | 162 | |
| 163 | - $this->shareManager->getShareById('ocinternal:' . $data['id']); |
|
| 163 | + $this->shareManager->getShareById('ocinternal:'.$data['id']); |
|
| 164 | 164 | |
| 165 | 165 | $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); |
| 166 | 166 | $ocs->deleteShare($data['id']); |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | $this->assertEquals(31, $data['permissions']); |
| 178 | 178 | $this->assertEmpty($data['expiration']); |
| 179 | 179 | |
| 180 | - $this->shareManager->getShareById('ocinternal:' . $data['id']); |
|
| 180 | + $this->shareManager->getShareById('ocinternal:'.$data['id']); |
|
| 181 | 181 | |
| 182 | 182 | $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); |
| 183 | 183 | $ocs->deleteShare($data['id']); |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | $this->assertEquals(19, $data['permissions']); |
| 194 | 194 | $this->assertEmpty($data['expiration']); |
| 195 | 195 | |
| 196 | - $this->shareManager->getShareById('ocinternal:' . $data['id']); |
|
| 196 | + $this->shareManager->getShareById('ocinternal:'.$data['id']); |
|
| 197 | 197 | |
| 198 | 198 | $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); |
| 199 | 199 | $ocs->deleteShare($data['id']); |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | $this->assertEquals(31, $data['permissions']); |
| 210 | 210 | $this->assertEmpty($data['expiration']); |
| 211 | 211 | |
| 212 | - $this->shareManager->getShareById('ocinternal:' . $data['id']); |
|
| 212 | + $this->shareManager->getShareById('ocinternal:'.$data['id']); |
|
| 213 | 213 | |
| 214 | 214 | $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); |
| 215 | 215 | $ocs->deleteShare($data['id']); |
@@ -229,10 +229,10 @@ discard block |
||
| 229 | 229 | $this->assertTrue(is_string($data['token'])); |
| 230 | 230 | |
| 231 | 231 | // check for correct link |
| 232 | - $url = Server::get(IURLGenerator::class)->getAbsoluteURL('/index.php/s/' . $data['token']); |
|
| 232 | + $url = Server::get(IURLGenerator::class)->getAbsoluteURL('/index.php/s/'.$data['token']); |
|
| 233 | 233 | $this->assertEquals($url, $data['url']); |
| 234 | 234 | |
| 235 | - $this->shareManager->getShareById('ocinternal:' . $data['id']); |
|
| 235 | + $this->shareManager->getShareById('ocinternal:'.$data['id']); |
|
| 236 | 236 | |
| 237 | 237 | $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); |
| 238 | 238 | $ocs->deleteShare($data['id']); |
@@ -262,10 +262,10 @@ discard block |
||
| 262 | 262 | $this->assertTrue(is_string($data['token'])); |
| 263 | 263 | |
| 264 | 264 | // check for correct link |
| 265 | - $url = Server::get(IURLGenerator::class)->getAbsoluteURL('/index.php/s/' . $data['token']); |
|
| 265 | + $url = Server::get(IURLGenerator::class)->getAbsoluteURL('/index.php/s/'.$data['token']); |
|
| 266 | 266 | $this->assertEquals($url, $data['url']); |
| 267 | 267 | |
| 268 | - $this->shareManager->getShareById('ocinternal:' . $data['id']); |
|
| 268 | + $this->shareManager->getShareById('ocinternal:'.$data['id']); |
|
| 269 | 269 | |
| 270 | 270 | $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); |
| 271 | 271 | $ocs->deleteShare($data['id']); |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | |
| 335 | 335 | $data = $result->getData(); |
| 336 | 336 | |
| 337 | - $this->shareManager->getShareById('ocinternal:' . $data['id']); |
|
| 337 | + $this->shareManager->getShareById('ocinternal:'.$data['id']); |
|
| 338 | 338 | |
| 339 | 339 | $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); |
| 340 | 340 | $ocs->deleteShare($data['id']); |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | |
| 351 | 351 | $data = $result->getData(); |
| 352 | 352 | |
| 353 | - $this->shareManager->getShareById('ocinternal:' . $data['id']); |
|
| 353 | + $this->shareManager->getShareById('ocinternal:'.$data['id']); |
|
| 354 | 354 | |
| 355 | 355 | $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); |
| 356 | 356 | $ocs->deleteShare($data['id']); |
@@ -440,7 +440,7 @@ discard block |
||
| 440 | 440 | $id = $data['id']; |
| 441 | 441 | |
| 442 | 442 | // check for correct link |
| 443 | - $url = Server::get(IURLGenerator::class)->getAbsoluteURL('/index.php/s/' . $data['token']); |
|
| 443 | + $url = Server::get(IURLGenerator::class)->getAbsoluteURL('/index.php/s/'.$data['token']); |
|
| 444 | 444 | $this->assertEquals($url, $data['url']); |
| 445 | 445 | |
| 446 | 446 | // check for link in getall shares |
@@ -573,7 +573,7 @@ discard block |
||
| 573 | 573 | ->setPermissions(19); |
| 574 | 574 | $share1 = $this->shareManager->createShare($share1); |
| 575 | 575 | |
| 576 | - $node2 = $this->userFolder->get($this->folder . '/' . $this->filename); |
|
| 576 | + $node2 = $this->userFolder->get($this->folder.'/'.$this->filename); |
|
| 577 | 577 | $share2 = $this->shareManager->newShare(); |
| 578 | 578 | $share2->setNode($node2) |
| 579 | 579 | ->setSharedBy(self::TEST_FILES_SHARING_API_USER1) |
@@ -629,7 +629,7 @@ discard block |
||
| 629 | 629 | $share1->setStatus(IShare::STATUS_ACCEPTED); |
| 630 | 630 | $this->shareManager->updateShare($share1); |
| 631 | 631 | |
| 632 | - $node2 = $this->userFolder->get($this->folder . '/' . $this->filename); |
|
| 632 | + $node2 = $this->userFolder->get($this->folder.'/'.$this->filename); |
|
| 633 | 633 | $share2 = $this->shareManager->newShare(); |
| 634 | 634 | $share2->setNode($node2) |
| 635 | 635 | ->setSharedBy(self::TEST_FILES_SHARING_API_USER2) |
@@ -639,7 +639,7 @@ discard block |
||
| 639 | 639 | $share2->setStatus(IShare::STATUS_ACCEPTED); |
| 640 | 640 | $this->shareManager->updateShare($share2); |
| 641 | 641 | |
| 642 | - $node3 = $this->userFolder->get($this->folder . '/' . $this->subfolder . '/' . $this->filename); |
|
| 642 | + $node3 = $this->userFolder->get($this->folder.'/'.$this->subfolder.'/'.$this->filename); |
|
| 643 | 643 | $share3 = $this->shareManager->newShare(); |
| 644 | 644 | $share3->setNode($node3) |
| 645 | 645 | ->setSharedBy(self::TEST_FILES_SHARING_API_USER2) |
@@ -651,9 +651,9 @@ discard block |
||
| 651 | 651 | |
| 652 | 652 | $testValues = [ |
| 653 | 653 | ['query' => $this->folder, |
| 654 | - 'expectedResult' => $this->folder . $this->filename], |
|
| 655 | - ['query' => $this->folder . $this->subfolder, |
|
| 656 | - 'expectedResult' => $this->folder . $this->subfolder . $this->filename], |
|
| 654 | + 'expectedResult' => $this->folder.$this->filename], |
|
| 655 | + ['query' => $this->folder.$this->subfolder, |
|
| 656 | + 'expectedResult' => $this->folder.$this->subfolder.$this->filename], |
|
| 657 | 657 | ]; |
| 658 | 658 | |
| 659 | 659 | foreach ($testValues as $value) { |
@@ -677,7 +677,7 @@ discard block |
||
| 677 | 677 | * reshare a sub folder and check if we get the correct path |
| 678 | 678 | */ |
| 679 | 679 | public function testGetShareFromSubFolderReShares(): void { |
| 680 | - $node1 = $this->userFolder->get($this->folder . $this->subfolder); |
|
| 680 | + $node1 = $this->userFolder->get($this->folder.$this->subfolder); |
|
| 681 | 681 | $share1 = $this->shareManager->newShare(); |
| 682 | 682 | $share1->setNode($node1) |
| 683 | 683 | ->setSharedBy(self::TEST_FILES_SHARING_API_USER1) |
@@ -718,7 +718,7 @@ discard block |
||
| 718 | 718 | * test re-re-share of folder if the path gets constructed correctly |
| 719 | 719 | */ |
| 720 | 720 | public function XtestGetShareFromFolderReReShares() { |
| 721 | - $node1 = $this->userFolder->get($this->folder . $this->subfolder); |
|
| 721 | + $node1 = $this->userFolder->get($this->folder.$this->subfolder); |
|
| 722 | 722 | $share1 = $this->shareManager->newShare(); |
| 723 | 723 | $share1->setNode($node1) |
| 724 | 724 | ->setSharedBy(self::TEST_FILES_SHARING_API_USER1) |
@@ -727,7 +727,7 @@ discard block |
||
| 727 | 727 | ->setPermissions(31); |
| 728 | 728 | $share1 = $this->shareManager->createShare($share1); |
| 729 | 729 | |
| 730 | - $node2 = $this->userFolder->get($this->folder . $this->subfolder . $this->subsubfolder); |
|
| 730 | + $node2 = $this->userFolder->get($this->folder.$this->subfolder.$this->subsubfolder); |
|
| 731 | 731 | $share2 = $this->shareManager->newShare(); |
| 732 | 732 | $share2->setNode($node2) |
| 733 | 733 | ->setSharedBy(self::TEST_FILES_SHARING_API_USER2) |
@@ -769,7 +769,7 @@ discard block |
||
| 769 | 769 | |
| 770 | 770 | // we should get exactly one result |
| 771 | 771 | $this->assertCount(1, $data); |
| 772 | - $this->assertEquals($this->folder . $this->subfolder, $data[0]['path']); |
|
| 772 | + $this->assertEquals($this->folder.$this->subfolder, $data[0]['path']); |
|
| 773 | 773 | |
| 774 | 774 | /* |
| 775 | 775 | * Test for second initiator |
@@ -783,7 +783,7 @@ discard block |
||
| 783 | 783 | |
| 784 | 784 | // we should get exactly one result |
| 785 | 785 | $this->assertCount(1, $data); |
| 786 | - $this->assertEquals($this->subfolder . $this->subsubfolder, $data[0]['path']); |
|
| 786 | + $this->assertEquals($this->subfolder.$this->subsubfolder, $data[0]['path']); |
|
| 787 | 787 | |
| 788 | 788 | $this->shareManager->deleteShare($share1); |
| 789 | 789 | $this->shareManager->deleteShare($share2); |
@@ -795,7 +795,7 @@ discard block |
||
| 795 | 795 | */ |
| 796 | 796 | public function testGetShareMultipleSharedFolder(): void { |
| 797 | 797 | $this->setUp(); |
| 798 | - $node1 = $this->userFolder->get($this->folder . $this->subfolder); |
|
| 798 | + $node1 = $this->userFolder->get($this->folder.$this->subfolder); |
|
| 799 | 799 | $share1 = $this->shareManager->newShare(); |
| 800 | 800 | $share1->setNode($node1) |
| 801 | 801 | ->setSharedBy(self::TEST_FILES_SHARING_API_USER1) |
@@ -838,7 +838,7 @@ discard block |
||
| 838 | 838 | |
| 839 | 839 | //$request = $this->createRequest(['path' => $this->folder.$this->subfolder]); |
| 840 | 840 | $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER2); |
| 841 | - $result2 = $ocs->getShares('false', 'false', 'false', $this->folder . $this->subfolder); |
|
| 841 | + $result2 = $ocs->getShares('false', 'false', 'false', $this->folder.$this->subfolder); |
|
| 842 | 842 | $ocs->cleanup(); |
| 843 | 843 | |
| 844 | 844 | // test should return one share within $this->folder |
@@ -847,7 +847,7 @@ discard block |
||
| 847 | 847 | $s2 = reset($data2); |
| 848 | 848 | |
| 849 | 849 | $this->assertEquals($this->subfolder, $s1['path']); |
| 850 | - $this->assertEquals($this->folder . $this->subfolder, $s2['path']); |
|
| 850 | + $this->assertEquals($this->folder.$this->subfolder, $s2['path']); |
|
| 851 | 851 | |
| 852 | 852 | $this->shareManager->deleteShare($share1); |
| 853 | 853 | $this->shareManager->deleteShare($share2); |
@@ -858,7 +858,7 @@ discard block |
||
| 858 | 858 | * test re-re-share of folder if the path gets constructed correctly |
| 859 | 859 | */ |
| 860 | 860 | public function testGetShareFromFileReReShares(): void { |
| 861 | - $node1 = $this->userFolder->get($this->folder . $this->subfolder); |
|
| 861 | + $node1 = $this->userFolder->get($this->folder.$this->subfolder); |
|
| 862 | 862 | $share1 = $this->shareManager->newShare(); |
| 863 | 863 | $share1->setNode($node1) |
| 864 | 864 | ->setSharedBy(self::TEST_FILES_SHARING_API_USER1) |
@@ -870,7 +870,7 @@ discard block |
||
| 870 | 870 | $this->shareManager->updateShare($share1); |
| 871 | 871 | |
| 872 | 872 | $user2Folder = \OC::$server->getUserFolder(self::TEST_FILES_SHARING_API_USER2); |
| 873 | - $node2 = $user2Folder->get($this->subfolder . $this->filename); |
|
| 873 | + $node2 = $user2Folder->get($this->subfolder.$this->filename); |
|
| 874 | 874 | $share2 = $this->shareManager->newShare(); |
| 875 | 875 | $share2->setNode($node2) |
| 876 | 876 | ->setSharedBy(self::TEST_FILES_SHARING_API_USER2) |
@@ -954,7 +954,7 @@ discard block |
||
| 954 | 954 | ); |
| 955 | 955 | $ocs->cleanup(); |
| 956 | 956 | |
| 957 | - $share1 = $this->shareManager->getShareById('ocinternal:' . $share1->getId()); |
|
| 957 | + $share1 = $this->shareManager->getShareById('ocinternal:'.$share1->getId()); |
|
| 958 | 958 | $this->assertEquals(1, $share1->getPermissions()); |
| 959 | 959 | $this->assertEquals(true, $share1->getAttributes()->getAttribute('app1', 'attr1')); |
| 960 | 960 | |
@@ -965,14 +965,14 @@ discard block |
||
| 965 | 965 | $ocs->updateShare($share2->getId(), null, $password); |
| 966 | 966 | $ocs->cleanup(); |
| 967 | 967 | |
| 968 | - $share2 = $this->shareManager->getShareById('ocinternal:' . $share2->getId()); |
|
| 968 | + $share2 = $this->shareManager->getShareById('ocinternal:'.$share2->getId()); |
|
| 969 | 969 | $this->assertNotNull($share2->getPassword()); |
| 970 | 970 | |
| 971 | 971 | $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); |
| 972 | 972 | $ocs->updateShare($share2->getId(), null, ''); |
| 973 | 973 | $ocs->cleanup(); |
| 974 | 974 | |
| 975 | - $share2 = $this->shareManager->getShareById('ocinternal:' . $share2->getId()); |
|
| 975 | + $share2 = $this->shareManager->getShareById('ocinternal:'.$share2->getId()); |
|
| 976 | 976 | $this->assertNull($share2->getPassword()); |
| 977 | 977 | |
| 978 | 978 | $this->shareManager->deleteShare($share1); |
@@ -1133,7 +1133,7 @@ discard block |
||
| 1133 | 1133 | $this->shareManager->updateShare($share1); |
| 1134 | 1134 | |
| 1135 | 1135 | $user2folder = \OC::$server->getUserFolder(self::TEST_FILES_SHARING_API_USER2); |
| 1136 | - $node2 = $user2folder->get($this->folder . '/' . $this->filename); |
|
| 1136 | + $node2 = $user2folder->get($this->folder.'/'.$this->filename); |
|
| 1137 | 1137 | $share2 = $this->shareManager->newShare(); |
| 1138 | 1138 | $share2->setNode($node2) |
| 1139 | 1139 | ->setSharedBy(self::TEST_FILES_SHARING_API_USER2) |
@@ -1172,11 +1172,11 @@ discard block |
||
| 1172 | 1172 | // user2 shares a file from the folder as link |
| 1173 | 1173 | self::loginHelper(self::TEST_FILES_SHARING_API_USER2); |
| 1174 | 1174 | |
| 1175 | - $view = new View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files'); |
|
| 1175 | + $view = new View('/'.self::TEST_FILES_SHARING_API_USER2.'/files'); |
|
| 1176 | 1176 | $view->mkdir('localDir'); |
| 1177 | 1177 | |
| 1178 | 1178 | // move mount point to the folder "localDir" |
| 1179 | - $result = $view->rename($this->folder, 'localDir/' . $this->folder); |
|
| 1179 | + $result = $view->rename($this->folder, 'localDir/'.$this->folder); |
|
| 1180 | 1180 | $this->assertTrue($result !== false); |
| 1181 | 1181 | |
| 1182 | 1182 | // try to share "localDir" |
@@ -1201,7 +1201,7 @@ discard block |
||
| 1201 | 1201 | |
| 1202 | 1202 | //cleanup |
| 1203 | 1203 | |
| 1204 | - $result = $view->rename('localDir/' . $this->folder, $this->folder); |
|
| 1204 | + $result = $view->rename('localDir/'.$this->folder, $this->folder); |
|
| 1205 | 1205 | $this->assertTrue($result !== false); |
| 1206 | 1206 | $view->unlink('localDir'); |
| 1207 | 1207 | |
@@ -1215,7 +1215,7 @@ discard block |
||
| 1215 | 1215 | */ |
| 1216 | 1216 | public static function initTestMountPointsHook($data) { |
| 1217 | 1217 | if ($data['user'] === self::TEST_FILES_SHARING_API_USER1) { |
| 1218 | - Filesystem::mount(self::$tempStorage, [], '/' . self::TEST_FILES_SHARING_API_USER1 . '/files' . self::TEST_FOLDER_NAME); |
|
| 1218 | + Filesystem::mount(self::$tempStorage, [], '/'.self::TEST_FILES_SHARING_API_USER1.'/files'.self::TEST_FOLDER_NAME); |
|
| 1219 | 1219 | } |
| 1220 | 1220 | } |
| 1221 | 1221 | |
@@ -1227,7 +1227,7 @@ discard block |
||
| 1227 | 1227 | $tempStorage->file_put_contents('test.txt', 'abcdef'); |
| 1228 | 1228 | $tempStorage->getScanner()->scan(''); |
| 1229 | 1229 | |
| 1230 | - $this->registerMount(self::TEST_FILES_SHARING_API_USER1, $tempStorage, self::TEST_FILES_SHARING_API_USER1 . '/files' . self::TEST_FOLDER_NAME); |
|
| 1230 | + $this->registerMount(self::TEST_FILES_SHARING_API_USER1, $tempStorage, self::TEST_FILES_SHARING_API_USER1.'/files'.self::TEST_FOLDER_NAME); |
|
| 1231 | 1231 | |
| 1232 | 1232 | // logging in will auto-mount the temp storage for user1 as well |
| 1233 | 1233 | self::loginHelper(self::TEST_FILES_SHARING_API_USER1); |
@@ -1246,10 +1246,10 @@ discard block |
||
| 1246 | 1246 | // user2: check that mount point name appears correctly |
| 1247 | 1247 | self::loginHelper(self::TEST_FILES_SHARING_API_USER2); |
| 1248 | 1248 | |
| 1249 | - $view = new View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files'); |
|
| 1249 | + $view = new View('/'.self::TEST_FILES_SHARING_API_USER2.'/files'); |
|
| 1250 | 1250 | |
| 1251 | 1251 | $this->assertTrue($view->file_exists($this->folder)); |
| 1252 | - $this->assertTrue($view->file_exists($this->folder . '/test.txt')); |
|
| 1252 | + $this->assertTrue($view->file_exists($this->folder.'/test.txt')); |
|
| 1253 | 1253 | |
| 1254 | 1254 | self::loginHelper(self::TEST_FILES_SHARING_API_USER1); |
| 1255 | 1255 | |
@@ -1268,7 +1268,7 @@ discard block |
||
| 1268 | 1268 | return [ |
| 1269 | 1269 | [$date->format('Y-m-d H:i:s'), true], |
| 1270 | 1270 | ['abc', false], |
| 1271 | - [$date->format('Y-m-d H:i:s') . 'xyz', false], |
|
| 1271 | + [$date->format('Y-m-d H:i:s').'xyz', false], |
|
| 1272 | 1272 | ]; |
| 1273 | 1273 | } |
| 1274 | 1274 | |
@@ -1296,10 +1296,10 @@ discard block |
||
| 1296 | 1296 | $this->assertEquals(substr($date, 0, 10), substr($data['expiration'], 0, 10)); |
| 1297 | 1297 | |
| 1298 | 1298 | // check for correct link |
| 1299 | - $url = Server::get(IURLGenerator::class)->getAbsoluteURL('/index.php/s/' . $data['token']); |
|
| 1299 | + $url = Server::get(IURLGenerator::class)->getAbsoluteURL('/index.php/s/'.$data['token']); |
|
| 1300 | 1300 | $this->assertEquals($url, $data['url']); |
| 1301 | 1301 | |
| 1302 | - $share = $this->shareManager->getShareById('ocinternal:' . $data['id']); |
|
| 1302 | + $share = $this->shareManager->getShareById('ocinternal:'.$data['id']); |
|
| 1303 | 1303 | |
| 1304 | 1304 | $this->assertEquals($date, $share->getExpirationDate()->format('Y-m-d H:i:s')); |
| 1305 | 1305 | |
@@ -1326,10 +1326,10 @@ discard block |
||
| 1326 | 1326 | $this->assertEquals($date->format('Y-m-d 00:00:00'), $data['expiration']); |
| 1327 | 1327 | |
| 1328 | 1328 | // check for correct link |
| 1329 | - $url = Server::get(IURLGenerator::class)->getAbsoluteURL('/index.php/s/' . $data['token']); |
|
| 1329 | + $url = Server::get(IURLGenerator::class)->getAbsoluteURL('/index.php/s/'.$data['token']); |
|
| 1330 | 1330 | $this->assertEquals($url, $data['url']); |
| 1331 | 1331 | |
| 1332 | - $share = $this->shareManager->getShareById('ocinternal:' . $data['id']); |
|
| 1332 | + $share = $this->shareManager->getShareById('ocinternal:'.$data['id']); |
|
| 1333 | 1333 | $date->setTime(0, 0, 0); |
| 1334 | 1334 | $this->assertEquals($date, $share->getExpirationDate()); |
| 1335 | 1335 | |
@@ -12,10 +12,10 @@ discard block |
||
| 12 | 12 | * SPDX-License-Identifier: AGPL-3.0-only |
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | -require_once __DIR__ . '/lib/versioncheck.php'; |
|
| 15 | +require_once __DIR__.'/lib/versioncheck.php'; |
|
| 16 | 16 | |
| 17 | 17 | try { |
| 18 | - require_once __DIR__ . '/lib/base.php'; |
|
| 18 | + require_once __DIR__.'/lib/base.php'; |
|
| 19 | 19 | |
| 20 | 20 | if (isset($argv[1]) && ($argv[1] === '-h' || $argv[1] === '--help')) { |
| 21 | 21 | echo 'Description: |
@@ -41,8 +41,8 @@ discard block |
||
| 41 | 41 | $jobClasses = empty($jobClasses) ? null : $jobClasses; |
| 42 | 42 | |
| 43 | 43 | if ($verbose) { |
| 44 | - $cronService->registerVerboseCallback(function (string $message): void { |
|
| 45 | - echo $message . PHP_EOL; |
|
| 44 | + $cronService->registerVerboseCallback(function(string $message): void { |
|
| 45 | + echo $message.PHP_EOL; |
|
| 46 | 46 | }); |
| 47 | 47 | } |
| 48 | 48 | } else { |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | ['app' => 'cron', 'exception' => $e] |
| 65 | 65 | ); |
| 66 | 66 | if (OC::$CLI) { |
| 67 | - echo $e->getMessage() . PHP_EOL; |
|
| 67 | + echo $e->getMessage().PHP_EOL; |
|
| 68 | 68 | } else { |
| 69 | 69 | $data = [ |
| 70 | 70 | 'status' => 'error', |