From 7cd473de1fdc33d2ebbd8b570e071bbb1e7bf0ac Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Thu, 24 May 2018 12:02:51 +0545 Subject: [PATCH] Acceptance test coding standard changes --- .../features/bootstrap/AppConfiguration.php | 4 +- .../bootstrap/AppManagementContext.php | 6 +- tests/acceptance/features/bootstrap/Auth.php | 10 +- .../features/bootstrap/BasicStructure.php | 57 ++++++++---- .../features/bootstrap/CalDavContext.php | 9 +- .../bootstrap/CapabilitiesContext.php | 18 ++-- .../features/bootstrap/CardDavContext.php | 9 +- .../features/bootstrap/Checksums.php | 6 +- .../features/bootstrap/CommandLine.php | 26 ++++-- .../features/bootstrap/Comments.php | 33 +++---- .../features/bootstrap/FederationContext.php | 24 ++--- .../features/bootstrap/Provisioning.php | 49 +++++++--- .../acceptance/features/bootstrap/Sharing.php | 62 +++++++++---- tests/acceptance/features/bootstrap/Tags.php | 33 ++++--- .../acceptance/features/bootstrap/WebDav.php | 92 ++++++++++++++----- .../features/bootstrap/WebUIFilesContext.php | 87 +++++++++++++----- .../bootstrap/WebUIGeneralContext.php | 8 +- .../features/bootstrap/WebUILoginContext.php | 20 +++- .../bootstrap/WebUISharingContext.php | 27 ++++-- tests/acceptance/features/lib/FilesPage.php | 7 +- .../features/lib/FilesPageBasic.php | 14 ++- .../features/lib/FilesPageElement/FileRow.php | 24 ++--- .../lib/FilesPageElement/SharingDialog.php | 8 +- .../lib/OwncloudPageElement/OCDialog.php | 6 +- 24 files changed, 434 insertions(+), 205 deletions(-) diff --git a/tests/acceptance/features/bootstrap/AppConfiguration.php b/tests/acceptance/features/bootstrap/AppConfiguration.php index 498cde110560..078283dc2d53 100644 --- a/tests/acceptance/features/bootstrap/AppConfiguration.php +++ b/tests/acceptance/features/bootstrap/AppConfiguration.php @@ -87,7 +87,9 @@ abstract public function theHTTPStatusCodeShouldBe($statusCode); * * @return void */ - public function adminSetsServerParameterToUsingAPI($parameter, $app, $value) { + public function adminSetsServerParameterToUsingAPI( + $parameter, $app, $value + ) { $user = $this->currentUser; $this->currentUser = $this->getAdminUsername(); diff --git a/tests/acceptance/features/bootstrap/AppManagementContext.php b/tests/acceptance/features/bootstrap/AppManagementContext.php index 8fee427bf380..e710f01b3a76 100644 --- a/tests/acceptance/features/bootstrap/AppManagementContext.php +++ b/tests/acceptance/features/bootstrap/AppManagementContext.php @@ -96,8 +96,10 @@ public function setAppDirectories($dir1, $dir2) { * @return void */ public function appHasBeenPutInDir($appId, $version, $dir) { - $ocVersion = \OC::$server->getConfig()->getSystemValue('version', '0.0.0'); - $appInfo = sprintf( + $ocVersion = \OC::$server->getConfig()->getSystemValue( + 'version', '0.0.0' + ); + $appInfo = \sprintf( ' %s diff --git a/tests/acceptance/features/bootstrap/Auth.php b/tests/acceptance/features/bootstrap/Auth.php index 6eba58da0ded..fc3136df49c3 100644 --- a/tests/acceptance/features/bootstrap/Auth.php +++ b/tests/acceptance/features/bootstrap/Auth.php @@ -112,7 +112,8 @@ public function userGeneratesNewAppPasswordNamed($name) { $request->setHeader('requesttoken', $this->requestToken); $request->setHeader('X-Requested-With', 'XMLHttpRequest'); $this->response = $this->client->send($request); - $this->appToken = json_decode($this->response->getBody()->getContents())->token; + $this->appToken + = \json_decode($this->response->getBody()->getContents())->token; } /** @@ -145,7 +146,8 @@ public function aNewClientTokenHasBeenGenerated($user) { ] ] ); - $this->clientToken = json_decode($resp->getBody()->getContents())->token; + $this->clientToken + = \json_decode($resp->getBody()->getContents())->token; } /** @@ -160,7 +162,9 @@ public function aNewClientTokenHasBeenGenerated($user) { */ public function userRequestsURLWithUsingBasicAuth($user, $url, $method) { $authString = $user . ':' . $this->getPasswordForUser($user); - $this->sendRequest($url, $method, 'basic ' . base64_encode($authString)); + $this->sendRequest( + $url, $method, 'basic ' . \base64_encode($authString) + ); } /** diff --git a/tests/acceptance/features/bootstrap/BasicStructure.php b/tests/acceptance/features/bootstrap/BasicStructure.php index 350da96fb7a0..4915f8edaad9 100644 --- a/tests/acceptance/features/bootstrap/BasicStructure.php +++ b/tests/acceptance/features/bootstrap/BasicStructure.php @@ -599,7 +599,9 @@ public function theXMLKey1Key2ValueShouldBe($key1, $key2, $idText) { * * @return void */ - public function theXMLKey1Key2Key3ValueShouldBe($key1, $key2, $key3, $idText) { + public function theXMLKey1Key2Key3ValueShouldBe( + $key1, $key2, $key3, $idText + ) { PHPUnit_Framework_Assert::assertEquals( $idText, $this->getXMLKey1Key2Key3Value($this->response, $key1, $key2, $key3) @@ -912,21 +914,28 @@ public function jsonRespondedShouldMatch(PyStringNode $jsonExpected) { * @return void */ public function statusPhpRespondedShouldMatch(PyStringNode $jsonExpected) { - $jsonExpectedDecoded = json_decode($jsonExpected->getRaw(), true); - $jsonRespondedEncoded = json_encode(json_decode($this->response->getBody(), true)); + $jsonExpectedDecoded = \json_decode($jsonExpected->getRaw(), true); + $jsonRespondedEncoded + = \json_encode(\json_decode($this->response->getBody(), true)); if ($this->runOcc(['status']) === 0) { - $output = explode("- ", $this->lastStdOut); - $version = explode(": ", $output[2]); - PHPUnit_Framework_Assert::assertEquals("version", $version[0]); - $versionString = explode(": ", $output[3]); - PHPUnit_Framework_Assert::assertEquals("versionstring", $versionString[0]); - $jsonExpectedDecoded['version'] = trim($version[1]); - $jsonExpectedDecoded['versionstring'] = trim($versionString[1]); - $jsonExpectedEncoded = json_encode($jsonExpectedDecoded); + $output = \explode("- ", $this->lastStdOut); + $version = \explode(": ", $output[2]); + PHPUnit_Framework_Assert::assertEquals( + "version", $version[0] + ); + $versionString = \explode(": ", $output[3]); + PHPUnit_Framework_Assert::assertEquals( + "versionstring", $versionString[0] + ); + $jsonExpectedDecoded['version'] = \trim($version[1]); + $jsonExpectedDecoded['versionstring'] = \trim($versionString[1]); + $jsonExpectedEncoded = \json_encode($jsonExpectedDecoded); } else { PHPUnit_Framework_Assert::fail('Cannot get version variables from occ'); } - PHPUnit\Framework\Assert::assertEquals($jsonExpectedEncoded, $jsonRespondedEncoded); + PHPUnit\Framework\Assert::assertEquals( + $jsonExpectedEncoded, $jsonRespondedEncoded + ); } /** @@ -1009,10 +1018,14 @@ public function substituteInLineCodes($value) { */ public static function removeFilesFromLocalStorageBefore() { $dir = "./work/local_storage/"; - $di = new RecursiveDirectoryIterator($dir, FilesystemIterator::SKIP_DOTS); - $ri = new RecursiveIteratorIterator($di, RecursiveIteratorIterator::CHILD_FIRST); - foreach ( $ri as $file ) { - $file->isDir() ? rmdir($file) : unlink($file); + $di = new RecursiveDirectoryIterator( + $dir, FilesystemIterator::SKIP_DOTS + ); + $ri = new RecursiveIteratorIterator( + $di, RecursiveIteratorIterator::CHILD_FIRST + ); + foreach ($ri as $file) { + $file->isDir() ? \rmdir($file) : \unlink($file); } } @@ -1023,10 +1036,14 @@ public static function removeFilesFromLocalStorageBefore() { */ public static function removeFilesFromLocalStorageAfter() { $dir = "./work/local_storage/"; - $di = new RecursiveDirectoryIterator($dir, FilesystemIterator::SKIP_DOTS); - $ri = new RecursiveIteratorIterator($di, RecursiveIteratorIterator::CHILD_FIRST); - foreach ( $ri as $file ) { - $file->isDir() ? rmdir($file) : unlink($file); + $di = new RecursiveDirectoryIterator( + $dir, FilesystemIterator::SKIP_DOTS + ); + $ri = new RecursiveIteratorIterator( + $di, RecursiveIteratorIterator::CHILD_FIRST + ); + foreach ($ri as $file) { + $file->isDir() ? \rmdir($file) : \unlink($file); } } diff --git a/tests/acceptance/features/bootstrap/CalDavContext.php b/tests/acceptance/features/bootstrap/CalDavContext.php index b99d19795330..a0a42351460c 100644 --- a/tests/acceptance/features/bootstrap/CalDavContext.php +++ b/tests/acceptance/features/bootstrap/CalDavContext.php @@ -70,7 +70,8 @@ public function setUpScenario(BeforeScenarioScope $scope) { * @return void */ public function afterScenario() { - $davUrl = $this->featureContext->getBaseUrl() . '/remote.php/dav/calendars/admin/MyCalendar'; + $davUrl = $this->featureContext->getBaseUrl() + . '/remote.php/dav/calendars/admin/MyCalendar'; try { $this->client->delete( $davUrl, @@ -91,7 +92,8 @@ public function afterScenario() { * @return void */ public function userRequestsCalendarUsingTheAPI($user, $calendar) { - $davUrl = $this->featureContext->getBaseUrl() . '/remote.php/dav/calendars/' . $calendar; + $davUrl = $this->featureContext->getBaseUrl() + . '/remote.php/dav/calendars/' . $calendar; try { $this->response = $this->client->get( @@ -185,7 +187,8 @@ public function theCalDavErrorMessageShouldBe($message) { * @return void */ public function userHasCreatedACalendarNamed($user, $name) { - $davUrl = $this->featureContext->getBaseUrl() . '/remote.php/dav/calendars/' . $user . '/' . $name; + $davUrl = $this->featureContext->getBaseUrl() + . '/remote.php/dav/calendars/' . $user . '/' . $name; $request = $this->client->createRequest( 'MKCALENDAR', diff --git a/tests/acceptance/features/bootstrap/CapabilitiesContext.php b/tests/acceptance/features/bootstrap/CapabilitiesContext.php index 86731c43331b..0b209f74dd60 100644 --- a/tests/acceptance/features/bootstrap/CapabilitiesContext.php +++ b/tests/acceptance/features/bootstrap/CapabilitiesContext.php @@ -83,23 +83,29 @@ protected function resetAppConfigs() { ], [ 'capabilitiesApp' => 'files_sharing', - 'capabilitiesParameter' => 'public@@@password@@@enforced_for@@@read_only', + 'capabilitiesParameter' => + 'public@@@password@@@enforced_for@@@read_only', 'testingApp' => 'core', - 'testingParameter' => 'shareapi_enforce_links_password_read_only', + 'testingParameter' => + 'shareapi_enforce_links_password_read_only', 'testingState' => false ], [ 'capabilitiesApp' => 'files_sharing', - 'capabilitiesParameter' => 'public@@@password@@@enforced_for@@@read_write', + 'capabilitiesParameter' => + 'public@@@password@@@enforced_for@@@read_write', 'testingApp' => 'core', - 'testingParameter' => 'shareapi_enforce_links_password_read_write', + 'testingParameter' => + 'shareapi_enforce_links_password_read_write', 'testingState' => false ], [ 'capabilitiesApp' => 'files_sharing', - 'capabilitiesParameter' => 'public@@@password@@@enforced_for@@@upload_only', + 'capabilitiesParameter' => + 'public@@@password@@@enforced_for@@@upload_only', 'testingApp' => 'core', - 'testingParameter' => 'shareapi_enforce_links_password_write_only', + 'testingParameter' => + 'shareapi_enforce_links_password_write_only', 'testingState' => false ], [ diff --git a/tests/acceptance/features/bootstrap/CardDavContext.php b/tests/acceptance/features/bootstrap/CardDavContext.php index 9e62c76542b1..74ca741bb05f 100644 --- a/tests/acceptance/features/bootstrap/CardDavContext.php +++ b/tests/acceptance/features/bootstrap/CardDavContext.php @@ -70,7 +70,8 @@ public function setUpScenario(BeforeScenarioScope $scope) { * @return void */ public function afterScenario() { - $davUrl = $this->featureContext->getBaseUrl() . '/remote.php/dav/addressbooks/users/admin/MyAddressbook'; + $davUrl = $this->featureContext->getBaseUrl() + . '/remote.php/dav/addressbooks/users/admin/MyAddressbook'; try { $this->client->delete( $davUrl, @@ -92,7 +93,8 @@ public function afterScenario() { * @throws \Exception */ public function userRequestsAddressbookUsingTheAPI($user, $addressBook) { - $davUrl = $this->featureContext->getBaseUrl() . '/remote.php/dav/addressbooks/users/' . $addressBook; + $davUrl = $this->featureContext->getBaseUrl() + . '/remote.php/dav/addressbooks/users/' . $addressBook; try { $this->response = $this->client->get( @@ -116,7 +118,8 @@ public function userRequestsAddressbookUsingTheAPI($user, $addressBook) { * @throws \Exception */ public function userHasCreatedAnAddressbookNamed($user, $addressBook) { - $davUrl = $this->featureContext->getBaseUrl() . '/remote.php/dav/addressbooks/users/' . $user . '/' . $addressBook; + $davUrl = $this->featureContext->getBaseUrl() + . '/remote.php/dav/addressbooks/users/' . $user . '/' . $addressBook; $request = $this->client->createRequest( 'MKCOL', diff --git a/tests/acceptance/features/bootstrap/Checksums.php b/tests/acceptance/features/bootstrap/Checksums.php index 07070a5d343e..3c1d437adc5a 100644 --- a/tests/acceptance/features/bootstrap/Checksums.php +++ b/tests/acceptance/features/bootstrap/Checksums.php @@ -131,7 +131,8 @@ public function theWebdavChecksumShouldMatch($checksum) { public function theHeaderChecksumShouldMatch($checksum) { if ($this->response->getHeader('OC-Checksum') !== $checksum) { throw new \Exception( - "Expected $checksum, got " . $this->response->getHeader('OC-Checksum') + "Expected $checksum, got " + . $this->response->getHeader('OC-Checksum') ); } } @@ -166,7 +167,8 @@ public function theWebdavChecksumShouldBeEmpty() { public function theOcChecksumHeaderShouldNotBeThere() { if ($this->response->hasHeader('OC-Checksum')) { throw new \Exception( - "Expected no checksum header but got " . $this->response->getHeader('OC-Checksum') + "Expected no checksum header but got " + . $this->response->getHeader('OC-Checksum') ); } } diff --git a/tests/acceptance/features/bootstrap/CommandLine.php b/tests/acceptance/features/bootstrap/CommandLine.php index 4f2943c64161..63be471ce184 100644 --- a/tests/acceptance/features/bootstrap/CommandLine.php +++ b/tests/acceptance/features/bootstrap/CommandLine.php @@ -134,13 +134,15 @@ public function findLines($input, $text) { public function theCommandShouldHaveBeenSuccessful() { $exceptions = $this->findExceptions(); if ($this->lastCode !== 0) { - $msg = 'The command was not successful, exit code was ' . $this->lastCode . '.'; + $msg = 'The command was not successful, exit code was ' + . $this->lastCode . '.'; if (!empty($exceptions)) { $msg .= ' Exceptions: ' . implode(', ', $exceptions); } throw new \Exception($msg); - } else if (!empty($exceptions)) { - $msg = 'The command was successful but triggered exceptions: ' . implode(', ', $exceptions); + } elseif (!empty($exceptions)) { + $msg = 'The command was successful but triggered exceptions: ' + . \implode(', ', $exceptions); throw new \Exception($msg); } } @@ -156,7 +158,8 @@ public function theCommandShouldHaveBeenSuccessful() { public function theCommandFailedWithExitCode($exitCode) { if ($this->lastCode !== (int)$exitCode) { throw new \Exception( - 'The command was expected to fail with exit code ' . $exitCode . ' but got ' . $this->lastCode + 'The command was expected to fail with exit code ' + . $exitCode . ' but got ' . $this->lastCode ); } } @@ -177,7 +180,8 @@ public function theCommandFailedWithExceptionText($exceptionText) { if (!in_array($exceptionText, $exceptions)) { throw new \Exception( - 'The command did not throw any exception with the text "' . $exceptionText . '"' + 'The command did not throw any exception with the text "' + . $exceptionText . '"' ); } } @@ -194,7 +198,8 @@ public function theCommandOutputContainsTheText($text) { $lines = $this->findLines($this->lastStdOut, $text); if (empty($lines)) { throw new \Exception( - 'The command did not output the expected text on stdout "' . $text . '"' + 'The command did not output the expected text on stdout "' + . $text . '"' ); } } @@ -211,7 +216,8 @@ public function theCommandErrorOutputContainsTheText($text) { $lines = $this->findLines($this->lastStdErr, $text); if (empty($lines)) { throw new \Exception( - 'The command did not output the expected text on stderr "' . $text . '"' + 'The command did not output the expected text on stderr "' + . $text . '"' ); } } @@ -270,7 +276,8 @@ private function findLastTransferFolderForUser($sourceUser, $targetUser) { */ public function transferringOwnership($user1, $user2) { if ($this->runOcc(['files:transfer-ownership', $user1, $user2]) === 0) { - $this->lastTransferPath = $this->findLastTransferFolderForUser($user1, $user2); + $this->lastTransferPath + = $this->findLastTransferFolderForUser($user1, $user2); } else { // failure $this->lastTransferPath = null; @@ -301,7 +308,8 @@ public function recreateMasterKeyUsingOccCommand() { public function transferringOwnershipPath($path, $user1, $user2) { $path = '--path=' . $path; if ($this->runOcc(['files:transfer-ownership', $path, $user1, $user2]) === 0) { - $this->lastTransferPath = $this->findLastTransferFolderForUser($user1, $user2); + $this->lastTransferPath + = $this->findLastTransferFolderForUser($user1, $user2); } else { // failure $this->lastTransferPath = null; diff --git a/tests/acceptance/features/bootstrap/Comments.php b/tests/acceptance/features/bootstrap/Comments.php index e20f08c964f2..3ab1c228c269 100644 --- a/tests/acceptance/features/bootstrap/Comments.php +++ b/tests/acceptance/features/bootstrap/Comments.php @@ -59,21 +59,22 @@ public function userCommentsWithContentOnEntry($user, $content, $type, $path) { $user, "POST", $commentsPath, - ['Content-Type' => 'application/json', - ], + ['Content-Type' => 'application/json'], null, "uploads", '{"actorId":"user0", - "actorDisplayName":"user0", - "actorType":"users", - "verb":"comment", - "message":"' . $content . '", - "creationDateTime":"Thu, 18 Feb 2016 17:04:18 GMT", - "objectType":"files"}' + "actorDisplayName":"user0", + "actorType":"users", + "verb":"comment", + "message":"' . $content . '", + "creationDateTime":"Thu, 18 Feb 2016 17:04:18 GMT", + "objectType":"files"}' ); $responseHeaders = $this->response->getHeaders(); $commentUrl = $responseHeaders['Content-Location'][0]; - $this->lastCommentId = substr($commentUrl, strrpos($commentUrl, '/') + 1); + $this->lastCommentId = \substr( + $commentUrl, \strrpos($commentUrl, '/') + 1 + ); } catch (BadResponseException $ex) { $this->response = $ex->getResponse(); } @@ -250,13 +251,13 @@ public function editAComment($user, $content, $fileId, $commentId) { null, "uploads", ' - - - - ' . htmlspecialchars($content, ENT_XML1, 'UTF-8') . ' - - - ' + + + + ' . \htmlspecialchars($content, ENT_XML1, 'UTF-8') . ' + + + ' ); } catch (BadResponseException $ex) { $this->response = $ex->getResponse(); diff --git a/tests/acceptance/features/bootstrap/FederationContext.php b/tests/acceptance/features/bootstrap/FederationContext.php index 7be9c096da7c..404b9fa68e73 100644 --- a/tests/acceptance/features/bootstrap/FederationContext.php +++ b/tests/acceptance/features/bootstrap/FederationContext.php @@ -56,22 +56,24 @@ public function federateSharing( $sharerUser, $sharerServer, $sharerPath, $shareeUser, $shareeServer ) { if ($shareeServer == "REMOTE") { - $shareWith = "$shareeUser@" . $this->featureContext->getRemoteBaseUrl() . '/'; + $shareWith + = "$shareeUser@" . $this->featureContext->getRemoteBaseUrl() . '/'; } else { - $shareWith = "$shareeUser@" . $this->featureContext->getLocalBaseUrl() . '/'; + $shareWith + = "$shareeUser@" . $this->featureContext->getLocalBaseUrl() . '/'; } - $previous = $this->featureContext->usingServer($sharerServer); - $this->featureContext->createShare( - $sharerUser, $sharerPath, 6, $shareWith, null, null, null - ); - $this->featureContext->theHTTPStatusCodeShouldBe('200'); - $this->featureContext->theOCSStatusCodeShouldBe( - '100', 'Could not share file/folder! message: "' . + $previous = $this->featureContext->usingServer($sharerServer); + $this->featureContext->createShare( + $sharerUser, $sharerPath, 6, $shareWith, null, null, null + ); + $this->featureContext->theHTTPStatusCodeShouldBe('200'); + $this->featureContext->theOCSStatusCodeShouldBe( + '100', 'Could not share file/folder! message: "' . $this->featureContext->getOCSResponseStatusMessage( $this->featureContext->getResponse() ) . '"' - ); - $this->featureContext->usingServer($previous); + ); + $this->featureContext->usingServer($previous); } /** diff --git a/tests/acceptance/features/bootstrap/Provisioning.php b/tests/acceptance/features/bootstrap/Provisioning.php index e21542e81d5d..1828ee09fe37 100644 --- a/tests/acceptance/features/bootstrap/Provisioning.php +++ b/tests/acceptance/features/bootstrap/Provisioning.php @@ -244,7 +244,8 @@ public function theseUsersHaveBeenCreated($doNotInitialize, TableNode $table) { */ public function theAppHasBeenDisabled($app) { $client = new Client(); - $fullUrl = $this->getBaseUrl() . "/ocs/v{$this->apiVersion}.php/cloud/apps/" . $app; + $fullUrl = $this->getBaseUrl() + . "/ocs/v{$this->apiVersion}.php/cloud/apps/" . $app; $options = []; $options['auth'] = $this->getAuthOptionForAdmin(); $this->client->delete($fullUrl, $options); @@ -448,7 +449,8 @@ public function theseUsersHaveBeenInitialized(TableNode $table) { * @return void */ public function initializeUser($user, $password) { - $url = $this->getBaseUrl() . "/ocs/v{$this->apiVersion}.php/cloud/users/" . $user; + $url = $this->getBaseUrl() + . "/ocs/v{$this->apiVersion}.php/cloud/users/" . $user; $client = new Client(); $options = [ 'auth' => [$user, $password], @@ -923,7 +925,8 @@ private function createTheGroup($group, $method = null) { * @return void */ public function adminDisablesUserUsingTheAPI($user) { - $fullUrl = $this->getBaseUrl() . "/ocs/v{$this->apiVersion}.php/cloud/users/$user/disable"; + $fullUrl = $this->getBaseUrl() + . "/ocs/v{$this->apiVersion}.php/cloud/users/$user/disable"; $client = new Client(); $options = []; $options['auth'] = $this->getAuthOptionForAdmin(); @@ -952,8 +955,10 @@ public function deleteTheUserUsingTheAPI($user) { // successfully created (i.e. the delete is expected to work) and // there was a problem deleting the user. Because in this case there // might be an effect on later tests. - if ($this->theUserShouldExist($user) && ($this->response->getStatusCode() !== 200)) { - error_log( + if ($this->theUserShouldExist($user) + && ($this->response->getStatusCode() !== 200) + ) { + \error_log( "INFORMATION: could not delete user '" . $user . "' " . $this->response->getStatusCode() . " " . $this->response->getBody() ); @@ -1085,7 +1090,8 @@ public function userShouldBeSubadminOfGroup($user, $group) { * @return void */ public function adminMakesUserSubadminOfGroupUsingTheAPI($user, $group) { - $fullUrl = $this->getBaseUrl() . "/ocs/v{$this->apiVersion}.php/cloud/users/$user/subadmins"; + $fullUrl = $this->getBaseUrl() + . "/ocs/v{$this->apiVersion}.php/cloud/users/$user/subadmins"; $client = new Client(); $options = []; $options['auth'] = $this->getAuthOptionForAdmin(); @@ -1311,7 +1317,8 @@ public function theDisplayNameReturnedByTheApiShouldBe($displayname) { */ public function getArrayOfUsersResponded($resp) { $listCheckedElements = $resp->xml()->data[0]->users[0]->element; - $extractedElementsArray = json_decode(json_encode($listCheckedElements), 1); + $extractedElementsArray + = \json_decode(\json_encode($listCheckedElements), 1); return $extractedElementsArray; } @@ -1324,7 +1331,8 @@ public function getArrayOfUsersResponded($resp) { */ public function getArrayOfGroupsResponded($resp) { $listCheckedElements = $resp->xml()->data[0]->groups[0]->element; - $extractedElementsArray = json_decode(json_encode($listCheckedElements), 1); + $extractedElementsArray + = \json_decode(\json_encode($listCheckedElements), 1); return $extractedElementsArray; } @@ -1337,7 +1345,8 @@ public function getArrayOfGroupsResponded($resp) { */ public function getArrayOfAppsResponded($resp) { $listCheckedElements = $resp->xml()->data[0]->apps[0]->element; - $extractedElementsArray = json_decode(json_encode($listCheckedElements), 1); + $extractedElementsArray + = \json_decode(\json_encode($listCheckedElements), 1); return $extractedElementsArray; } @@ -1350,7 +1359,8 @@ public function getArrayOfAppsResponded($resp) { */ public function getArrayOfSubadminsResponded($resp) { $listCheckedElements = $resp->xml()->data[0]->element; - $extractedElementsArray = json_decode(json_encode($listCheckedElements), 1); + $extractedElementsArray + = \json_decode(\json_encode($listCheckedElements), 1); return $extractedElementsArray; } @@ -1404,7 +1414,8 @@ public function appShouldBeEnabled($app) { * @return void */ public function userShouldBeDisabled($user) { - $fullUrl = $this->getBaseUrl() . "/ocs/v{$this->apiVersion}.php/cloud/users/$user"; + $fullUrl = $this->getBaseUrl() + . "/ocs/v{$this->apiVersion}.php/cloud/users/$user"; $client = new Client(); $options = []; $options['auth'] = $this->getAuthOptionForAdmin(); @@ -1423,7 +1434,8 @@ public function userShouldBeDisabled($user) { * @return void */ public function useShouldBeEnabled($user) { - $fullUrl = $this->getBaseUrl() . "/ocs/v{$this->apiVersion}.php/cloud/users/$user"; + $fullUrl = $this->getBaseUrl() + . "/ocs/v{$this->apiVersion}.php/cloud/users/$user"; $client = new Client(); $options = []; $options['auth'] = $this->getAuthOptionForAdmin(); @@ -1485,7 +1497,8 @@ public function adminGivesUnlimitedQuotaToUserUsingTheAPI($user) { * @return void */ public function getUserHome($user) { - $fullUrl = $this->getBaseUrl() . "/ocs/v{$this->apiVersion}.php/cloud/users/$user"; + $fullUrl = $this->getBaseUrl() + . "/ocs/v{$this->apiVersion}.php/cloud/users/$user"; $client = new Client(); $options = []; $options['auth'] = $this->getAuthOptionForAdmin(); @@ -1539,7 +1552,10 @@ public function checkAttributesForUser($user, $body) { */ public function theApiShouldNotReturnAnyData() { $responseData = $this->response->xml()->data[0]; - PHPUnit_Framework_Assert::assertEmpty($responseData, "Response data is not empty but it should be empty"); + PHPUnit_Framework_Assert::assertEmpty( + $responseData, + "Response data is not empty but it should be empty" + ); } /** @@ -1549,7 +1565,10 @@ public function theApiShouldNotReturnAnyData() { */ public function theListOfUsersReturnedByTheApiShouldBeEmpty() { $usersList = $this->response->xml()->data[0]->users[0]; - PHPUnit_Framework_Assert::assertEmpty($usersList, "Users list is not empty but it should be empty"); + PHPUnit_Framework_Assert::assertEmpty( + $usersList, + "Users list is not empty but it should be empty" + ); } /** diff --git a/tests/acceptance/features/bootstrap/Sharing.php b/tests/acceptance/features/bootstrap/Sharing.php index 113619a2cb98..98dcd5a9af31 100644 --- a/tests/acceptance/features/bootstrap/Sharing.php +++ b/tests/acceptance/features/bootstrap/Sharing.php @@ -84,7 +84,8 @@ public function getLastShareTime() { * @return void */ public function userCreatesAShareWithSettings($user, $body) { - $fullUrl = $this->getBaseUrl() . "/ocs/v{$this->apiVersion}.php/apps/files_sharing/api/v{$this->sharingApiVersion}/shares"; + $fullUrl = $this->getBaseUrl() + . "/ocs/v{$this->apiVersion}.php/apps/files_sharing/api/v{$this->sharingApiVersion}/shares"; $client = new Client(); $options = []; $options['auth'] = $this->getAuthOptionForUser($user); @@ -143,7 +144,11 @@ public function theUserHasCreatedAShareWithSettings($body) { * @return void */ public function createAPublicShare( - $user, $path, $publicUpload = false, $sharePassword = null, $permissions = null + $user, + $path, + $publicUpload = false, + $sharePassword = null, + $permissions = null ) { $this->response = SharingHelper::createShare( $this->getBaseUrl(), @@ -228,7 +233,8 @@ public function aPublicShareOfIsCreatedWithPermission($path, $permissions) { */ public function publicSharedFileCannotBeDownloaded($path) { $token = $this->getLastShareToken(); - $fullUrl = $this->getBaseUrl() . "/public.php/webdav/" . rawurlencode(ltrim($path, '/')); + $fullUrl = $this->getBaseUrl() + . "/public.php/webdav/" . \rawurlencode(\ltrim($path, '/')); $client = new Client(); $options = []; @@ -444,7 +450,11 @@ public function publiclyUploadingShouldNotWork() { * @return void */ private function publicUploadContent( - $filename, $password = '', $body = 'test', $autorename = false, $overwriting = false + $filename, + $password = '', + $body = 'test', + $autorename = false, + $overwriting = false ) { $url = $this->getBaseUrl() . "/public.php/webdav/"; $url .= rawurlencode(ltrim($filename, '/')); @@ -481,7 +491,8 @@ private function publicUploadContent( */ public function theUserAddsExpirationDateToLastShare() { $share_id = (string) $this->lastShareData->data[0]->id; - $fullUrl = $this->getBaseUrl() . "/ocs/v{$this->apiVersion}.php/apps/files_sharing/api/v{$this->sharingApiVersion}/shares/$share_id"; + $fullUrl = $this->getBaseUrl() + . "/ocs/v{$this->apiVersion}.php/apps/files_sharing/api/v{$this->sharingApiVersion}/shares/$share_id"; $client = new Client(); $options = []; $options['auth'] = $this->getAuthOptionForUser($this->currentUser); @@ -519,7 +530,8 @@ public function theUserUpdatesTheLastShareWith($body) { */ public function userUpdatesTheLastShareWith($user, $body) { $share_id = (string) $this->lastShareData->data[0]->id; - $fullUrl = $this->getBaseUrl() . "/ocs/v{$this->apiVersion}.php/apps/files_sharing/api/v{$this->sharingApiVersion}/shares/$share_id"; + $fullUrl = $this->getBaseUrl() + . "/ocs/v{$this->apiVersion}.php/apps/files_sharing/api/v{$this->sharingApiVersion}/shares/$share_id"; $client = new Client(); $options = []; $options['auth'] = $this->getAuthOptionForUser($user); @@ -600,7 +612,8 @@ public function createShare( public function isFieldInResponse($field, $contentExpected) { $data = $this->response->xml()->data[0]; if ((string)$field == 'expiration') { - $contentExpected = date('Y-m-d', strtotime($contentExpected)) . " 00:00:00"; + $contentExpected + = \date('Y-m-d', \strtotime($contentExpected)) . " 00:00:00"; } if (count($data->element) > 0) { foreach ($data as $element) { @@ -754,7 +767,8 @@ public function isUserOrGroupInSharedData($userOrGroup, $permissions = null) { public function userSharesFileWithUserUsingTheAPI( $user1, $entry, $filepath, $user2, $withPerms = null, $permissions = null ) { - $fullUrl = $this->getBaseUrl() . "/ocs/v{$this->apiVersion}.php/apps/files_sharing/api/v{$this->sharingApiVersion}/shares" . "?path=$filepath"; + $fullUrl = $this->getBaseUrl() + . "/ocs/v{$this->apiVersion}.php/apps/files_sharing/api/v{$this->sharingApiVersion}/shares" . "?path=$filepath"; $client = new Client(); $options = []; $options['auth'] = $this->getAuthOptionForUser($user1); @@ -817,7 +831,8 @@ public function theUserSharesFileWithGroupUsingTheAPI( public function userSharesFileWithGroupUsingTheAPI( $user, $entry, $filepath, $group, $withPerms = null, $permissions = null ) { - $fullUrl = $this->getBaseUrl() . "/ocs/v{$this->apiVersion}.php/apps/files_sharing/api/v{$this->sharingApiVersion}/shares" . "?path=$filepath"; + $fullUrl = $this->getBaseUrl() + . "/ocs/v{$this->apiVersion}.php/apps/files_sharing/api/v{$this->sharingApiVersion}/shares" . "?path=$filepath"; $client = new Client(); $options = []; $options['auth'] = $this->getAuthOptionForUser($user); @@ -857,7 +872,9 @@ public function theUserDeletesLastShareUsingTheAPI() { public function userDeletesLastShareUsingTheAPI($user) { $share_id = $this->lastShareData->data[0]->id; $url = "/apps/files_sharing/api/v{$this->sharingApiVersion}/shares/$share_id"; - $this->userSendsHTTPMethodToAPIEndpointWithBody($user, "DELETE", $url, null); + $this->userSendsHTTPMethodToAPIEndpointWithBody( + $user, "DELETE", $url, null + ); } /** @@ -879,7 +896,9 @@ public function theUserGetsInfoOfLastShareUsingTheAPI() { public function userGetsInfoOfLastShareUsingTheAPI($user) { $share_id = $this->lastShareData->data[0]->id; $url = "/apps/files_sharing/api/v{$this->sharingApiVersion}/shares/$share_id"; - $this->userSendsHTTPMethodToAPIEndpointWithBody($user, "GET", $url, null); + $this->userSendsHTTPMethodToAPIEndpointWithBody( + $user, "GET", $url, null + ); } /** @@ -978,7 +997,8 @@ public function checkShareFields($body) { * @return void */ public function userRemovesAllSharesFromTheFileNamed($user, $fileName) { - $url = $this->getBaseUrl() . "/ocs/v{$this->apiVersion}.php/apps/files_sharing/api/v{$this->sharingApiVersion}/shares?format=json"; + $url = $this->getBaseUrl() + . "/ocs/v{$this->apiVersion}.php/apps/files_sharing/api/v{$this->sharingApiVersion}/shares?format=json"; $client = new \GuzzleHttp\Client(); $res = $client->get( $url, @@ -995,7 +1015,8 @@ public function userRemovesAllSharesFromTheFileNamed($user, $fileName) { if (stripslashes($data['path']) === $fileName) { $id = $data['id']; $client->delete( - $this->getBaseUrl() . "/ocs/v{$this->apiVersion}.php/apps/files_sharing/api/v{$this->sharingApiVersion}/shares/{$id}", + $this->getBaseUrl() + . "/ocs/v{$this->apiVersion}.php/apps/files_sharing/api/v{$this->sharingApiVersion}/shares/{$id}", [ 'auth' => $this->getAuthOptionForUser($user), 'headers' => [ @@ -1043,7 +1064,8 @@ public function shareIdsShouldMatch() { * @return array */ public function getShares($user, $path) { - $fullUrl = $this->getBaseUrl() . "/ocs/v{$this->apiVersion}.php/apps/files_sharing/api/v{$this->sharingApiVersion}/shares"; + $fullUrl = $this->getBaseUrl() + . "/ocs/v{$this->apiVersion}.php/apps/files_sharing/api/v{$this->sharingApiVersion}/shares"; $fullUrl = $fullUrl . '?path=' . $path; $client = new Client(); @@ -1199,16 +1221,20 @@ protected function getCommonSharingConfigs() { ], [ 'capabilitiesApp' => 'files_sharing', - 'capabilitiesParameter' => 'user_enumeration@@@enabled', + 'capabilitiesParameter' => + 'user_enumeration@@@enabled', 'testingApp' => 'core', - 'testingParameter' => 'shareapi_allow_share_dialog_user_enumeration', + 'testingParameter' => + 'shareapi_allow_share_dialog_user_enumeration', 'testingState' => true ], [ 'capabilitiesApp' => 'files_sharing', - 'capabilitiesParameter' => 'user_enumeration@@@group_members_only', + 'capabilitiesParameter' => + 'user_enumeration@@@group_members_only', 'testingApp' => 'core', - 'testingParameter' => 'shareapi_share_dialog_user_enumeration_group_members', + 'testingParameter' => + 'shareapi_share_dialog_user_enumeration_group_members', 'testingState' => false ], ]; diff --git a/tests/acceptance/features/bootstrap/Tags.php b/tests/acceptance/features/bootstrap/Tags.php index 146519400ee9..ae44f9b0d216 100644 --- a/tests/acceptance/features/bootstrap/Tags.php +++ b/tests/acceptance/features/bootstrap/Tags.php @@ -79,9 +79,9 @@ private function assertTypeOfTag($tagData, $type) { if (($tagData['{http://owncloud.org/ns}user-visible'] !== $userVisible) || ($tagData['{http://owncloud.org/ns}user-assignable'] !== $userAssignable) ) { - PHPUnit_Framework_Assert::fail( - "tag $tagDisplayName is not of type $type" - ); + PHPUnit_Framework_Assert::fail( + "tag $tagDisplayName is not of type $type" + ); } } @@ -249,8 +249,11 @@ public function theTagHasGroup($type, $tagName, $groups) { ); $this->assertTypeOfTag($tagData, $type); PHPUnit_Framework_Assert::assertEquals( - $tagData['{http://owncloud.org/ns}groups'], $groups, - 'Tag has groups "' . $tagData['{http://owncloud.org/ns}groups'] . '" instead of the expected "' . $groups . '"' + $tagData['{http://owncloud.org/ns}groups'], + $groups, + 'Tag has groups "' + . $tagData['{http://owncloud.org/ns}groups'] + . '" instead of the expected "' . $groups . '"' ); } @@ -266,7 +269,8 @@ public function theTagHasGroup($type, $tagName, $groups) { public function tagsShouldExistFor($count, $user) { if ((int)$count !== count($this->requestTagsForUser($user))) { throw new \Exception( - "Expected $count tags, got " . count($this->requestTagsForUser($user)) + "Expected $count tags, got " + . \count($this->requestTagsForUser($user)) ); } } @@ -296,7 +300,8 @@ private function sendProppatchToSystemtags( $appPath = '/systemtags/'; $tagID = $this->findTagIdByName($tagDisplayName); PHPUnit_Framework_Assert::assertNotNull($tagID, "Tag wasn't found"); - $fullUrl = $this->getBaseUrl() . '/' . $this->getDavPath('systemtags') . $appPath . $tagID; + $fullUrl = $this->getBaseUrl() + . '/' . $this->getDavPath('systemtags') . $appPath . $tagID; try { $response = $client->proppatch($fullUrl, $properties, 1); $this->response = $response; @@ -383,7 +388,10 @@ private function tag($taggingUser, $tagName, $fileName, $fileOwner) { $this->getBaseUrl(), $taggingUser, $this->getPasswordForUser($taggingUser), - $tagName, $fileName, $fileOwner, $this->getDavPathVersion('systemtags') + $tagName, + $fileName, + $fileOwner, + $this->getDavPathVersion('systemtags') ); } catch ( BadResponseException $e ) { $this->response = $e->getResponse(); @@ -412,7 +420,8 @@ private function requestTagsForFile($user, $fileName, $sharingUser = null) { '{http://owncloud.org/ns}can-assign' ]; $appPath = '/systemtags-relations/files/'; - $fullUrl = $this->getBaseUrl() . '/' . $this->getDavPath('systemtags') . $appPath . $fileID; + $fullUrl = $this->getBaseUrl() + . '/' . $this->getDavPath('systemtags') . $appPath . $fileID; try { $response = $client->propfind($fullUrl, $properties, 1); } catch (Sabre\HTTP\ClientHttpException $e) { @@ -471,9 +480,9 @@ public function sharedByHasTheFollowingTags( } } if ($found === false) { - PHPUnit_Framework_Assert::fail( - "tag $rowDisplayName is not in propfind answer" - ); + PHPUnit_Framework_Assert::fail( + "tag $rowDisplayName is not in propfind answer" + ); } } return $found; diff --git a/tests/acceptance/features/bootstrap/WebDav.php b/tests/acceptance/features/bootstrap/WebDav.php index 955d8fa29284..97d36d690720 100644 --- a/tests/acceptance/features/bootstrap/WebDav.php +++ b/tests/acceptance/features/bootstrap/WebDav.php @@ -217,10 +217,14 @@ public function makeDavRequest( * * @return void */ - public function userHasMovedFile($user, $entry, $fileSource, $fileDestination) { + public function userHasMovedFile( + $user, $entry, $fileSource, $fileDestination + ) { $fullUrl = $this->getBaseUrl() . '/' . $this->getDavFilesPath($user); $headers['Destination'] = $fullUrl . $fileDestination; - $this->response = $this->makeDavRequest($user, "MOVE", $fileSource, $headers); + $this->response = $this->makeDavRequest( + $user, "MOVE", $fileSource, $headers + ); PHPUnit_Framework_Assert::assertEquals( 201, $this->response->getStatusCode() ); @@ -260,7 +264,9 @@ public function userMovesFileUsingTheAPI( * * @return void */ - public function userCopiesFileUsingTheAPI($user, $fileSource, $fileDestination) { + public function userCopiesFileUsingTheAPI( + $user, $fileSource, $fileDestination + ) { $fullUrl = $this->getBaseUrl() . '/' . $this->getDavFilesPath($user); $headers['Destination'] = $fullUrl . $fileDestination; try { @@ -281,7 +287,9 @@ public function userCopiesFileUsingTheAPI($user, $fileSource, $fileDestination) * @return void */ public function downloadFileWithRange($fileSource, $range) { - $this->userDownloadsFileWithRange($this->currentUser, $fileSource, $range); + $this->userDownloadsFileWithRange( + $this->currentUser, $fileSource, $range + ); } /** @@ -295,7 +303,9 @@ public function downloadFileWithRange($fileSource, $range) { */ public function userDownloadsFileWithRange($user, $fileSource, $range) { $headers['Range'] = $range; - $this->response = $this->makeDavRequest($user, "GET", $fileSource, $headers); + $this->response = $this->makeDavRequest( + $user, "GET", $fileSource, $headers + ); } /** @@ -380,10 +390,10 @@ public function publicDownloadsTheFileInsideThePublicSharedFolderWithPassword( public function shouldBeAbleToDownloadFileInsidePublicSharedFolderWithPassword( $range, $path, $password, $content ) { - $this->publicDownloadsTheFileInsideThePublicSharedFolderWithPassword( - $path, $password, $range - ); - $this->downloadedContentShouldBe($content); + $this->publicDownloadsTheFileInsideThePublicSharedFolderWithPassword( + $path, $password, $range + ); + $this->downloadedContentShouldBe($content); } /** @@ -453,7 +463,9 @@ public function theUserDownloadsTheFileUsingTheAPI($fileName) { */ public function userDownloadsTheFileUsingTheAPI($user, $fileName) { try { - $this->response = $this->makeDavRequest($user, 'GET', $fileName, []); + $this->response = $this->makeDavRequest( + $user, 'GET', $fileName, [] + ); } catch (BadResponseException $ex) { $this->response = $ex->getResponse(); } @@ -524,7 +536,9 @@ public function userGetsPropertiesOfFolder( $properties[] = $row[0]; } } - $this->response = $this->listFolder($user, $path, 0, $properties); + $this->response = $this->listFolder( + $user, $path, 0, $properties + ); } /** @@ -606,7 +620,9 @@ public function theResponseShouldContainACustomPropertyWithValue( public function asTheFileOrFolderShouldNotExist($user, $entry, $path) { $client = $this->getSabreClient($user); $response = $client->request( - 'HEAD', $this->makeSabrePath($user, '/' . ltrim($path, '/')) + 'HEAD', $this->makeSabrePath( + $user, '/' . \ltrim($path, '/') + ) ); if ($response['statusCode'] !== 404) { throw new \Exception( @@ -944,7 +960,9 @@ public function userShouldSeeTheElements($user, $shouldOrNot, $elements) { * * @return void */ - public function checkElementList($user, $elements, $expectedToBeListed = true) { + public function checkElementList( + $user, $elements, $expectedToBeListed = true + ) { if (!($elements instanceof TableNode)) { throw new InvalidArgumentException( '$expectedElements has to be an instance of TableNode' @@ -1118,7 +1136,9 @@ public function uploadWithAllMechanisms( if (!$overwriteMode) { $suffix = '-' . $dav . 'dav-regular'; } - $this->userUploadsAFileTo($user, $source, $destination . $suffix); + $this->userUploadsAFileTo( + $user, $source, $destination . $suffix + ); $responses[] = $this->response; } catch (BadResponseException $e) { $responses[] = $e->getResponse(); @@ -1224,7 +1244,9 @@ public function userAddsAFileTo($user, $destination, $bytes) { * * @return void */ - public function userUploadsAFileWithContentTo($user, $content, $destination) { + public function userUploadsAFileWithContentTo( + $user, $content, $destination + ) { $file = \GuzzleHttp\Stream\Stream::factory($content); try { $this->response = $this->makeDavRequest( @@ -1382,7 +1404,9 @@ public function userUploadsChunkedFile( public function userCreatesANewChunkingUploadWithId($user, $id) { try { $destination = '/uploads/' . $user . '/' . $id; - $this->makeDavRequest($user, 'MKCOL', $destination, [], null, "uploads"); + $this->makeDavRequest( + $user, 'MKCOL', $destination, [], null, "uploads" + ); } catch (\GuzzleHttp\Exception\RequestException $ex) { $this->response = $ex->getResponse(); } @@ -1403,7 +1427,9 @@ public function userUploadsNewChunkFileOfWithToId($user, $num, $data, $id) { try { $data = \GuzzleHttp\Stream\Stream::factory($data); $destination = '/uploads/' . $user . '/' . $id . '/' . $num; - $this->makeDavRequest($user, 'PUT', $destination, [], $data, "uploads"); + $this->makeDavRequest( + $user, 'PUT', $destination, [], $data, "uploads" + ); } catch (\GuzzleHttp\Exception\RequestException $ex) { $this->response = $ex->getResponse(); } @@ -1419,7 +1445,9 @@ public function userUploadsNewChunkFileOfWithToId($user, $num, $data, $id) { * * @return void */ - public function userMovesNewChunkFileWithIdToMychunkedfile($user, $id, $dest) { + public function userMovesNewChunkFileWithIdToMychunkedfile( + $user, $id, $dest + ) { $this->moveNewDavChunkToFinalFile($user, $id, $dest, []); } @@ -1508,7 +1536,9 @@ private function encodePath($path) { * @return void */ public function userFavoritesElement($user, $path) { - $this->response = $this->changeFavStateOfAnElement($user, $path, 1, 0, null); + $this->response = $this->changeFavStateOfAnElement( + $user, $path, 1, 0, null + ); } /** @@ -1521,7 +1551,9 @@ public function userFavoritesElement($user, $path) { * @return void */ public function userUnfavoritesElement($user, $path) { - $this->response = $this->changeFavStateOfAnElement($user, $path, 0, 0, null); + $this->response = $this->changeFavStateOfAnElement( + $user, $path, 0, 0, null + ); } /** @@ -1568,7 +1600,9 @@ public function changeFavStateOfAnElement( */ public function userStoresEtagOfElement($user, $path) { $propertiesTable = new TableNode([['{DAV:}getetag']]); - $this->userGetsPropertiesOfFolder($user, null, $path, $propertiesTable); + $this->userGetsPropertiesOfFolder( + $user, null, $path, $propertiesTable + ); $pathETAG[$path] = $this->response['{DAV:}getetag']; $this->storedETAG[$user] = $pathETAG; } @@ -1583,7 +1617,9 @@ public function userStoresEtagOfElement($user, $path) { */ public function etagOfElementOfUserShouldNotHaveChanged($path, $user) { $propertiesTable = new TableNode([['{DAV:}getetag']]); - $this->userGetsPropertiesOfFolder($user, null, $path, $propertiesTable); + $this->userGetsPropertiesOfFolder( + $user, null, $path, $propertiesTable + ); PHPUnit_Framework_Assert::assertEquals( $this->response['{DAV:}getetag'], $this->storedETAG[$user][$path] ); @@ -1599,7 +1635,9 @@ public function etagOfElementOfUserShouldNotHaveChanged($path, $user) { */ public function etagOfElementOfUserShouldHaveChanged($path, $user) { $propertiesTable = new TableNode([['{DAV:}getetag']]); - $this->userGetsPropertiesOfFolder($user, null, $path, $propertiesTable); + $this->userGetsPropertiesOfFolder( + $user, null, $path, $propertiesTable + ); PHPUnit_Framework_Assert::assertNotEquals( $this->response['{DAV:}getetag'], $this->storedETAG[$user][$path] ); @@ -1613,7 +1651,9 @@ public function etagOfElementOfUserShouldHaveChanged($path, $user) { */ public function connectingToDavEndpoint() { try { - $this->response = $this->makeDavRequest(null, 'PROPFIND', '', []); + $this->response = $this->makeDavRequest( + null, 'PROPFIND', '', [] + ); } catch (BadResponseException $e) { $this->response = $e->getResponse(); } @@ -1750,6 +1790,8 @@ public function userStoresFileIdForPath($user, $path) { */ public function userFileShouldHaveStoredId($user, $path) { $currentFileID = $this->getFileIdForPath($user, $path); - PHPUnit_Framework_Assert::assertEquals($currentFileID, $this->storedFileID); + PHPUnit_Framework_Assert::assertEquals( + $currentFileID, $this->storedFileID + ); } } diff --git a/tests/acceptance/features/bootstrap/WebUIFilesContext.php b/tests/acceptance/features/bootstrap/WebUIFilesContext.php index 06a724e22ef5..13d70a8af629 100644 --- a/tests/acceptance/features/bootstrap/WebUIFilesContext.php +++ b/tests/acceptance/features/bootstrap/WebUIFilesContext.php @@ -230,7 +230,9 @@ public function theUserBrowsesToTheSharedWithYouPage() { if (!$this->sharedWithYouPage->isOpen()) { $this->sharedWithYouPage->open(); $this->sharedWithYouPage->waitTillPageIsLoaded($this->getSession()); - $this->webUIGeneralContext->setCurrentPageObject($this->sharedWithYouPage); + $this->webUIGeneralContext->setCurrentPageObject( + $this->sharedWithYouPage + ); } } @@ -436,7 +438,9 @@ public function deleteTheFileUsingTheWebUI($name, $expectToDeleteFile = true) { } else { // We do not expect to be able to delete the file, // so do not waste time doing too many retries. - $pageObject->deleteFile($name, $session, $expectToDeleteFile, MINIMUMRETRYCOUNT); + $pageObject->deleteFile( + $name, $session, $expectToDeleteFile, MINIMUMRETRYCOUNT + ); } } @@ -574,7 +578,9 @@ public function theUserMovesTheFollowingFileFolderUsingTheWebUI( $itemToMoveNameParts[] = $namePartsRow['item-to-move-name-parts']; $destinationNameParts[] = $namePartsRow['destination-name-parts']; } - $this->theUserMovesTheFileFolderToUsingTheWebUI($itemToMoveNameParts, $destinationNameParts); + $this->theUserMovesTheFileFolderToUsingTheWebUI( + $itemToMoveNameParts, $destinationNameParts + ); } /** @@ -749,12 +755,16 @@ public function theUserChoosesToInTheUploadDialog($label) { public function theDeletedMovedElementsShouldBeListedOnTheWebUI($shouldOrNot) { if (!is_null($this->deletedElementsTable)) { foreach ($this->deletedElementsTable as $file) { - $this->checkIfFileFolderIsListedOnTheWebUI($file['name'], $shouldOrNot); + $this->checkIfFileFolderIsListedOnTheWebUI( + $file['name'], $shouldOrNot + ); } } if (!is_null($this->movedElementsTable)) { foreach ($this->movedElementsTable as $file) { - $this->checkIfFileFolderIsListedOnTheWebUI($file['name'], $shouldOrNot); + $this->checkIfFileFolderIsListedOnTheWebUI( + $file['name'], $shouldOrNot + ); } } } @@ -782,7 +792,9 @@ public function theDeletedElementsShouldBeListedInTheTrashbinOnTheWebUI() { $this->theUserBrowsesToTheTrashbinPage(); foreach ($this->deletedElementsTable as $file) { - $this->checkIfFileFolderIsListedOnTheWebUI($file['name'], "", "trashbin"); + $this->checkIfFileFolderIsListedOnTheWebUI( + $file['name'], "", "trashbin" + ); } } @@ -873,7 +885,9 @@ public function theUserOpensTheFolderNamedUsingTheWebUI( ) { // The capturing groups of the regex include the quotes at each // end of the captured string, so trim them. - $this->theUserOpensTheFolderUsingTheWebUI($typeOfFilesPage, $fileOrFolder, trim($name, $name[0])); + $this->theUserOpensTheFolderUsingTheWebUI( + $typeOfFilesPage, $fileOrFolder, \trim($name, $name[0]) + ); } /** @@ -996,7 +1010,9 @@ public function checkIfFileFolderIsListedOnTheWebUI( $pageObject = $this->getCurrentPageObject(); $pageObject->waitTillPageIsLoaded($this->getSession()); if ($folder !== "") { - $this->theUserOpensTheFolderUsingTheWebUI($typeOfFilesPage, "folder", $folder); + $this->theUserOpensTheFolderUsingTheWebUI( + $typeOfFilesPage, "folder", $folder + ); } try { @@ -1112,7 +1128,10 @@ public function theFollowingFileFolderShouldBeListedInTheFollowingFolderOnTheWeb * @return void */ public function theFollowingFileFolderShouldBeListedOnTheWebUI( - $shouldOrNot, $typeOfFilesPage, $folder = "", TableNode $namePartsTable = null + $shouldOrNot, + $typeOfFilesPage, + $folder = "", + TableNode $namePartsTable = null ) { $fileNameParts = []; @@ -1121,7 +1140,9 @@ public function theFollowingFileFolderShouldBeListedOnTheWebUI( $fileNameParts[] = $namePartsRow['name-parts']; } } else { - PHPUnit_Framework_Assert::fail('no table of file name parts passed to theFollowingFileFolderShouldBeListed'); + PHPUnit_Framework_Assert::fail( + 'no table of file name parts passed to theFollowingFileFolderShouldBeListed' + ); } // The capturing groups of the regex include the quotes at each @@ -1176,7 +1197,9 @@ public function restoreFileFolderFromTrashbinUsingTheWebUI($fname) { * * @return void */ - public function folderInputFieldTooltipTextShouldBeDisplayedOnTheWebUI($tooltiptext) { + public function folderInputFieldTooltipTextShouldBeDisplayedOnTheWebUI( + $tooltiptext + ) { $createFolderTooltip = $this->filesPage->getCreateFolderTooltip(); PHPUnit_Framework_Assert::assertSame($tooltiptext, $createFolderTooltip); } @@ -1256,7 +1279,9 @@ public function theContentOfShouldBeTheSameAsTheOriginal( $remoteFile = $this->currentFolder . "/" . trim($remoteFile, $remoteFile[0]); $originalFile = getenv("SRC_SKELETON_DIR") . "/" . trim($originalFile, $originalFile[0]); $shouldBeSame = ($shouldOrNot !== "not"); - $this->assertContentOfRemoteAndLocalFileIsSame($remoteFile, $originalFile, $shouldBeSame, $checkOnRemoteServer); + $this->assertContentOfRemoteAndLocalFileIsSame( + $remoteFile, $originalFile, $shouldBeSame, $checkOnRemoteServer + ); } /** @@ -1278,7 +1303,9 @@ public function theContentOfShouldBeTheSameAsTheLocal( $remoteFile = $this->currentFolder . "/" . trim($remoteFile, $remoteFile[0]); $localFile = getenv("FILES_FOR_UPLOAD") . "/" . trim($localFile, $localFile[0]); $shouldBeSame = ($shouldOrNot !== "not"); - $this->assertContentOfRemoteAndLocalFileIsSame($remoteFile, $localFile, $shouldBeSame, $checkOnRemoteServer); + $this->assertContentOfRemoteAndLocalFileIsSame( + $remoteFile, $localFile, $shouldBeSame, $checkOnRemoteServer + ); } /** @@ -1300,8 +1327,10 @@ public function theContentOfShouldNotHaveChanged($fileName, $remoteServer) { } else { $subFolderPath = ""; } - $localFile = getenv("SRC_SKELETON_DIR") . "/" . $subFolderPath . $fileName; - $this->assertContentOfRemoteAndLocalFileIsSame($remoteFile, $localFile, true, $checkOnRemoteServer); + $localFile = \getenv("SRC_SKELETON_DIR") . "/" . $subFolderPath . $fileName; + $this->assertContentOfRemoteAndLocalFileIsSame( + $remoteFile, $localFile, true, $checkOnRemoteServer + ); } /** @@ -1313,7 +1342,9 @@ public function theContentOfShouldNotHaveChanged($fileName, $remoteServer) { * @return void */ public function theUserMarksTheFileAsFavoriteUsingTheWebUI($fileOrFolderName) { - $fileRow = $this->filesPage->findFileRowByName($fileOrFolderName, $this->getSession()); + $fileRow = $this->filesPage->findFileRowByName( + $fileOrFolderName, $this->getSession() + ); $fileRow->markAsFavorite(); $this->filesPage->waitTillFileRowsAreReady($this->getSession()); } @@ -1326,7 +1357,9 @@ public function theUserMarksTheFileAsFavoriteUsingTheWebUI($fileOrFolderName) { * @return void */ public function theFileShouldBeMarkedAsFavoriteOnTheWebUI($fileOrFolderName) { - $fileRow = $this->filesPage->findFileRowByName($fileOrFolderName, $this->getSession()); + $fileRow = $this->filesPage->findFileRowByName( + $fileOrFolderName, $this->getSession() + ); if ($fileRow->isMarkedAsFavorite() === false) { throw new Exception( __METHOD__ . @@ -1344,7 +1377,9 @@ public function theFileShouldBeMarkedAsFavoriteOnTheWebUI($fileOrFolderName) { * @return void */ public function theUserUnmarksTheFavoritedFileUsingTheWebUI($fileOrFolderName) { - $fileRow = $this->getCurrentPageObject()->findFileRowByName($fileOrFolderName, $this->getSession()); + $fileRow = $this->getCurrentPageObject()->findFileRowByName( + $fileOrFolderName, $this->getSession() + ); $fileRow->unmarkFavorite(); $this->getCurrentPageObject()->waitTillFileRowsAreReady($this->getSession()); } @@ -1356,8 +1391,12 @@ public function theUserUnmarksTheFavoritedFileUsingTheWebUI($fileOrFolderName) { * * @return void */ - public function theFolderShouldNotBeMarkedAsFavoriteOnTheWebUI($fileOrFolderName) { - $fileRow = $this->filesPage->findFileRowByName($fileOrFolderName, $this->getSession()); + public function theFolderShouldNotBeMarkedAsFavoriteOnTheWebUI( + $fileOrFolderName + ) { + $fileRow = $this->filesPage->findFileRowByName( + $fileOrFolderName, $this->getSession() + ); if ($fileRow->isMarkedAsFavorite() === true) { throw new Exception( __METHOD__ . @@ -1401,9 +1440,13 @@ private function assertContentOfRemoteAndLocalFileIsSame( $downloadedContent = $result->getBody()->getContents(); if ($shouldBeSame) { - PHPUnit_Framework_Assert::assertSame($localContent, $downloadedContent); + PHPUnit_Framework_Assert::assertSame( + $localContent, $downloadedContent + ); } else { - PHPUnit_Framework_Assert::assertNotSame($localContent, $downloadedContent); + PHPUnit_Framework_Assert::assertNotSame( + $localContent, $downloadedContent + ); } } diff --git a/tests/acceptance/features/bootstrap/WebUIGeneralContext.php b/tests/acceptance/features/bootstrap/WebUIGeneralContext.php index 2b544498844e..8532fd045d77 100644 --- a/tests/acceptance/features/bootstrap/WebUIGeneralContext.php +++ b/tests/acceptance/features/bootstrap/WebUIGeneralContext.php @@ -254,7 +254,9 @@ public function aNotificationShouldBeDisplayedOnTheWebUIWithTheText( * @return void * @throws Exception */ - public function notificationsShouldBeDisplayedOnTheWebUIWithTheText($matching, TableNode $table) { + public function notificationsShouldBeDisplayedOnTheWebUIWithTheText( + $matching, TableNode $table + ) { $actualNotifications = $this->owncloudPage->getNotifications(); $numActualNotifications = count($actualNotifications); $expectedNotifications = $table->getRows(); @@ -375,7 +377,9 @@ public function settingInSectionHasBeen($setting, $section, $value) { } elseif ($value === "disabled") { $value = false; } else { - throw new InvalidArgumentException("$value can only be 'disabled' or 'enabled'"); + throw new InvalidArgumentException( + "$value can only be 'disabled' or 'enabled'" + ); } $capability = $this->capabilities[strtolower($section)][$setting]; diff --git a/tests/acceptance/features/bootstrap/WebUILoginContext.php b/tests/acceptance/features/bootstrap/WebUILoginContext.php index 64e2cbe2160e..48f6f42e5fe3 100644 --- a/tests/acceptance/features/bootstrap/WebUILoginContext.php +++ b/tests/acceptance/features/bootstrap/WebUILoginContext.php @@ -83,7 +83,9 @@ public function theUserRelogsInWithUsernameAndPasswordUsingTheWebUI( $username, $password ) { $this->webUIGeneralContext->theUserLogsOutOfTheWebUI(); - $this->theUserLogsInWithUsernameAndPasswordUsingTheWebUI($username, $password); + $this->theUserLogsInWithUsernameAndPasswordUsingTheWebUI( + $username, $password + ); } /** @@ -95,7 +97,9 @@ public function theUserRelogsInWithUsernameAndPasswordUsingTheWebUI( * * @return void */ - public function theUserLogsInWithUsernameAndPasswordUsingTheWebUI($username, $password) { + public function theUserLogsInWithUsernameAndPasswordUsingTheWebUI( + $username, $password + ) { $this->filesPage = $this->webUIGeneralContext->loginAs($username, $password); } @@ -135,7 +139,9 @@ public function theUserLogsInWithUsernameAndPasswordToUsingTheWebUI( $server . $this->loginPage->getOriginalPath() ); $this->loginPage->open(); - $this->theUserLogsInWithUsernameAndPasswordUsingTheWebUI($username, $password); + $this->theUserLogsInWithUsernameAndPasswordUsingTheWebUI( + $username, $password + ); } /** @@ -198,12 +204,16 @@ public function itShouldBePossibleToLogin($shouldOrNot, $username, $password) { } $this->theUserBrowsesToTheLoginPage(); if ($should) { - $this->theUserLogsInWithUsernameAndPasswordUsingTheWebUI($username, $password); + $this->theUserLogsInWithUsernameAndPasswordUsingTheWebUI( + $username, $password + ); $this->webUIGeneralContext->theUserShouldBeRedirectedToAWebUIPageWithTheTitle( $this->loginSuccessPageTitle ); } else { - $this->theUserLogsInWithUsernameAndInvalidPasswordUsingTheWebUI($username, $password); + $this->theUserLogsInWithUsernameAndInvalidPasswordUsingTheWebUI( + $username, $password + ); $this->webUIGeneralContext->theUserShouldBeRedirectedToAWebUIPageWithTheTitle( $this->loginFailedPageTitle ); diff --git a/tests/acceptance/features/bootstrap/WebUISharingContext.php b/tests/acceptance/features/bootstrap/WebUISharingContext.php index efbaaef46a32..809a2d99acd2 100644 --- a/tests/acceptance/features/bootstrap/WebUISharingContext.php +++ b/tests/acceptance/features/bootstrap/WebUISharingContext.php @@ -412,7 +412,9 @@ public function thePublicAccessesTheLastCreatedPublicLinkUsingTheWebUI() { * @return void * @throws Exception */ - public function thePublicAddsThePublicLinkToUsingTheWebUI($server, $username, $password) { + public function thePublicAddsThePublicLinkToUsingTheWebUI( + $server, $username, $password + ) { if (!$this->publicLinkFilesPage->isOpen()) { throw new Exception('Not on public link page!'); } @@ -576,10 +578,14 @@ public function theFileFolderShouldBeMarkedAsSharedBy( * @return void * @throws Exception */ - public function itShouldNotBePossibleToShareUsingTheWebUI($fileName, $shareWith = null) { + public function itShouldNotBePossibleToShareUsingTheWebUI( + $fileName, $shareWith = null + ) { $sharingWasPossible = false; try { - $this->theUserSharesTheFileFolderWithTheUserUsingTheWebUI($fileName, null, $shareWith, 2, true); + $this->theUserSharesTheFileFolderWithTheUserUsingTheWebUI( + $fileName, null, $shareWith, 2, true + ); $sharingWasPossible = true; } catch (ElementNotFoundException $e) { $possibleMessages = [ @@ -595,7 +601,8 @@ public function itShouldNotBePossibleToShareUsingTheWebUI($fileName, $shareWith } if ($foundMessage === false) { throw new Exception( - 'exception message has to contain "could not find share-with-field",' . + 'exception message has to contain' . + ' "could not find share-with-field",' . ' "could not find sharing button in fileRow" or' . ' "could not share with \'...\'"but was: "' . $e->getMessage() . '"' @@ -715,16 +722,20 @@ private function setupSharingConfigs() { ], [ 'capabilitiesApp' => 'files_sharing', - 'capabilitiesParameter' => 'user_enumeration@@@enabled', + 'capabilitiesParameter' => + 'user_enumeration@@@enabled', 'testingApp' => 'core', - 'testingParameter' => 'shareapi_allow_share_dialog_user_enumeration', + 'testingParameter' => + 'shareapi_allow_share_dialog_user_enumeration', 'testingState' => true ], [ 'capabilitiesApp' => 'files_sharing', - 'capabilitiesParameter' => 'user_enumeration@@@group_members_only', + 'capabilitiesParameter' => + 'user_enumeration@@@group_members_only', 'testingApp' => 'core', - 'testingParameter' => 'shareapi_share_dialog_user_enumeration_group_members', + 'testingParameter' => + 'shareapi_share_dialog_user_enumeration_group_members', 'testingState' => false ], [ diff --git a/tests/acceptance/features/lib/FilesPage.php b/tests/acceptance/features/lib/FilesPage.php index 623765ffc111..69b519767073 100644 --- a/tests/acceptance/features/lib/FilesPage.php +++ b/tests/acceptance/features/lib/FilesPage.php @@ -295,7 +295,9 @@ public function moveFileTo( $this->resetSumStartedAjaxRequests($session); for ($retryCounter = 0; $retryCounter < $maxRetries; $retryCounter++) { - $toMoveFileRow->findFileLink()->dragTo($destinationFileRow->findFileLink()); + $toMoveFileRow->findFileLink()->dragTo( + $destinationFileRow->findFileLink() + ); $this->waitForAjaxCallsToStartAndFinish($session); $countXHRRequests = $this->getSumStartedAjaxRequests($session); if ($countXHRRequests === 0) { @@ -305,7 +307,8 @@ public function moveFileTo( } } if ($retryCounter > 0) { - $message = "INFORMATION: retried to move file " . $retryCounter . " times"; + $message + = "INFORMATION: retried to move file " . $retryCounter . " times"; echo $message; error_log($message); } diff --git a/tests/acceptance/features/lib/FilesPageBasic.php b/tests/acceptance/features/lib/FilesPageBasic.php index a50a82253f7a..881c5f78cbd2 100644 --- a/tests/acceptance/features/lib/FilesPageBasic.php +++ b/tests/acceptance/features/lib/FilesPageBasic.php @@ -137,7 +137,9 @@ public function findFileRowByName($name, Session $session) { //loop to keep on scrolling down to load not viewed files //when the scroll does not retrieve any new files, the file is not there do { - $fileListElement = $this->waitTillElementIsNotNull($this->getFileListXpath()); + $fileListElement = $this->waitTillElementIsNotNull( + $this->getFileListXpath() + ); if (is_null($fileListElement)) { throw new ElementNotFoundException( @@ -516,8 +518,8 @@ public function waitTillPageIsLoaded( ); $fileListIsVisible = false; } catch (StaleElementReference $e) { - // Somehow on Edge this can throw StaleElementReference even though - // we just found the file list. + // Somehow on Edge this can throw StaleElementReference + // even though we just found the file list. // TODO: Edge - if it keeps happening then find out why. error_log( __METHOD__ @@ -579,8 +581,10 @@ public function waitTillFileRowsAreReady( while ($currentTime <= $end) { $fileList = $this->find('xpath', $this->getFileListXpath()); - if (!is_null($fileList)) { - $busyFileRows = $fileList->findAll('xpath', $this->fileRowsBusyXpath); + if ($fileList !== null) { + $busyFileRows = $fileList->findAll( + 'xpath', $this->fileRowsBusyXpath + ); if (count($busyFileRows) === 0) { break; diff --git a/tests/acceptance/features/lib/FilesPageElement/FileRow.php b/tests/acceptance/features/lib/FilesPageElement/FileRow.php index a5878870d9c7..0d93855bde49 100644 --- a/tests/acceptance/features/lib/FilesPageElement/FileRow.php +++ b/tests/acceptance/features/lib/FilesPageElement/FileRow.php @@ -69,7 +69,7 @@ public function isVisible() { * from an other Page Object by $this->getPage("FilesPageElement\\FileRow") * there is no real __construct() that can take arguments * - * @param \Behat\Mink\Element\NodeElement $rowElement + * @param NodeElement $rowElement * * @return void */ @@ -100,8 +100,8 @@ public function isBusy() { /** * finds the Action Button * - * @return \Behat\Mink\Element\NodeElement - * @throws \SensioLabs\Behat\PageObjectExtension\PageObject\Exception\ElementNotFoundException + * @return NodeElement + * @throws ElementNotFoundException */ public function findFileActionButton() { $actionButton = $this->rowElement->find( @@ -120,7 +120,7 @@ public function findFileActionButton() { /** * finds and clicks the file actions button * - * @throws \SensioLabs\Behat\PageObjectExtension\PageObject\Exception\ElementNotFoundException + * @throws ElementNotFoundException * @return void */ public function clickFileActionButton() { @@ -132,7 +132,7 @@ public function clickFileActionButton() { * * @param Session $session * - * @throws \SensioLabs\Behat\PageObjectExtension\PageObject\Exception\ElementNotFoundException + * @throws ElementNotFoundException * @return FileActionsMenu */ public function openFileActionsMenu(Session $session) { @@ -149,7 +149,7 @@ public function openFileActionsMenu(Session $session) { * finds and returns the share button element * * @throws ElementNotFoundException - * @return \Behat\Mink\Element\NodeElement + * @return NodeElement */ public function findSharingButton() { $shareBtn = $this->rowElement->find("xpath", $this->shareBtnXpath); @@ -179,7 +179,7 @@ public function openSharingDialog() { * finds the input field to rename the file/folder * * @throws ElementNotFoundException - * @return \Behat\Mink\Element\NodeElement + * @return NodeElement */ public function findRenameInputField() { $inputField = $this->rowElement->find( @@ -229,7 +229,7 @@ public function delete(Session $session) { * finds and returns the tooltip element * * @throws ElementNotFoundException - * @return \Behat\Mink\Element\NodeElement + * @return NodeElement */ public function findTooltipElement() { $element = $this->rowElement->find("xpath", $this->fileTooltipXpath); @@ -256,7 +256,7 @@ public function getTooltip() { * finds and returns the thumbnail of the file * * @throws ElementNotFoundException - * @return \Behat\Mink\Element\NodeElement + * @return NodeElement */ public function findThumbnail() { $thumbnail = $this->rowElement->find("xpath", $this->thumbnailXpath); @@ -284,7 +284,7 @@ public function selectForBatchAction() { * find and return the link to the file/folder * * @throws ElementNotFoundException - * @return \Behat\Mink\Element\NodeElement + * @return NodeElement */ public function findFileLink() { $linkElement = $this->rowElement->find("xpath", $this->fileLinkXpath); @@ -346,7 +346,9 @@ public function markAsFavorite() { * @return bool */ public function isMarkedAsFavorite() { - $checkFavorite = $this->rowElement->find("xpath", $this->markedFavoriteXpath); + $checkFavorite = $this->rowElement->find( + "xpath", $this->markedFavoriteXpath + ); if (is_null($checkFavorite)) { return false; diff --git a/tests/acceptance/features/lib/FilesPageElement/SharingDialog.php b/tests/acceptance/features/lib/FilesPageElement/SharingDialog.php index 309353625966..730bc0eca48f 100644 --- a/tests/acceptance/features/lib/FilesPageElement/SharingDialog.php +++ b/tests/acceptance/features/lib/FilesPageElement/SharingDialog.php @@ -166,7 +166,9 @@ private function shareWithUserOrGroup( $nameToType, $nameToMatch, Session $session, $maxRetries = 5, $quiet = false ) { for ($retryCounter = 0; $retryCounter < $maxRetries; $retryCounter++) { - $autocompleteNodeElement = $this->fillShareWithField($nameToType, $session); + $autocompleteNodeElement = $this->fillShareWithField( + $nameToType, $session + ); $userElements = $autocompleteNodeElement->findAll( "xpath", $this->autocompleteItemsTextXpath ); @@ -266,7 +268,9 @@ public function setSharingPermissions( $shareReceiverName, $permissions ) { - $xpathLocator = sprintf($this->permissionsFieldByUserName, $shareReceiverName); + $xpathLocator = \sprintf( + $this->permissionsFieldByUserName, $shareReceiverName + ); $permissionsField = $this->find("xpath", $xpathLocator); if (is_null($permissionsField)) { throw new ElementNotFoundException( diff --git a/tests/acceptance/features/lib/OwncloudPageElement/OCDialog.php b/tests/acceptance/features/lib/OwncloudPageElement/OCDialog.php index 45d5d30f7ece..4ca1f7d8ba5b 100644 --- a/tests/acceptance/features/lib/OwncloudPageElement/OCDialog.php +++ b/tests/acceptance/features/lib/OwncloudPageElement/OCDialog.php @@ -93,8 +93,10 @@ public function getTitle() { * @return string */ public function getMessage() { - $contentElement = $this->dialogElement->find("xpath", $this->contentClassXpath); - if (is_null($contentElement)) { + $contentElement = $this->dialogElement->find( + "xpath", $this->contentClassXpath + ); + if ($contentElement === null) { throw new ElementNotFoundException( __METHOD__ . " xpath $this->contentClassXpath " .