Completed
Push — master ( 8e04af...dc97bc )
by John
36:14 queued 10s
created
build/integration/features/bootstrap/BasicStructure.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 use PHPUnit\Framework\Assert;
14 14
 use Psr\Http\Message\ResponseInterface;
15 15
 
16
-require __DIR__ . '/../../vendor/autoload.php';
16
+require __DIR__.'/../../vendor/autoload.php';
17 17
 
18 18
 trait BasicStructure {
19 19
 	use Auth;
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	 * @param string $version
78 78
 	 */
79 79
 	public function usingApiVersion($version) {
80
-		$this->apiVersion = (int)$version;
80
+		$this->apiVersion = (int) $version;
81 81
 	}
82 82
 
83 83
 	/**
@@ -127,13 +127,13 @@  discard block
 block discarded – undo
127 127
 			throw new \RuntimeException('No response available');
128 128
 		}
129 129
 
130
-		$body = (string)$response->getBody();
130
+		$body = (string) $response->getBody();
131 131
 		if (str_starts_with($body, '<')) {
132 132
 			$body = simplexml_load_string($body);
133 133
 			if ($body === false) {
134 134
 				throw new \RuntimeException('Could not parse OCS response, body is not valid XML');
135 135
 			}
136
-			return (int)$body->meta[0]->statuscode;
136
+			return (int) $body->meta[0]->statuscode;
137 137
 		}
138 138
 
139 139
 		return json_decode($body, true)['ocs']['meta']['statuscode'];
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 * @return array
147 147
 	 */
148 148
 	public function simplifyArray($arrayOfArrays) {
149
-		$a = array_map(function ($subArray) {
149
+		$a = array_map(function($subArray) {
150 150
 			return $subArray[0];
151 151
 		}, $arrayOfArrays);
152 152
 		return $a;
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 	 * @param TableNode $body
160 160
 	 */
161 161
 	public function sendingToWith($verb, $url, $body) {
162
-		$fullUrl = $this->baseUrl . "v{$this->apiVersion}.php" . $url;
162
+		$fullUrl = $this->baseUrl."v{$this->apiVersion}.php".$url;
163 163
 		$client = new Client();
164 164
 		$options = [];
165 165
 		if ($this->currentUser === 'admin') {
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 	 * @param array $headers
199 199
 	 */
200 200
 	protected function sendRequestForJSON(string $verb, string $url, $body = null, array $headers = []): void {
201
-		$fullUrl = $this->baseUrl . "v{$this->apiVersion}.php" . $url;
201
+		$fullUrl = $this->baseUrl."v{$this->apiVersion}.php".$url;
202 202
 		$client = new Client();
203 203
 		$options = [];
204 204
 		if ($this->currentUser === 'admin') {
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 	}
236 236
 
237 237
 	public function sendingToWithDirectUrl($verb, $url, $body) {
238
-		$fullUrl = substr($this->baseUrl, 0, -5) . $url;
238
+		$fullUrl = substr($this->baseUrl, 0, -5).$url;
239 239
 		$client = new Client();
240 240
 		$options = [];
241 241
 		if ($this->currentUser === 'admin') {
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 	public function isExpectedUrl($possibleUrl, $finalPart) {
259 259
 		$baseUrlChopped = substr($this->baseUrl, 0, -4);
260 260
 		$endCharacter = strlen($baseUrlChopped) + strlen($finalPart);
261
-		return (substr($possibleUrl, 0, $endCharacter) == "$baseUrlChopped" . "$finalPart");
261
+		return (substr($possibleUrl, 0, $endCharacter) == "$baseUrlChopped"."$finalPart");
262 262
 	}
263 263
 
264 264
 	/**
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 	 */
299 299
 	public function loggingInUsingWebAs($user) {
300 300
 		$baseUrl = substr($this->baseUrl, 0, -5);
301
-		$loginUrl = $baseUrl . '/index.php/login';
301
+		$loginUrl = $baseUrl.'/index.php/login';
302 302
 		// Request a new session and extract CSRF token
303 303
 		$client = new Client();
304 304
 		$response = $client->get(
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 		try {
357 357
 			$this->response = $client->request(
358 358
 				$method,
359
-				$baseUrl . $url,
359
+				$baseUrl.$url,
360 360
 				$options
361 361
 			);
362 362
 		} catch (ClientException $e) {
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 		try {
377 377
 			$this->response = $client->request(
378 378
 				$method,
379
-				$baseUrl . $url,
379
+				$baseUrl.$url,
380 380
 				[
381 381
 					'cookies' => $this->cookieJar
382 382
 				]
@@ -387,8 +387,8 @@  discard block
 block discarded – undo
387 387
 	}
388 388
 
389 389
 	public static function removeFile($path, $filename) {
390
-		if (file_exists("$path" . "$filename")) {
391
-			unlink("$path" . "$filename");
390
+		if (file_exists("$path"."$filename")) {
391
+			unlink("$path"."$filename");
392 392
 		}
393 393
 	}
394 394
 
@@ -399,14 +399,14 @@  discard block
 block discarded – undo
399 399
 	 * @param string $text
400 400
 	 */
401 401
 	public function modifyTextOfFile($user, $filename, $text) {
402
-		self::removeFile($this->getDataDirectory() . "/$user/files", "$filename");
403
-		file_put_contents($this->getDataDirectory() . "/$user/files" . "$filename", "$text");
402
+		self::removeFile($this->getDataDirectory()."/$user/files", "$filename");
403
+		file_put_contents($this->getDataDirectory()."/$user/files"."$filename", "$text");
404 404
 	}
405 405
 
406 406
 	private function getDataDirectory() {
407 407
 		// Based on "runOcc" from CommandLine trait
408 408
 		$args = ['config:system:get', 'datadirectory'];
409
-		$args = array_map(function ($arg) {
409
+		$args = array_map(function($arg) {
410 410
 			return escapeshellarg($arg);
411 411
 		}, $args);
412 412
 		$args[] = '--no-ansi --no-warnings';
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 			1 => ['pipe', 'w'],
418 418
 			2 => ['pipe', 'w'],
419 419
 		];
420
-		$process = proc_open('php console.php ' . $args, $descriptor, $pipes, $ocPath = '../..');
420
+		$process = proc_open('php console.php '.$args, $descriptor, $pipes, $ocPath = '../..');
421 421
 		$lastStdOut = stream_get_contents($pipes[1]);
422 422
 		proc_close($process);
423 423
 
@@ -432,19 +432,19 @@  discard block
 block discarded – undo
432 432
 	 */
433 433
 	public function fileIsCreatedTimesInUserData($filename, $times, $user) {
434 434
 		for ($i = 0; $i < $times; $i++) {
435
-			file_put_contents($this->getDataDirectory() . "/$user/files" . "$filename-$i", "content-$i");
435
+			file_put_contents($this->getDataDirectory()."/$user/files"."$filename-$i", "content-$i");
436 436
 		}
437 437
 	}
438 438
 
439 439
 	public function createFileSpecificSize($name, $size) {
440
-		$file = fopen('work/' . "$name", 'w');
440
+		$file = fopen('work/'."$name", 'w');
441 441
 		fseek($file, $size - 1, SEEK_CUR);
442 442
 		fwrite($file, 'a'); // write a dummy char at SIZE position
443 443
 		fclose($file);
444 444
 	}
445 445
 
446 446
 	public function createFileWithText($name, $text) {
447
-		$file = fopen('work/' . "$name", 'w');
447
+		$file = fopen('work/'."$name", 'w');
448 448
 		fwrite($file, $text);
449 449
 		fclose($file);
450 450
 	}
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
 	 * @param int $seconds
473 473
 	 */
474 474
 	public function sleepForSeconds($seconds) {
475
-		sleep((int)$seconds);
475
+		sleep((int) $seconds);
476 476
 	}
477 477
 
478 478
 	/**
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
 	 */
481 481
 	public static function addFilesToSkeleton() {
482 482
 		for ($i = 0; $i < 5; $i++) {
483
-			file_put_contents('../../core/skeleton/' . 'textfile' . "$i" . '.txt', "Nextcloud test text file\n");
483
+			file_put_contents('../../core/skeleton/'.'textfile'."$i".'.txt', "Nextcloud test text file\n");
484 484
 		}
485 485
 		if (!file_exists('../../core/skeleton/FOLDER')) {
486 486
 			mkdir('../../core/skeleton/FOLDER', 0777, true);
@@ -488,11 +488,11 @@  discard block
 block discarded – undo
488 488
 		if (!file_exists('../../core/skeleton/PARENT')) {
489 489
 			mkdir('../../core/skeleton/PARENT', 0777, true);
490 490
 		}
491
-		file_put_contents('../../core/skeleton/PARENT/' . 'parent.txt', "Nextcloud test text file\n");
491
+		file_put_contents('../../core/skeleton/PARENT/'.'parent.txt', "Nextcloud test text file\n");
492 492
 		if (!file_exists('../../core/skeleton/PARENT/CHILD')) {
493 493
 			mkdir('../../core/skeleton/PARENT/CHILD', 0777, true);
494 494
 		}
495
-		file_put_contents('../../core/skeleton/PARENT/CHILD/' . 'child.txt', "Nextcloud test text file\n");
495
+		file_put_contents('../../core/skeleton/PARENT/CHILD/'.'child.txt', "Nextcloud test text file\n");
496 496
 	}
497 497
 
498 498
 	/**
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
 	 */
501 501
 	public static function removeFilesFromSkeleton() {
502 502
 		for ($i = 0; $i < 5; $i++) {
503
-			self::removeFile('../../core/skeleton/', 'textfile' . "$i" . '.txt');
503
+			self::removeFile('../../core/skeleton/', 'textfile'."$i".'.txt');
504 504
 		}
505 505
 		if (is_dir('../../core/skeleton/FOLDER')) {
506 506
 			rmdir('../../core/skeleton/FOLDER');
Please login to merge, or discard this patch.
build/integration/features/bootstrap/FilesRemindersContext.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 use Behat\Behat\Context\Context;
8 8
 use PHPUnit\Framework\Assert;
9 9
 
10
-require __DIR__ . '/../../vendor/autoload.php';
10
+require __DIR__.'/../../vendor/autoload.php';
11 11
 
12 12
 
13 13
 /**
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 		$fileId = $this->getFileIdForPath($this->currentUser, $path);
25 25
 		$this->sendRequestForJSON(
26 26
 			'PUT',
27
-			'/apps/files_reminders/api/v1/' . $fileId,
27
+			'/apps/files_reminders/api/v1/'.$fileId,
28 28
 			['dueDate' => $dueDate],
29 29
 			['OCS-APIREQUEST' => 'true']
30 30
 		);
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 		$fileId = $this->getFileIdForPath($this->currentUser, $path);
38 38
 		$this->sendRequestForJSON(
39 39
 			'GET',
40
-			'/apps/files_reminders/api/v1/' . $fileId,
40
+			'/apps/files_reminders/api/v1/'.$fileId,
41 41
 			null,
42 42
 			['OCS-APIREQUEST' => 'true']
43 43
 		);
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 		$fileId = $this->getFileIdForPath($this->currentUser, $path);
53 53
 		$this->sendRequestForJSON(
54 54
 			'GET',
55
-			'/apps/files_reminders/api/v1/' . $fileId,
55
+			'/apps/files_reminders/api/v1/'.$fileId,
56 56
 			null,
57 57
 			['OCS-APIREQUEST' => 'true']
58 58
 		);
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 		$fileId = $this->getFileIdForPath($this->currentUser, $path);
68 68
 		$this->sendRequestForJSON(
69 69
 			'DELETE',
70
-			'/apps/files_reminders/api/v1/' . $fileId,
70
+			'/apps/files_reminders/api/v1/'.$fileId,
71 71
 			null,
72 72
 			['OCS-APIREQUEST' => 'true']
73 73
 		);
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 			throw new \RuntimeException('No response available');
82 82
 		}
83 83
 
84
-		$body = (string)$this->response->getBody();
84
+		$body = (string) $this->response->getBody();
85 85
 		if (str_starts_with($body, '<')) {
86 86
 			$body = simplexml_load_string($body);
87 87
 			if ($body === false) {
Please login to merge, or discard this patch.