@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | $this->l10n = $this->createMock(IL10N::class); |
30 | 30 | $this->l10n->expects($this->any()) |
31 | 31 | ->method('t') |
32 | - ->willReturnCallback(function ($message, array $replace) { |
|
32 | + ->willReturnCallback(function($message, array $replace) { |
|
33 | 33 | return vsprintf($message, $replace); |
34 | 34 | }); |
35 | 35 | $this->config = $this->createMock(IConfig::class); |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | } |
61 | 61 | |
62 | 62 | #[\PHPUnit\Framework\Attributes\DataProvider('dataRun')] |
63 | - public function testRun(string|int $value, string $expected): void { |
|
63 | + public function testRun(string | int $value, string $expected): void { |
|
64 | 64 | $this->urlGenerator->method('linkToDocs')->willReturn('admin-logging'); |
65 | 65 | |
66 | 66 | $this->config->expects(self::once()) |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $this->l10n = $this->createMock(IL10N::class); |
34 | 34 | $this->l10n->expects($this->any()) |
35 | 35 | ->method('t') |
36 | - ->willReturnCallback(function ($message, array $replace) { |
|
36 | + ->willReturnCallback(function($message, array $replace) { |
|
37 | 37 | return vsprintf($message, $replace); |
38 | 38 | }); |
39 | 39 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | #[\PHPUnit\Framework\Attributes\DataProvider('dataTestStatusCode')] |
58 | 58 | public function testStatusCode(array $status, string $expected, bool $hasBody): void { |
59 | - $responses = array_map(function ($state) use ($hasBody) { |
|
59 | + $responses = array_map(function($state) use ($hasBody) { |
|
60 | 60 | $response = $this->createMock(IResponse::class); |
61 | 61 | $response->expects($this->any())->method('getStatusCode')->willReturn($state); |
62 | 62 | $response->expects(($this->atMost(1)))->method('getBody')->willReturn($hasBody ? '# Nextcloud data directory' : 'something else'); |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | * Helper function creates a nicer interface for mocking Generator behavior |
111 | 111 | */ |
112 | 112 | protected function generate(array $yield_values) { |
113 | - return $this->returnCallback(function () use ($yield_values) { |
|
113 | + return $this->returnCallback(function() use ($yield_values) { |
|
114 | 114 | yield from $yield_values; |
115 | 115 | }); |
116 | 116 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | ]; |
80 | 80 | $this->config->expects($this->exactly(2)) |
81 | 81 | ->method('setSystemValues') |
82 | - ->willReturnCallback(function () use (&$calls): void { |
|
82 | + ->willReturnCallback(function() use (&$calls): void { |
|
83 | 83 | $expected = array_shift($calls); |
84 | 84 | $this->assertEquals($expected, func_get_args()); |
85 | 85 | }); |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | |
136 | 136 | $this->l->expects($this->any()) |
137 | 137 | ->method('t') |
138 | - ->willReturnCallback(function ($text, $parameters = []) { |
|
138 | + ->willReturnCallback(function($text, $parameters = []) { |
|
139 | 139 | return vsprintf($text, $parameters); |
140 | 140 | }); |
141 | 141 | $this->userSession |
@@ -97,7 +97,7 @@ |
||
97 | 97 | ]; |
98 | 98 | $this->initialState->expects($this->exactly(2)) |
99 | 99 | ->method('provideInitialState') |
100 | - ->willReturnCallback(function () use (&$calls): void { |
|
100 | + ->willReturnCallback(function() use (&$calls): void { |
|
101 | 101 | $expected = array_shift($calls); |
102 | 102 | $this->assertEquals($expected, func_get_args()); |
103 | 103 | }); |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | $i = 0; |
248 | 248 | $job->expects($this->exactly(\count($notifications))) |
249 | 249 | ->method('createNotifications') |
250 | - ->willReturnCallback(function () use ($notifications, &$i): void { |
|
250 | + ->willReturnCallback(function() use ($notifications, &$i): void { |
|
251 | 251 | $this->assertEquals($notifications[$i], func_get_args()); |
252 | 252 | $i++; |
253 | 253 | }); |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | } |
266 | 266 | |
267 | 267 | #[\PHPUnit\Framework\Attributes\DataProvider('dataCreateNotifications')] |
268 | - public function testCreateNotifications(string $app, string $version, string|false $lastNotification, string|false $callDelete, bool $createNotification, ?array $users, ?array $userNotifications): void { |
|
268 | + public function testCreateNotifications(string $app, string $version, string | false $lastNotification, string | false $callDelete, bool $createNotification, ?array $users, ?array $userNotifications): void { |
|
269 | 269 | $job = $this->getJob([ |
270 | 270 | 'deleteOutdatedNotifications', |
271 | 271 | 'getUsersToNotify', |
@@ -30,55 +30,55 @@ discard block |
||
30 | 30 | |
31 | 31 | return [ |
32 | 32 | // Expiration is disabled - always should return false |
33 | - [ 'disabled', $today, $back10Days, false, false], |
|
34 | - [ 'disabled', $today, $back10Days, true, false], |
|
35 | - [ 'disabled', $today, $ahead100Days, true, false], |
|
33 | + ['disabled', $today, $back10Days, false, false], |
|
34 | + ['disabled', $today, $back10Days, true, false], |
|
35 | + ['disabled', $today, $ahead100Days, true, false], |
|
36 | 36 | |
37 | 37 | // Default: expire in 30 days or earlier when quota requirements are met |
38 | - [ 'auto', $today, $back10Days, false, false], |
|
39 | - [ 'auto', $today, $back35Days, false, false], |
|
40 | - [ 'auto', $today, $back10Days, true, true], |
|
41 | - [ 'auto', $today, $back35Days, true, true], |
|
42 | - [ 'auto', $today, $ahead100Days, true, true], |
|
38 | + ['auto', $today, $back10Days, false, false], |
|
39 | + ['auto', $today, $back35Days, false, false], |
|
40 | + ['auto', $today, $back10Days, true, true], |
|
41 | + ['auto', $today, $back35Days, true, true], |
|
42 | + ['auto', $today, $ahead100Days, true, true], |
|
43 | 43 | |
44 | 44 | // The same with 'auto' |
45 | - [ 'auto, auto', $today, $back10Days, false, false], |
|
46 | - [ 'auto, auto', $today, $back35Days, false, false], |
|
47 | - [ 'auto, auto', $today, $back10Days, true, true], |
|
48 | - [ 'auto, auto', $today, $back35Days, true, true], |
|
45 | + ['auto, auto', $today, $back10Days, false, false], |
|
46 | + ['auto, auto', $today, $back35Days, false, false], |
|
47 | + ['auto, auto', $today, $back10Days, true, true], |
|
48 | + ['auto, auto', $today, $back35Days, true, true], |
|
49 | 49 | |
50 | 50 | // Keep for 15 days but expire anytime if space needed |
51 | - [ '15, auto', $today, $back10Days, false, false], |
|
52 | - [ '15, auto', $today, $back20Days, false, false], |
|
53 | - [ '15, auto', $today, $back10Days, true, true], |
|
54 | - [ '15, auto', $today, $back20Days, true, true], |
|
55 | - [ '15, auto', $today, $ahead100Days, true, true], |
|
51 | + ['15, auto', $today, $back10Days, false, false], |
|
52 | + ['15, auto', $today, $back20Days, false, false], |
|
53 | + ['15, auto', $today, $back10Days, true, true], |
|
54 | + ['15, auto', $today, $back20Days, true, true], |
|
55 | + ['15, auto', $today, $ahead100Days, true, true], |
|
56 | 56 | |
57 | 57 | // Expire anytime if space needed, Expire all older than max |
58 | - [ 'auto, 15', $today, $back10Days, false, false], |
|
59 | - [ 'auto, 15', $today, $back20Days, false, true], |
|
60 | - [ 'auto, 15', $today, $back10Days, true, true], |
|
61 | - [ 'auto, 15', $today, $back20Days, true, true], |
|
62 | - [ 'auto, 15', $today, $ahead100Days, true, true], |
|
58 | + ['auto, 15', $today, $back10Days, false, false], |
|
59 | + ['auto, 15', $today, $back20Days, false, true], |
|
60 | + ['auto, 15', $today, $back10Days, true, true], |
|
61 | + ['auto, 15', $today, $back20Days, true, true], |
|
62 | + ['auto, 15', $today, $ahead100Days, true, true], |
|
63 | 63 | |
64 | 64 | // Expire all older than max OR older than min if space needed |
65 | - [ '15, 25', $today, $back10Days, false, false], |
|
66 | - [ '15, 25', $today, $back20Days, false, false], |
|
67 | - [ '15, 25', $today, $back30Days, false, true], |
|
68 | - [ '15, 25', $today, $back10Days, false, false], |
|
69 | - [ '15, 25', $today, $back20Days, true, true], |
|
70 | - [ '15, 25', $today, $back30Days, true, true], |
|
71 | - [ '15, 25', $today, $ahead100Days, true, false], |
|
65 | + ['15, 25', $today, $back10Days, false, false], |
|
66 | + ['15, 25', $today, $back20Days, false, false], |
|
67 | + ['15, 25', $today, $back30Days, false, true], |
|
68 | + ['15, 25', $today, $back10Days, false, false], |
|
69 | + ['15, 25', $today, $back20Days, true, true], |
|
70 | + ['15, 25', $today, $back30Days, true, true], |
|
71 | + ['15, 25', $today, $ahead100Days, true, false], |
|
72 | 72 | |
73 | 73 | // Expire all older than max OR older than min if space needed |
74 | 74 | // Max<Min case |
75 | - [ '25, 15', $today, $back10Days, false, false], |
|
76 | - [ '25, 15', $today, $back20Days, false, false], |
|
77 | - [ '25, 15', $today, $back30Days, false, true], |
|
78 | - [ '25, 15', $today, $back10Days, false, false], |
|
79 | - [ '25, 15', $today, $back20Days, true, false], |
|
80 | - [ '25, 15', $today, $back30Days, true, true], |
|
81 | - [ '25, 15', $today, $ahead100Days, true, false], |
|
75 | + ['25, 15', $today, $back10Days, false, false], |
|
76 | + ['25, 15', $today, $back20Days, false, false], |
|
77 | + ['25, 15', $today, $back30Days, false, true], |
|
78 | + ['25, 15', $today, $back10Days, false, false], |
|
79 | + ['25, 15', $today, $back20Days, true, false], |
|
80 | + ['25, 15', $today, $back30Days, true, true], |
|
81 | + ['25, 15', $today, $ahead100Days, true, false], |
|
82 | 82 | ]; |
83 | 83 | } |
84 | 84 | |
@@ -96,20 +96,20 @@ discard block |
||
96 | 96 | |
97 | 97 | public static function timestampTestData(): array { |
98 | 98 | return [ |
99 | - [ 'disabled', false], |
|
100 | - [ 'auto', false ], |
|
101 | - [ 'auto,auto', false ], |
|
102 | - [ 'auto, auto', false ], |
|
103 | - [ 'auto, 3', self::FAKE_TIME_NOW - (3 * self::SECONDS_PER_DAY) ], |
|
104 | - [ '5, auto', false ], |
|
105 | - [ '3, 5', self::FAKE_TIME_NOW - (5 * self::SECONDS_PER_DAY) ], |
|
106 | - [ '10, 3', self::FAKE_TIME_NOW - (10 * self::SECONDS_PER_DAY) ], |
|
99 | + ['disabled', false], |
|
100 | + ['auto', false], |
|
101 | + ['auto,auto', false], |
|
102 | + ['auto, auto', false], |
|
103 | + ['auto, 3', self::FAKE_TIME_NOW - (3 * self::SECONDS_PER_DAY)], |
|
104 | + ['5, auto', false], |
|
105 | + ['3, 5', self::FAKE_TIME_NOW - (5 * self::SECONDS_PER_DAY)], |
|
106 | + ['10, 3', self::FAKE_TIME_NOW - (10 * self::SECONDS_PER_DAY)], |
|
107 | 107 | ]; |
108 | 108 | } |
109 | 109 | |
110 | 110 | |
111 | 111 | #[\PHPUnit\Framework\Attributes\DataProvider('timestampTestData')] |
112 | - public function testGetMaxAgeAsTimestamp(string $configValue, bool|int $expectedMaxAgeTimestamp): void { |
|
112 | + public function testGetMaxAgeAsTimestamp(string $configValue, bool | int $expectedMaxAgeTimestamp): void { |
|
113 | 113 | $mockedConfig = $this->getMockedConfig($configValue); |
114 | 114 | $mockedTimeFactory = $this->getMockedTimeFactory( |
115 | 115 | self::FAKE_TIME_NOW |
@@ -68,9 +68,9 @@ discard block |
||
68 | 68 | $qResult->closeCursor(); |
69 | 69 | $this->assertCount(1, $result); |
70 | 70 | $this->assertSame($expectedUrl, $result[0]['url']); |
71 | - $this->assertSame($id, (int)$result[0]['id']); |
|
71 | + $this->assertSame($id, (int) $result[0]['id']); |
|
72 | 72 | $this->assertSame($expectedHash, $result[0]['url_hash']); |
73 | - $this->assertSame(TrustedServers::STATUS_PENDING, (int)$result[0]['status']); |
|
73 | + $this->assertSame(TrustedServers::STATUS_PENDING, (int) $result[0]['status']); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | public static function dataTestAddServer(): array { |
@@ -93,8 +93,8 @@ discard block |
||
93 | 93 | $this->assertCount(2, $result); |
94 | 94 | $this->assertSame('server1', $result[0]['url']); |
95 | 95 | $this->assertSame('server2', $result[1]['url']); |
96 | - $this->assertSame($id1, (int)$result[0]['id']); |
|
97 | - $this->assertSame($id2, (int)$result[1]['id']); |
|
96 | + $this->assertSame($id1, (int) $result[0]['id']); |
|
97 | + $this->assertSame($id2, (int) $result[1]['id']); |
|
98 | 98 | |
99 | 99 | $this->dbHandler->removeServer($id2); |
100 | 100 | $query = $this->connection->getQueryBuilder()->select('*')->from($this->dbTable); |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | $qResult->closeCursor(); |
105 | 105 | $this->assertCount(1, $result); |
106 | 106 | $this->assertSame('server1', $result[0]['url']); |
107 | - $this->assertSame($id1, (int)$result[0]['id']); |
|
107 | + $this->assertSame($id1, (int) $result[0]['id']); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | |
@@ -124,8 +124,8 @@ discard block |
||
124 | 124 | $this->assertSame(2, count($result)); |
125 | 125 | $this->assertSame('server1', $result[0]['url']); |
126 | 126 | $this->assertSame('server2', $result[1]['url']); |
127 | - $this->assertSame($id1, (int)$result[0]['id']); |
|
128 | - $this->assertSame($id2, (int)$result[1]['id']); |
|
127 | + $this->assertSame($id1, (int) $result[0]['id']); |
|
128 | + $this->assertSame($id2, (int) $result[1]['id']); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | #[\PHPUnit\Framework\Attributes\DataProvider('dataTestServerExists')] |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | $result = $qResult->fetchAll(); |
207 | 207 | $qResult->closeCursor(); |
208 | 208 | $this->assertCount(1, $result); |
209 | - $this->assertSame(TrustedServers::STATUS_PENDING, (int)$result[0]['status']); |
|
209 | + $this->assertSame(TrustedServers::STATUS_PENDING, (int) $result[0]['status']); |
|
210 | 210 | $this->dbHandler->setServerStatus('http://server1', TrustedServers::STATUS_OK); |
211 | 211 | $query = $this->connection->getQueryBuilder()->select('*')->from($this->dbTable); |
212 | 212 | |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | $result = $qResult->fetchAll(); |
215 | 215 | $qResult->closeCursor(); |
216 | 216 | $this->assertCount(1, $result); |
217 | - $this->assertSame(TrustedServers::STATUS_OK, (int)$result[0]['status']); |
|
217 | + $this->assertSame(TrustedServers::STATUS_OK, (int) $result[0]['status']); |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | public function testGetServerStatus(): void { |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | |
88 | 88 | $this->loginAsUser($this->user1); |
89 | 89 | |
90 | - $view = new View('/' . $this->user1 . '/'); |
|
90 | + $view = new View('/'.$this->user1.'/'); |
|
91 | 91 | $view->mkdir('files/test'); |
92 | 92 | |
93 | 93 | $fileInfo = $view->getFileInfo('files/test'); |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | $output |
118 | 118 | ->expects($this->exactly(3)) |
119 | 119 | ->method('writeln') |
120 | - ->willReturnCallback(function (string $message) use (&$calls): void { |
|
120 | + ->willReturnCallback(function(string $message) use (&$calls): void { |
|
121 | 121 | $expected = array_shift($calls); |
122 | 122 | $this->assertSame($expected, $message); |
123 | 123 | }); |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | } |
92 | 92 | |
93 | 93 | #[\PHPUnit\Framework\Attributes\DataProvider('dataGetFile')] |
94 | - public function testGetFile(array|string $parameter, ?int $eventId, string $id, string $name, string $path): void { |
|
94 | + public function testGetFile(array | string $parameter, ?int $eventId, string $id, string $name, string $path): void { |
|
95 | 95 | $provider = $this->getProvider(); |
96 | 96 | |
97 | 97 | if ($eventId !== null) { |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $this->url->expects($this->once()) |
107 | 107 | ->method('linkToRouteAbsolute') |
108 | 108 | ->with('files.viewcontroller.showFile', ['fileid' => $id]) |
109 | - ->willReturn('link-' . $id); |
|
109 | + ->willReturn('link-'.$id); |
|
110 | 110 | |
111 | 111 | $result = self::invokePrivate($provider, 'getFile', [$parameter, $event]); |
112 | 112 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $this->assertSame($id, $result['id']); |
115 | 115 | $this->assertSame($name, $result['name']); |
116 | 116 | $this->assertSame($path, $result['path']); |
117 | - $this->assertSame('link-' . $id, $result['link']); |
|
117 | + $this->assertSame('link-'.$id, $result['link']); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 |