Skip to content

Commit

Permalink
Use assertStringContainsString where appropriate in acceptance tests
Browse files Browse the repository at this point in the history
  • Loading branch information
phil-davis committed Apr 26, 2020
1 parent 65212b3 commit a50a8b8
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions tests/TestHelpers/EmailHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public static function getEmails($localMailhogUrl) {
*
* @throws \Exception
*
* @return mixed
* @return string
*/
public static function getBodyOfLastEmail(
$localMailhogUrl, $emailAddress, $waitTimeSec = EMAIL_WAIT_TIMEOUT_SEC
Expand All @@ -75,7 +75,7 @@ public static function getBodyOfLastEmail(
*
* @throws \Exception
*
* @return mixed
* @return string
*/
public static function getBodyOfEmail(
$localMailhogUrl,
Expand Down
4 changes: 2 additions & 2 deletions tests/acceptance/features/bootstrap/EmailContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function assertThatEmailContains($address, PyStringNode $content) {
$expectedContent
);
$emailBody = EmailHelper::getBodyOfLastEmail($this->localMailhogUrl, $address);
Assert::assertContains(
Assert::assertStringContainsString(
$expectedContent,
$emailBody,
"The email address {$address} should have received an email with the body containing {$expectedContent}
Expand All @@ -80,7 +80,7 @@ public function assertThatEmailContains($address, PyStringNode $content) {
*/
public function theResetEmailSenderEmailAddressShouldBe($receiverAddress, $senderAddress) {
$actualSenderAddress = EmailHelper::getSenderOfEmail($this->localMailhogUrl, $receiverAddress);
Assert::assertContains(
Assert::assertStringContainsString(
$senderAddress,
$actualSenderAddress,
"The sender address is expected to be {$senderAddress} but the actual sender is {$actualSenderAddress}"
Expand Down
2 changes: 1 addition & 1 deletion tests/acceptance/features/bootstrap/LoggingContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public function theLastLinesOfTheLogFileShouldContainEntriesWithTheseAttributes(
$message
);
} elseif ($comparingMode === 'containing') {
Assert::assertContains(
Assert::assertStringContainsString(
$expectedLogEntry[$attribute], $logEntry[$attribute],
$message
);
Expand Down
2 changes: 1 addition & 1 deletion tests/acceptance/features/bootstrap/OccContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -2387,7 +2387,7 @@ public function theAdministratorHasClearedTheVersionsForUser($user) {
*/
public function theAdministratorHasClearedTheVersionsForAllUsers() {
$this->deleteAllVersionsForAllUsersUsingTheOccCommand();
Assert::assertContains(
Assert::assertStringContainsString(
"Delete all versions",
\trim($this->featureContext->getStdOutOfOccCommand()),
"Expected 'Delete all versions' to be contained in the output of occ command: "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ public function theCommandOutputOfUserLastSeenShouldBeRecently() {
*/
public function theCommandOutputOfUserLastSeenShouldBeNever() {
$lastOutput = $this->featureContext->getStdOutOfOccCommand();
Assert::assertContains(
Assert::assertStringContainsString(
"has never logged in.",
$lastOutput,
__METHOD__
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ public function theAdministratorDeletesAsATrustedServerUsingTheWebui($url) {
*/
public function aErrorMessageForTrustedServerShouldContain($text) {
$msg = $this->adminSharingSettingsPage->getTrustedServerErrorMsg();
Assert::assertContains(
Assert::assertStringContainsString(
$text,
$msg,
__METHOD__
Expand Down
6 changes: 3 additions & 3 deletions tests/acceptance/features/bootstrap/WebUIFilesContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ public function theThumbnailShouldBeVisibleInTheDetailsPanel() {
$style,
'style attribute of details thumbnail is null'
);
Assert::assertContains(
Assert::assertStringContainsString(
$this->getCurrentFolderFilePath(),
$style,
__METHOD__
Expand Down Expand Up @@ -1557,7 +1557,7 @@ public function checkIfFileFolderIsListedOnTheWebUI(
$name = \implode($name);
}
if ($fileRow === null) {
Assert::assertContains(
Assert::assertStringContainsString(
"could not find file with the name '$name'",
$exceptionMessage,
"found $fileLocationText when it should not be listed"
Expand Down Expand Up @@ -1731,7 +1731,7 @@ public function itShouldNotBePossibleToDeleteFileFolderUsingTheWebUI($name) {
try {
$this->deleteTheFileUsingTheWebUI($name, false);
} catch (ElementNotFoundException $e) {
Assert::assertContains(
Assert::assertStringContainsString(
"could not find button 'Delete' in action Menu",
$e->getMessage(),
__METHOD__
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ public function anErrorShouldBeDisplayedOnTheGeneralExceptionPageWithTitle($titl
* @return void
*/
public function anErrorShouldBeDisplayedOnTheGeneralErrorPageContaining($message) {
Assert::assertContains(
Assert::assertStringContainsString(
$message,
$this->generalExceptionPage->getExceptionMessage(),
__METHOD__
Expand Down
14 changes: 7 additions & 7 deletions tests/acceptance/features/bootstrap/WebUISharingContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ public function thePublicLinkShouldNotHaveBeenGenerated() {
try {
$this->publicShareTab->getLinkUrl($this->linkName);
} catch (Exception $e) {
Assert::assertContains(
Assert::assertStringContainsString(
"could not find link entry with the given name",
$e->getMessage()
);
Expand Down Expand Up @@ -1138,7 +1138,7 @@ public function theUserShouldNotBeAbleToSendTheShareNotificationByEmailUsingTheW
} catch (Exception $e) {
$errorMessage = $e->getMessage();
}
Assert::assertContains(
Assert::assertStringContainsString(
"could not find notify by email button",
$errorMessage,
"User was not expected to be able to send the share notification by email but was"
Expand Down Expand Up @@ -1474,14 +1474,14 @@ public function fileFolderShouldBeMarkedAsSharedBy(
. "' instead."
);
if ($fileOrFolder === "folder") {
Assert::assertContains(
Assert::assertStringContainsString(
"folder-shared.svg",
$row->findThumbnail()->getAttribute("style"),
__METHOD__
. " 'folder-shared.svg' is expected to be contained in the 'style' attribute of the thumbnail of particular row."
);
$detailsDialog = $this->filesPage->getDetailsDialog();
Assert::assertContains(
Assert::assertStringContainsString(
"folder-shared.svg",
$detailsDialog->findThumbnail()->getAttribute("style"),
__METHOD__
Expand Down Expand Up @@ -1668,7 +1668,7 @@ public function thePublicShouldSeeAnErrorMessageWhileAccessingLastCreatedPublicL
$this->generalErrorPage->setPagePath($path);
$this->generalErrorPage->open();
$actualErrorMsg = $this->generalErrorPage->getErrorMessage();
Assert::assertContains(
Assert::assertStringContainsString(
$errorMsg,
$actualErrorMsg,
__METHOD__
Expand Down Expand Up @@ -1765,7 +1765,7 @@ public function createPublicShareLink($name, $settings = null) {
*/
public function theTextPreviewOfThePublicLinkShouldContain($content) {
$previewText = $this->publicLinkFilesPage->getPreviewText();
Assert::assertContains(
Assert::assertStringContainsString(
$content, $previewText,
__METHOD__ . " file preview does not contain expected content"
);
Expand Down Expand Up @@ -1840,7 +1840,7 @@ public function theEmailAddressShouldHaveReceivedAnEmailContainingSharedPublicLi
);
$createdPublicLinks = $this->featureContext->getCreatedPublicLinks();
$lastCreatedPublicLink = \end($createdPublicLinks);
Assert::assertContains(
Assert::assertStringContainsString(
$lastCreatedPublicLink["url"],
$content,
__METHOD__
Expand Down
4 changes: 2 additions & 2 deletions tests/acceptance/features/bootstrap/WebUIUsersContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ public function theAdministratorShouldBeAbleToSeeStorageLocationOfTheseUsers(
$this->featureContext->verifyTableNodeColumns($table, ['username', 'storage location']);
foreach ($table as $row) {
$userStorageLocation = $this->usersPage->getStorageLocationOfUser($row['username']);
Assert::assertContains(
Assert::assertStringContainsString(
$row['storage location'],
$userStorageLocation,
__METHOD__
Expand All @@ -575,7 +575,7 @@ public function theAdministratorShouldBeAbleToSeeLastLoginOfTheseUsers(
foreach ($table as $row) {
$userLastLogin = $this->usersPage->getLastLoginOfUser($row['username']);

Assert::assertContains(
Assert::assertStringContainsString(
$row['last login'],
$userLastLogin,
__METHOD__
Expand Down

0 comments on commit a50a8b8

Please sign in to comment.