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 27, 2018
1 parent ebe1481 commit ee210ad
Show file tree
Hide file tree
Showing 22 changed files with 118 additions and 34 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 @@ -224,6 +224,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 @@ -899,6 +900,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
18 changes: 10 additions & 8 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 Expand Up @@ -920,30 +922,30 @@ public function theDeletedElementsShouldBeListedInTheTrashbinOnTheWebUI() {
* @Then /^the (?:file|folder) ((?:'[^']*')|(?:"[^"]*")) with the path ((?:'[^']*')|(?:"[^"]*")) should (not|)\s?be listed\s?(?:in the |)(files page|trashbin|favorites page|shared-with-you page|)\s?(?:folder ((?:'[^']*')|(?:"[^"]*")))? on the webUI$/
*
* @param string $name enclosed in single or double quotes
* @param string $path
* @param string $shouldOrNot
* @param string $typeOfFilesPage
* @param string $folder
* @param string $path
*
* @return void
* @throws \Exception
*/
public function theFileFolderWithThePathShouldBeListedOnTheWebUI(
$name, $path, $shouldOrNot, $typeOfFilesPage = "", $folder = ""
) {
) {
// The capturing groups of the regex include the quotes at each
// end of the captured string, so trim them.
if ($folder !== "") {
$folder = \trim($folder, $folder[0]);
}
$path = \trim($path, $path[0]);
$this->checkIfFileFolderIsListedOnTheWebUI(
\trim($name, $name[0]),
$shouldOrNot,
$typeOfFilesPage,
$folder,
$path
);
\trim($name, $name[0]),
$shouldOrNot,
$typeOfFilesPage,
$folder,
$path
);
}

/**
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 @@ -565,6 +565,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 @@ -580,6 +581,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 @@ -69,9 +69,11 @@ protected function getEmptyContentXpath() {
}

/**
*
* {@inheritDoc}
*
* @see \Page\FilesPageBasic::getFilePathInRowXpath()
*
* @return void
*/
protected function getFilePathInRowXpath() {
return $this->filePathInRowXpath;
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
1 change: 1 addition & 0 deletions tests/acceptance/features/lib/FilesPageBasic.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
* Object of a row on the FilesPage
*/
class FavoritesFileRow extends FileRow {
/**
* @param string $xpath
*
* @return null|string
*/
public function getFilePath($xpath) {
$filePath = $this->rowElement->getAttribute("data-path");
return $filePath;
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 @@ -110,6 +110,7 @@ public function getLinkName() {
* @param string $permissions
*
* @return void
* @throws ElementNotFoundException
*/
public function setLinkPermissions($permissions) {
$permissions = \strtolower($permissions);
Expand All @@ -136,6 +137,7 @@ public function setLinkPermissions($permissions) {
* @param string $password
*
* @return void
* @throws ElementNotFoundException
*/
public function setLinkPassword($password) {
$passwordInput = $this->popupElement->find(
Expand All @@ -156,6 +158,7 @@ public function setLinkPassword($password) {
* @param string $date
*
* @return void
* @throws ElementNotFoundException
*/
public function setLinkExpirationDate($date) {
$expirationDateInput = $this->popupElement->find(
Expand Down Expand Up @@ -187,6 +190,7 @@ public function setLinkExpirationDate($date) {
* @param string $email
*
* @return void
* @throws ElementNotFoundException
*/
public function setLinkEmail($email) {
$emailInput = $this->popupElement->find("xpath", $this->emailInputXpath);
Expand Down Expand Up @@ -222,6 +226,7 @@ public function unsetLinkEmail($email) {
/**
*
* @return void
* @throws ElementNotFoundException
*/
public function setEmailToSelf() {
$checkbox = $this->popupElement->find("xpath", $this->emailToSelfCheckboxXpath);
Expand All @@ -231,7 +236,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 All @@ -240,6 +245,7 @@ public function setEmailToSelf() {
* @param string $personalMessage
*
* @return void
* @throws ElementNotFoundException
*/
public function setPersonalMessage($personalMessage) {
$personalMessageInput = $this->popupElement->find("xpath", $this->personalMessageInputXpath);
Expand All @@ -248,7 +254,7 @@ public function setPersonalMessage($personalMessage) {
__METHOD__ .
" xpath $this->personalMessageInputXpath" .
" could not find the input field for sending a personal message in the email."
);
);
}
$this->waitTillElementIsNotNull($this->personalMessageInputXpath);
$personalMessageInput->focus();
Expand All @@ -258,6 +264,7 @@ public function setPersonalMessage($personalMessage) {
/**
*
* @return void
* @throws ElementNotFoundException
*/
public function save() {
$saveButton = $this->popupElement->find("xpath", $this->shareButtonXpath);
Expand All @@ -271,14 +278,19 @@ public function save() {
$saveButton->click();
}

/**
*
* @return void
* @throws ElementNotFoundException
*/
public function close() {
$closeButton = $this->popupElement->find("xpath", $this->popupCloseButton);
if ($closeButton === null) {
throw new ElementNotFoundException(
__METHOD__ .
" xpath $this->popupCloseButton" .
" could not find save button of the public link popup"
);
);
}
$closeButton->click();
}
Expand Down
Loading

0 comments on commit ee210ad

Please sign in to comment.