From bcb1d4632ea440490cadcb29067bdc50ff25c17a Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Thu, 20 Sep 2018 23:09:45 +0545 Subject: [PATCH] phpcs acceptance test style --- .../bootstrap/NotificationsCoreContext.php | 1 + .../acceptance/features/bootstrap/Sharing.php | 1 + .../acceptance/features/bootstrap/WebDav.php | 2 ++ .../WebUIAdminSharingSettingsContext.php | 11 ++++++++++ .../features/bootstrap/WebUIFilesContext.php | 2 ++ .../features/bootstrap/WebUISearchContext.php | 9 ++++++++ .../bootstrap/WebUISharingContext.php | 2 ++ .../features/bootstrap/WebUIUserContext.php | 1 + .../acceptance/features/lib/FavoritesPage.php | 4 +++- tests/acceptance/features/lib/FilesPage.php | 4 +++- .../features/lib/FilesPageBasic.php | 2 +- .../features/lib/FilesPageElement/FileRow.php | 1 + .../EditPublicLinkPopup.php | 2 +- tests/acceptance/features/lib/LoginPage.php | 1 - .../acceptance/features/lib/OwncloudPage.php | 3 +++ .../features/lib/PublicLinkFilesPage.php | 22 ++++++++++++------- .../lib/SearchResultInOtherFoldersPage.php | 19 ++++++++++++++-- .../features/lib/SharedWithYouPage.php | 4 +++- .../acceptance/features/lib/TrashbinPage.php | 4 +++- 19 files changed, 78 insertions(+), 17 deletions(-) diff --git a/tests/acceptance/features/bootstrap/NotificationsCoreContext.php b/tests/acceptance/features/bootstrap/NotificationsCoreContext.php index a8f9e76560d0..8706b14d5abf 100644 --- a/tests/acceptance/features/bootstrap/NotificationsCoreContext.php +++ b/tests/acceptance/features/bootstrap/NotificationsCoreContext.php @@ -70,6 +70,7 @@ public function getDeletedNotification() { /** * @param int $deletedNotification + * * @return void */ public function setDeletedNotification($deletedNotification) { diff --git a/tests/acceptance/features/bootstrap/Sharing.php b/tests/acceptance/features/bootstrap/Sharing.php index 1236a9fc2dce..e7a67b3b6b81 100644 --- a/tests/acceptance/features/bootstrap/Sharing.php +++ b/tests/acceptance/features/bootstrap/Sharing.php @@ -221,6 +221,7 @@ public function userCreatesAPublicLinkShareOf($user, $path) { * @Given /^the user has created a public link share of (?:file|folder) "([^"]*)"$/ * * @param string $path + * * @return void */ public function aPublicLinkShareOfIsCreated($path) { diff --git a/tests/acceptance/features/bootstrap/WebDav.php b/tests/acceptance/features/bootstrap/WebDav.php index 52a19eaf63ea..02348cc52680 100644 --- a/tests/acceptance/features/bootstrap/WebDav.php +++ b/tests/acceptance/features/bootstrap/WebDav.php @@ -111,6 +111,7 @@ public function getNewDavPath() { * @Given /^using (old|new) (?:dav|DAV) path$/ * * @param string $oldOrNewDavPath + * * @return void */ public function usingOldOrNewDavPath($oldOrNewDavPath) { @@ -897,6 +898,7 @@ public function userHasSetPropertyOfEntryTo( * * @param string $propertyName * @param string $propertyValue + * * @return void * @throws \Exception */ diff --git a/tests/acceptance/features/bootstrap/WebUIAdminSharingSettingsContext.php b/tests/acceptance/features/bootstrap/WebUIAdminSharingSettingsContext.php index 546230f06198..f019a834e0a8 100644 --- a/tests/acceptance/features/bootstrap/WebUIAdminSharingSettingsContext.php +++ b/tests/acceptance/features/bootstrap/WebUIAdminSharingSettingsContext.php @@ -65,6 +65,7 @@ public function theAdminBrowsesToTheAdminSharingSettingsPage() { /** * @When /^the administrator (enables|disables) the share API using the webUI$/ + * * @param string $action * * @return void @@ -78,6 +79,7 @@ public function adminTogglesShareApiUsingTheWebui($action) { /** * @When /^the administrator (enables|disables) share via link using the webUI$/ + * * @param string $action * * @return void @@ -91,6 +93,7 @@ public function adminTogglesShareViaLink($action) { /** * @When /^the administrator (enables|disables) public uploads using the webUI$/ + * * @param string $action * * @return void @@ -104,6 +107,7 @@ public function adminTogglesPublicUpload($action) { /** * @When /^the administrator (enables|disables) mail notification on public link share using the webUI$/ + * * @param string $action * * @return void @@ -117,6 +121,7 @@ public function adminTogglesMailNotificationOnPublicLinkShare($action) { /** * @When /^the administrator (enables|disables) social media share on public link share using the webUI$/ + * * @param string $action * * @return void @@ -130,6 +135,7 @@ public function adminTogglesSocialShareOnPublicLinkShare($action) { /** * @When /^the administrator (enables|disables) enforce password protection for read-only links using the webUI$/ + * * @param string $action * * @return void @@ -143,6 +149,7 @@ public function adminTogglesEnforcePasswordProtectionForReadOnlyLinks($action) { /** * @When /^the administrator (enables|disables) enforce password protection for read and write links using the webUI$/ + * * @param string $action * * @return void @@ -156,6 +163,7 @@ public function adminTogglesEnforcePasswordProtectionForReadWriteLinks($action) /** * @When /^the administrator (enables|disables) enforce password protection for upload only links using the webUI$/ + * * @param string $action * * @return void @@ -169,6 +177,7 @@ public function adminTogglesEnforcePasswordProtectionForWriteOnlyLinks($action) /** * @When /^the administrator (enables|disables) resharing using the webUI$/ + * * @param string $action * * @return void @@ -182,6 +191,7 @@ public function adminTogglesDisableResharing($action) { /** * @When /^the administrator (enables|disables) sharing with groups using the webUI$/ + * * @param string $action * * @return void @@ -195,6 +205,7 @@ public function adminTogglesSharingWithGroupUsingTheWebui($action) { /** * @When /^the administrator (enables|disables) restrict users to only share with their group members using the webUI$/ + * * @param string $action * * @return void diff --git a/tests/acceptance/features/bootstrap/WebUIFilesContext.php b/tests/acceptance/features/bootstrap/WebUIFilesContext.php index 8b666a59e515..12dd5fa9f87c 100644 --- a/tests/acceptance/features/bootstrap/WebUIFilesContext.php +++ b/tests/acceptance/features/bootstrap/WebUIFilesContext.php @@ -205,6 +205,7 @@ public function theUserBrowsesToTheFilesPage() { * @param string $tabName * @param string $fileName * @param string $folderName + * * @return void * @throws Exception */ @@ -416,6 +417,7 @@ public function thereShouldBeNoFilesFoldersListedOnTheWebUI() { * @Then there should be exactly :count folder/folders listed on the webUI * * @param string $count that is numeric + * * @return void */ public function thereShouldBeCountFilesFoldersListedOnTheWebUI($count) { diff --git a/tests/acceptance/features/bootstrap/WebUISearchContext.php b/tests/acceptance/features/bootstrap/WebUISearchContext.php index 00c20b433f85..a3abac68e384 100644 --- a/tests/acceptance/features/bootstrap/WebUISearchContext.php +++ b/tests/acceptance/features/bootstrap/WebUISearchContext.php @@ -58,6 +58,7 @@ class WebUISearchContext extends RawMinkContext implements Context { /** * WebUILoginContext constructor. * + * @param OwncloudPage $ownCloudPage * @param SearchResultInOtherFoldersPage $searchResultInOtherFoldersPage */ public function __construct( @@ -83,8 +84,12 @@ public function theUserSearchesUsingTheWebUI($searchTerm) { /** * @Then /^the (?:file|folder) ((?:'[^']*')|(?:"[^"]*")) with the path ((?:'[^']*')|(?:"[^"]*")) should (not|)\s?be listed in the search results in other folders section on the webUI$/ + * * @param string $fileName * @param string $path + * @param string $shouldOrNot + * + * @return void */ public function fileShouldBeListedSearchResultOtherFolders($fileName, $path, $shouldOrNot) { $fileName = \trim($fileName, $fileName[0]); @@ -99,6 +104,10 @@ public function fileShouldBeListedSearchResultOtherFolders($fileName, $path, $sh * @Then /^the (?:file|folder) ((?:'[^']*')|(?:"[^"]*")) should (not|)\s?be listed in the search results in other folders section on the webUI$/ * * @param string $fileName + * @param string $shouldOrNot + * + * @return void + * @throws Exception */ public function fileShouldNotBeListedSearchResultOtherFolders($fileName, $shouldOrNot) { $fileName = \trim($fileName, $fileName[0]); diff --git a/tests/acceptance/features/bootstrap/WebUISharingContext.php b/tests/acceptance/features/bootstrap/WebUISharingContext.php index 1a223e258e89..63b923ff2770 100644 --- a/tests/acceptance/features/bootstrap/WebUISharingContext.php +++ b/tests/acceptance/features/bootstrap/WebUISharingContext.php @@ -497,6 +497,7 @@ public function userReactsToShareOfferedByUsingWebUI( * @When the public accesses the last created public link with password :password using the webUI * * @param string $password + * * @return void */ public function thePublicAccessesPublicLinkWithPasswordUsingTheWebui($password) { @@ -512,6 +513,7 @@ public function thePublicAccessesPublicLinkWithPasswordUsingTheWebui($password) * @When the public tries to access the last created public link with wrong password :wrongPassword using the webUI * * @param string $wrongPassword + * * @return void */ public function thePublicTriesToAccessPublicLinkWithWrongPasswordUsingTheWebui($wrongPassword) { diff --git a/tests/acceptance/features/bootstrap/WebUIUserContext.php b/tests/acceptance/features/bootstrap/WebUIUserContext.php index 1902a40d8516..df677a881766 100644 --- a/tests/acceptance/features/bootstrap/WebUIUserContext.php +++ b/tests/acceptance/features/bootstrap/WebUIUserContext.php @@ -51,6 +51,7 @@ public function __construct(OwncloudPage $owncloudPage) { * @Then :displayname should be shown as the name of the current user on the WebUI * * @param string $displayname + * * @return void */ public function displayNameOfTheCurrentUserOnTheWebUiShouldBe($displayname) { diff --git a/tests/acceptance/features/lib/FavoritesPage.php b/tests/acceptance/features/lib/FavoritesPage.php index 13102970aa08..89b4d3948e77 100644 --- a/tests/acceptance/features/lib/FavoritesPage.php +++ b/tests/acceptance/features/lib/FavoritesPage.php @@ -66,9 +66,11 @@ protected function getEmptyContentXpath() { } /** - * * {@inheritDoc} + * * @see \Page\FilesPageBasic::getFilePathInRowXpath() + * + * @return void */ protected function getFilePathInRowXpath() { throw new \Exception("not implemented in FavoritesPage"); diff --git a/tests/acceptance/features/lib/FilesPage.php b/tests/acceptance/features/lib/FilesPage.php index dd23e888926f..289b0d2cd725 100644 --- a/tests/acceptance/features/lib/FilesPage.php +++ b/tests/acceptance/features/lib/FilesPage.php @@ -79,9 +79,11 @@ protected function getEmptyContentXpath() { } /** - * * {@inheritDoc} + * * @see \Page\FilesPageBasic::getFilePathInRowXpath() + * + * @return void */ protected function getFilePathInRowXpath() { throw new \Exception("not implemented in FilesPage"); diff --git a/tests/acceptance/features/lib/FilesPageBasic.php b/tests/acceptance/features/lib/FilesPageBasic.php index 1e089e1fe4f9..bd0a9afd6ad7 100644 --- a/tests/acceptance/features/lib/FilesPageBasic.php +++ b/tests/acceptance/features/lib/FilesPageBasic.php @@ -119,10 +119,10 @@ public function findFileRowByName($name, Session $session) { * useful for pages where multiple files with the same name can be displayed * * @param string|array $name + * @param string $path * @param Session $session * * @return FileRow - * @throws ElementNotFoundException */ public function findFileRowByNameAndPath($name, $path, Session $session) { $fileRows = $this->findAllFileRowsByName($name, $session); diff --git a/tests/acceptance/features/lib/FilesPageElement/FileRow.php b/tests/acceptance/features/lib/FilesPageElement/FileRow.php index ae38811696c5..b109c308e341 100644 --- a/tests/acceptance/features/lib/FilesPageElement/FileRow.php +++ b/tests/acceptance/features/lib/FilesPageElement/FileRow.php @@ -271,6 +271,7 @@ public function getTooltip() { * return the path of the current file * * @param string $xpath xpath related to the fileRow element + * * @throws ElementNotFoundException * @return string */ diff --git a/tests/acceptance/features/lib/FilesPageElement/SharingDialogElement/EditPublicLinkPopup.php b/tests/acceptance/features/lib/FilesPageElement/SharingDialogElement/EditPublicLinkPopup.php index 7cfb93e23c17..5fb4ec1dda40 100644 --- a/tests/acceptance/features/lib/FilesPageElement/SharingDialogElement/EditPublicLinkPopup.php +++ b/tests/acceptance/features/lib/FilesPageElement/SharingDialogElement/EditPublicLinkPopup.php @@ -209,7 +209,7 @@ public function setEmailToSelf() { " xpath $this->emailToSelfCheckboxXpath" . " could not find the checkbox for sending the self copy of email of the public link. " . " Maybe the email isn't filled." - ); + ); } $checkbox->click(); } diff --git a/tests/acceptance/features/lib/LoginPage.php b/tests/acceptance/features/lib/LoginPage.php index 4e20df6b2dab..6fbade3481a0 100644 --- a/tests/acceptance/features/lib/LoginPage.php +++ b/tests/acceptance/features/lib/LoginPage.php @@ -138,7 +138,6 @@ public function getLostPasswordMessage() { /** * * @param string $newPassword - * * @param Session $session * * @return void diff --git a/tests/acceptance/features/lib/OwncloudPage.php b/tests/acceptance/features/lib/OwncloudPage.php index 3282ad4edb91..3eac9d9126b9 100644 --- a/tests/acceptance/features/lib/OwncloudPage.php +++ b/tests/acceptance/features/lib/OwncloudPage.php @@ -308,7 +308,9 @@ public function isAvatarVisible() { * * @param Session $session * @param string $searchTerm + * * @throws ElementNotFoundException + * @return void */ public function search($session, $searchTerm) { $searchbox = $this->findById($this->searchBoxId); @@ -329,6 +331,7 @@ public function search($session, $searchTerm) { $searchResultInOtherFoldersPage = $this->getPage("SearchResultInOtherFoldersPage"); $searchResultInOtherFoldersPage->waitTillPageIsLoaded($session); } + /** * return the path to the relevant page * diff --git a/tests/acceptance/features/lib/PublicLinkFilesPage.php b/tests/acceptance/features/lib/PublicLinkFilesPage.php index abd9075050e3..7d365df5e32b 100644 --- a/tests/acceptance/features/lib/PublicLinkFilesPage.php +++ b/tests/acceptance/features/lib/PublicLinkFilesPage.php @@ -74,9 +74,12 @@ protected function getEmptyContentXpath() { } /** - * * {@inheritDoc} + * * @see \Page\FilesPageBasic::getFilePathInRowXpath() + * + * @throws \Exception + * @return void */ protected function getFilePathInRowXpath() { throw new \Exception("not implemented in PublicLinkFilesPage"); @@ -176,7 +179,7 @@ public function getPreviewText() { if ($previewContainer === null) { throw new ElementNotFoundException( __METHOD__ . - " xpath $this->textPreviewContainerXpath ". + " xpath $this->textPreviewContainerXpath " . " could not find preview text container" ); } @@ -193,8 +196,9 @@ public function getDownloadUrl() { $downloadBtn = $this->find("xpath", $this->singleFileDownloadBtnXpath); if ($downloadBtn === null) { throw new ElementNotFoundException( - __METHOD__ . " xpath $this->singleFileDownloadBtnXpath ". - " could not find download button"); + __METHOD__ . " xpath $this->singleFileDownloadBtnXpath " . + " could not find download button" + ); } if ($downloadBtn->hasAttribute("href")) { return $downloadBtn->getAttribute("href"); @@ -299,7 +303,9 @@ public function waitTillPageIsLoaded( $end = $currentTime + ($timeout_msec / 1000); while ($currentTime <= $end) { $fileList = $this->find('xpath', $this->getFileListXpath()); - $downloadButton = $this->find("xpath", $this->singleFileDownloadBtnXpath); + $downloadButton = $this->find( + "xpath", $this->singleFileDownloadBtnXpath + ); if ($fileList !== null) { try { $fileListIsVisible = $fileList->isVisible(); @@ -313,7 +319,7 @@ public function waitTillPageIsLoaded( . "\n-------------------------\n" . $e->getMessage() . "\n-------------------------\n" - ); + ); $fileListIsVisible = false; } catch (StaleElementReference $e) { // Somehow on Edge this can throw StaleElementReference @@ -325,7 +331,7 @@ public function waitTillPageIsLoaded( . "\n-------------------------\n" . $e->getMessage() . "\n-------------------------\n" - ); + ); $fileListIsVisible = false; } @@ -338,7 +344,7 @@ public function waitTillPageIsLoaded( $emptyContentElement = $this->find( "xpath", $this->getEmptyContentXpath() - ); + ); if ($emptyContentElement !== null) { if (!$emptyContentElement->hasClass("hidden")) { diff --git a/tests/acceptance/features/lib/SearchResultInOtherFoldersPage.php b/tests/acceptance/features/lib/SearchResultInOtherFoldersPage.php index e4639b4fd8db..822cbf4c0c05 100644 --- a/tests/acceptance/features/lib/SearchResultInOtherFoldersPage.php +++ b/tests/acceptance/features/lib/SearchResultInOtherFoldersPage.php @@ -31,23 +31,38 @@ class SearchResultInOtherFoldersPage extends FilesPageBasic { protected $fileNameMatchXpath = "//div[@class='name' and .=%s]"; protected $fileNamesXpath = "//div[@class='name']"; protected $filePathInRowXpath = "//div[@class='path']"; - + + /** + * @return string + */ protected function getEmptyContentXpath() { return $this->emptyContentXpath; } + /** + * @return string + */ protected function getFileNameMatchXpath() { return $this->fileNameMatchXpath; } + /** + * @return string + */ protected function getFileNamesXpath() { return $this->fileNamesXpath; } + /** + * @return string + */ protected function getFileListXpath() { return $this->fileListXpath; } - + + /** + * @return string + */ protected function getFilePathInRowXpath() { return $this->filePathInRowXpath; } diff --git a/tests/acceptance/features/lib/SharedWithYouPage.php b/tests/acceptance/features/lib/SharedWithYouPage.php index acbe91315000..8ba6560b013f 100644 --- a/tests/acceptance/features/lib/SharedWithYouPage.php +++ b/tests/acceptance/features/lib/SharedWithYouPage.php @@ -68,9 +68,11 @@ protected function getEmptyContentXpath() { } /** - * * {@inheritDoc} + * * @see \Page\FilesPageBasic::getFilePathInRowXpath() + * + * @return void */ protected function getFilePathInRowXpath() { throw new \Exception("not implemented in SharedWithYouPage"); diff --git a/tests/acceptance/features/lib/TrashbinPage.php b/tests/acceptance/features/lib/TrashbinPage.php index 00f6e5231a33..af084807cde5 100644 --- a/tests/acceptance/features/lib/TrashbinPage.php +++ b/tests/acceptance/features/lib/TrashbinPage.php @@ -73,9 +73,11 @@ protected function getEmptyContentXpath() { } /** - * * {@inheritDoc} + * * @see \Page\FilesPageBasic::getFilePathInRowXpath() + * + * @return void */ protected function getFilePathInRowXpath() { throw new \Exception("not implemented in TrashbinPage");