Skip to content

Commit

Permalink
phpcs acceptance test style
Browse files Browse the repository at this point in the history
  • Loading branch information
phil-davis committed Sep 24, 2018
1 parent 59183ce commit 39a0a6e
Show file tree
Hide file tree
Showing 19 changed files with 77 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public function getDeletedNotification() {

/**
* @param int $deletedNotification
*
* @return void
*/
public function setDeletedNotification($deletedNotification) {
Expand Down
1 change: 1 addition & 0 deletions tests/acceptance/features/bootstrap/Sharing.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 2 additions & 0 deletions tests/acceptance/features/bootstrap/WebDav.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ public function getNewDavPath() {
* @Given /^using (old|new) (?:dav|DAV) path$/
*
* @param string $oldOrNewDavPath
*
* @return void
*/
public function usingOldOrNewDavPath($oldOrNewDavPath) {
Expand Down Expand Up @@ -897,6 +898,7 @@ public function userHasSetPropertyOfEntryTo(
*
* @param string $propertyName
* @param string $propertyValue
*
* @return void
* @throws \Exception
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public function theAdminBrowsesToTheAdminSharingSettingsPage() {

/**
* @When /^the administrator (enables|disables) the share API using the webUI$/
*
* @param string $action
*
* @return void
Expand All @@ -78,6 +79,7 @@ public function adminTogglesShareApiUsingTheWebui($action) {

/**
* @When /^the administrator (enables|disables) share via link using the webUI$/
*
* @param string $action
*
* @return void
Expand All @@ -91,6 +93,7 @@ public function adminTogglesShareViaLink($action) {

/**
* @When /^the administrator (enables|disables) public uploads using the webUI$/
*
* @param string $action
*
* @return void
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -169,6 +177,7 @@ public function adminTogglesEnforcePasswordProtectionForWriteOnlyLinks($action)

/**
* @When /^the administrator (enables|disables) resharing using the webUI$/
*
* @param string $action
*
* @return void
Expand All @@ -182,6 +191,7 @@ public function adminTogglesDisableResharing($action) {

/**
* @When /^the administrator (enables|disables) sharing with groups using the webUI$/
*
* @param string $action
*
* @return void
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions tests/acceptance/features/bootstrap/WebUIFilesContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ public function theUserBrowsesToTheFilesPage() {
* @param string $tabName
* @param string $fileName
* @param string $folderName
*
* @return void
* @throws Exception
*/
Expand Down Expand Up @@ -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) {
Expand Down
8 changes: 8 additions & 0 deletions tests/acceptance/features/bootstrap/WebUISearchContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,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]);
Expand All @@ -100,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]);
Expand Down
2 changes: 2 additions & 0 deletions tests/acceptance/features/bootstrap/WebUISharingContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions tests/acceptance/features/bootstrap/WebUIUserContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 3 additions & 1 deletion tests/acceptance/features/lib/FavoritesPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,11 @@ protected function getEmptyContentXpath() {
}

/**
*
* {@inheritDoc}
*
* @see \Page\FilesPageBasic::getFilePathInRowXpath()
*
* @return void
*/
protected function getFilePathInRowXpath() {
throw new \Exception("not implemented in FavoritesPage");
Expand Down
4 changes: 3 additions & 1 deletion tests/acceptance/features/lib/FilesPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,11 @@ protected function getEmptyContentXpath() {
}

/**
*
* {@inheritDoc}
*
* @see \Page\FilesPageBasic::getFilePathInRowXpath()
*
* @return void
*/
protected function getFilePathInRowXpath() {
throw new \Exception("not implemented in FilesPage");
Expand Down
2 changes: 1 addition & 1 deletion tests/acceptance/features/lib/FilesPageBasic.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions tests/acceptance/features/lib/FilesPageElement/FileRow.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
1 change: 0 additions & 1 deletion tests/acceptance/features/lib/LoginPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ public function getLostPasswordMessage() {
/**
*
* @param string $newPassword
*
* @param Session $session
*
* @return void
Expand Down
3 changes: 3 additions & 0 deletions tests/acceptance/features/lib/OwncloudPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -329,6 +331,7 @@ public function search($session, $searchTerm) {
$searchResultInOtherFoldersPage = $this->getPage("SearchResultInOtherFoldersPage");
$searchResultInOtherFoldersPage->waitTillPageIsLoaded($session);
}

/**
* return the path to the relevant page
*
Expand Down
22 changes: 14 additions & 8 deletions tests/acceptance/features/lib/PublicLinkFilesPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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"
);
}
Expand All @@ -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");
Expand Down Expand Up @@ -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();
Expand All @@ -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
Expand All @@ -325,7 +331,7 @@ public function waitTillPageIsLoaded(
. "\n-------------------------\n"
. $e->getMessage()
. "\n-------------------------\n"
);
);
$fileListIsVisible = false;
}

Expand All @@ -338,7 +344,7 @@ public function waitTillPageIsLoaded(
$emptyContentElement = $this->find(
"xpath",
$this->getEmptyContentXpath()
);
);

if ($emptyContentElement !== null) {
if (!$emptyContentElement->hasClass("hidden")) {
Expand Down
19 changes: 17 additions & 2 deletions tests/acceptance/features/lib/SearchResultInOtherFoldersPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 3 additions & 1 deletion tests/acceptance/features/lib/SharedWithYouPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,11 @@ protected function getEmptyContentXpath() {
}

/**
*
* {@inheritDoc}
*
* @see \Page\FilesPageBasic::getFilePathInRowXpath()
*
* @return void
*/
protected function getFilePathInRowXpath() {
throw new \Exception("not implemented in SharedWithYouPage");
Expand Down
Loading

0 comments on commit 39a0a6e

Please sign in to comment.