diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2021-01-17 18:20:52 +0100 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2021-03-30 08:35:15 +0200 |
commit | b53f49b94062bbbf8de8a10c74af4ed8521919cd (patch) | |
tree | f08183d525657a4e53ea1abdf96bf06d647896d7 /tests/acceptance/features/bootstrap | |
parent | 59d567e8643c9c3a1e8422b7fd203253565df239 (diff) | |
download | nextcloud-server-b53f49b94062bbbf8de8a10c74af4ed8521919cd.tar.gz nextcloud-server-b53f49b94062bbbf8de8a10c74af4ed8521919cd.zip |
Update PHPUnit from 4.X to 6.X in acceptance tests
The PHPUnit update also required an update of "symfony/yaml", so besides
the changes needed for PHPUnit the "behat.yml" file also had to be
adjusted.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'tests/acceptance/features/bootstrap')
17 files changed, 142 insertions, 125 deletions
diff --git a/tests/acceptance/features/bootstrap/AppNavigationContext.php b/tests/acceptance/features/bootstrap/AppNavigationContext.php index 06a1c563b03..ef8cb8cae8b 100644 --- a/tests/acceptance/features/bootstrap/AppNavigationContext.php +++ b/tests/acceptance/features/bootstrap/AppNavigationContext.php @@ -23,6 +23,7 @@ */ use Behat\Behat\Context\Context; +use PHPUnit\Framework\Assert; class AppNavigationContext implements Context, ActorAwareInterface { use ActorAware; @@ -105,7 +106,7 @@ class AppNavigationContext implements Context, ActorAwareInterface { * @Then I see that the current section is :section */ public function iSeeThatTheCurrentSectionIs($section) { - PHPUnit_Framework_Assert::assertEquals($this->actor->find(self::appNavigationCurrentSectionItem(), 10)->getText(), $section); + Assert::assertEquals($this->actor->find(self::appNavigationCurrentSectionItem(), 10)->getText(), $section); } /** @@ -116,7 +117,7 @@ class AppNavigationContext implements Context, ActorAwareInterface { $this->actor, self::appNavigationSectionItemFor($section), $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { - PHPUnit_Framework_Assert::fail("The section $section in the app navigation is not shown yet after $timeout seconds"); + Assert::fail("The section $section in the app navigation is not shown yet after $timeout seconds"); } } @@ -128,7 +129,7 @@ class AppNavigationContext implements Context, ActorAwareInterface { $this->actor, self::appNavigationSectionItemFor($section), $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { - PHPUnit_Framework_Assert::fail("The section $section in the app navigation is still shown after $timeout seconds"); + Assert::fail("The section $section in the app navigation is still shown after $timeout seconds"); } } @@ -136,7 +137,7 @@ class AppNavigationContext implements Context, ActorAwareInterface { * @Then I see that the section :section has a count of :count */ public function iSeeThatTheSectionHasACountOf($section, $count) { - PHPUnit_Framework_Assert::assertEquals($this->actor->find(self::counterForTheSection($section), 10)->getText(), $count); + Assert::assertEquals($this->actor->find(self::counterForTheSection($section), 10)->getText(), $count); } /** @@ -147,7 +148,7 @@ class AppNavigationContext implements Context, ActorAwareInterface { $this->actor, self::counterForTheSection($section), $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { - PHPUnit_Framework_Assert::fail("The counter for section $section is still shown after $timeout seconds"); + Assert::fail("The counter for section $section is still shown after $timeout seconds"); } } } diff --git a/tests/acceptance/features/bootstrap/AppSettingsContext.php b/tests/acceptance/features/bootstrap/AppSettingsContext.php index c9ff57f376c..c7859edcb64 100644 --- a/tests/acceptance/features/bootstrap/AppSettingsContext.php +++ b/tests/acceptance/features/bootstrap/AppSettingsContext.php @@ -23,6 +23,7 @@ */ use Behat\Behat\Context\Context; +use PHPUnit\Framework\Assert; class AppSettingsContext implements Context, ActorAwareInterface { use ActorAware; @@ -92,7 +93,7 @@ class AppSettingsContext implements Context, ActorAwareInterface { $this->actor, self::appSettingsContent(), $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { - PHPUnit_Framework_Assert::fail("The app settings are not open yet after $timeout seconds"); + Assert::fail("The app settings are not open yet after $timeout seconds"); } } } diff --git a/tests/acceptance/features/bootstrap/AppsManagementContext.php b/tests/acceptance/features/bootstrap/AppsManagementContext.php index 332c3b020ec..747ef3d96b5 100644 --- a/tests/acceptance/features/bootstrap/AppsManagementContext.php +++ b/tests/acceptance/features/bootstrap/AppsManagementContext.php @@ -24,6 +24,7 @@ */ use Behat\Behat\Context\Context; +use PHPUnit\Framework\Assert; class AppsManagementContext implements Context, ActorAwareInterface { use ActorAware; @@ -170,7 +171,7 @@ class AppsManagementContext implements Context, ActorAwareInterface { */ public function iSeeThatTheAppHasBeenEnabled($app) { // TODO: Find a way to check if the enable button is removed - PHPUnit_Framework_Assert::assertTrue( + Assert::assertTrue( $this->actor->find(self::disableButtonForApp($app), 10)->isVisible() ); } @@ -180,7 +181,7 @@ class AppsManagementContext implements Context, ActorAwareInterface { */ public function iSeeThatTheAppHasBeenDisabled($app) { // TODO: Find a way to check if the disable button is removed - PHPUnit_Framework_Assert::assertTrue( + Assert::assertTrue( $this->actor->find(self::enableButtonForApp($app), 10)->isVisible() ); } @@ -189,7 +190,7 @@ class AppsManagementContext implements Context, ActorAwareInterface { * @Then /^I see that there are no available updates$/ */ public function iSeeThatThereAreNoAvailableUpdates() { - PHPUnit_Framework_Assert::assertTrue( + Assert::assertTrue( $this->actor->find(self::emptyAppList(), 10)->isVisible() ); } @@ -202,7 +203,7 @@ class AppsManagementContext implements Context, ActorAwareInterface { $this->actor, self::appEntries(), $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { - PHPUnit_Framework_Assert::fail("The apps from the app store were not shown yet after $timeout seconds"); + Assert::fail("The apps from the app store were not shown yet after $timeout seconds"); } } @@ -220,7 +221,7 @@ class AppsManagementContext implements Context, ActorAwareInterface { try { $this->actor->find(self::disableButtonForAnyApp(), 2); - PHPUnit_Framework_Assert::fail("Found enabled apps"); + Assert::fail("Found enabled apps"); } catch (NoSuchElementException $exception) { } } @@ -232,7 +233,7 @@ class AppsManagementContext implements Context, ActorAwareInterface { try { $this->actor->find(self::enableButtonForAnyApp(), 2); - PHPUnit_Framework_Assert::fail("Found disabled apps"); + Assert::fail("Found disabled apps"); } catch (NoSuchElementException $exception) { } } @@ -241,10 +242,10 @@ class AppsManagementContext implements Context, ActorAwareInterface { * @Given /^I see the app bundles$/ */ public function iSeeTheAppBundles() { - PHPUnit_Framework_Assert::assertTrue( + Assert::assertTrue( $this->actor->find(self::rowForApp('Auditing / Logging'), 2)->isVisible() ); - PHPUnit_Framework_Assert::assertTrue( + Assert::assertTrue( $this->actor->find(self::rowForApp('LDAP user and group backend'), 2)->isVisible() ); } @@ -260,7 +261,7 @@ class AppsManagementContext implements Context, ActorAwareInterface { * @Given /^I see that the "([^"]*)" is disabled$/ */ public function iSeeThatTheIsDisabled($bundle) { - PHPUnit_Framework_Assert::assertTrue( + Assert::assertTrue( $this->actor->find(self::enableAllBundleButton($bundle), 2)->isVisible() ); } @@ -276,7 +277,7 @@ class AppsManagementContext implements Context, ActorAwareInterface { $this->actor, self::sidebar(), $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { - PHPUnit_Framework_Assert::fail("The sidebar was not shown yet after $timeout seconds"); + Assert::fail("The sidebar was not shown yet after $timeout seconds"); } } } diff --git a/tests/acceptance/features/bootstrap/CommentsAppContext.php b/tests/acceptance/features/bootstrap/CommentsAppContext.php index 57e60afa60e..577b14b7e72 100644 --- a/tests/acceptance/features/bootstrap/CommentsAppContext.php +++ b/tests/acceptance/features/bootstrap/CommentsAppContext.php @@ -22,6 +22,7 @@ */ use Behat\Behat\Context\Context; +use PHPUnit\Framework\Assert; class CommentsAppContext implements Context, ActorAwareInterface { use ActorAware; @@ -87,7 +88,7 @@ class CommentsAppContext implements Context, ActorAwareInterface { $this->actor, self::emptyContent(), $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { - PHPUnit_Framework_Assert::fail("The no comments message is not visible yet after $timeout seconds"); + Assert::fail("The no comments message is not visible yet after $timeout seconds"); } } @@ -95,7 +96,7 @@ class CommentsAppContext implements Context, ActorAwareInterface { * @Then /^I see a comment with "([^"]*)" as message$/ */ public function iSeeACommentWithAsMessage($commentText) { - PHPUnit_Framework_Assert::assertTrue( + Assert::assertTrue( $this->actor->find(self::commentWithText($commentText), 10)->isVisible()); } @@ -104,7 +105,7 @@ class CommentsAppContext implements Context, ActorAwareInterface { */ public function iSeeThatThereIsNoCommentWithAsMessage($commentText) { try { - PHPUnit_Framework_Assert::assertFalse( + Assert::assertFalse( $this->actor->find(self::commentWithText($commentText))->isVisible()); } catch (NoSuchElementException $exception) { } diff --git a/tests/acceptance/features/bootstrap/ContactsMenuContext.php b/tests/acceptance/features/bootstrap/ContactsMenuContext.php index 860e84fa950..35786062150 100644 --- a/tests/acceptance/features/bootstrap/ContactsMenuContext.php +++ b/tests/acceptance/features/bootstrap/ContactsMenuContext.php @@ -22,6 +22,7 @@ */ use Behat\Behat\Context\Context; +use PHPUnit\Framework\Assert; class ContactsMenuContext implements Context, ActorAwareInterface { use ActorAware; @@ -88,7 +89,7 @@ class ContactsMenuContext implements Context, ActorAwareInterface { * @Then I see that the Contacts menu is shown */ public function iSeeThatTheContactsMenuIsShown() { - PHPUnit_Framework_Assert::assertTrue( + Assert::assertTrue( $this->actor->find(self::contactsMenu(), 10)->isVisible()); } @@ -96,7 +97,7 @@ class ContactsMenuContext implements Context, ActorAwareInterface { * @Then I see that the Contacts menu search input is shown */ public function iSeeThatTheContactsMenuSearchInputIsShown() { - PHPUnit_Framework_Assert::assertTrue( + Assert::assertTrue( $this->actor->find(self::contactsMenuSearchInput(), 10)->isVisible()); } @@ -104,7 +105,7 @@ class ContactsMenuContext implements Context, ActorAwareInterface { * @Then I see that the no results message in the Contacts menu is shown */ public function iSeeThatTheNoResultsMessageInTheContactsMenuIsShown() { - PHPUnit_Framework_Assert::assertTrue( + Assert::assertTrue( $this->actor->find(self::noResultsMessage(), 10)->isVisible()); } @@ -112,7 +113,7 @@ class ContactsMenuContext implements Context, ActorAwareInterface { * @Then I see that the contact :contactName in the Contacts menu is shown */ public function iSeeThatTheContactInTheContactsMenuIsShown($contactName) { - PHPUnit_Framework_Assert::assertTrue( + Assert::assertTrue( $this->actor->find(self::menuItemFor($contactName), 10)->isVisible()); } @@ -123,7 +124,7 @@ class ContactsMenuContext implements Context, ActorAwareInterface { $this->iSeeThatThecontactsMenuIsShown(); try { - PHPUnit_Framework_Assert::assertFalse( + Assert::assertFalse( $this->actor->find(self::menuItemFor($contactName))->isVisible()); } catch (NoSuchElementException $exception) { } @@ -139,7 +140,7 @@ class ContactsMenuContext implements Context, ActorAwareInterface { $this->actor, self::menuItemFor($contactName), $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { - PHPUnit_Framework_Assert::fail("The $contactName contact in Contacts menu is still shown after $timeout seconds"); + Assert::fail("The $contactName contact in Contacts menu is still shown after $timeout seconds"); } } } diff --git a/tests/acceptance/features/bootstrap/DialogContext.php b/tests/acceptance/features/bootstrap/DialogContext.php index cbd02b35553..dea9f434bab 100644 --- a/tests/acceptance/features/bootstrap/DialogContext.php +++ b/tests/acceptance/features/bootstrap/DialogContext.php @@ -22,6 +22,7 @@ */ use Behat\Behat\Context\Context; +use PHPUnit\Framework\Assert; class DialogContext implements Context, ActorAwareInterface { use ActorAware; @@ -58,7 +59,7 @@ class DialogContext implements Context, ActorAwareInterface { $this->actor, self::theDialog(), $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { - PHPUnit_Framework_Assert::fail("The confirmation dialog was not shown yet after $timeout seconds"); + Assert::fail("The confirmation dialog was not shown yet after $timeout seconds"); } } @@ -70,7 +71,7 @@ class DialogContext implements Context, ActorAwareInterface { $this->actor, self::theDialog(), $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { - PHPUnit_Framework_Assert::fail("The confirmation dialog is still shown after $timeout seconds"); + Assert::fail("The confirmation dialog is still shown after $timeout seconds"); } } } diff --git a/tests/acceptance/features/bootstrap/FileListContext.php b/tests/acceptance/features/bootstrap/FileListContext.php index 0b0c80bc272..5f66c0fbbb0 100644 --- a/tests/acceptance/features/bootstrap/FileListContext.php +++ b/tests/acceptance/features/bootstrap/FileListContext.php @@ -22,6 +22,7 @@ */ use Behat\Behat\Context\Context; +use PHPUnit\Framework\Assert; class FileListContext implements Context, ActorAwareInterface { @@ -476,7 +477,7 @@ class FileListContext implements Context, ActorAwareInterface { $this->actor, self::mainWorkingIcon($this->fileListAncestor), $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { - PHPUnit_Framework_Assert::fail("The main working icon for the file list is still shown after $timeout seconds"); + Assert::fail("The main working icon for the file list is still shown after $timeout seconds"); } } @@ -486,7 +487,7 @@ class FileListContext implements Context, ActorAwareInterface { public function iSeeThatTheFileListIsCurrentlyIn($path) { // The text of the breadcrumbs is the text of all the crumbs separated // by white spaces. - PHPUnit_Framework_Assert::assertEquals( + Assert::assertEquals( str_replace('/', ' ', $path), $this->actor->find(self::breadcrumbs($this->fileListAncestor), 10)->getText()); } @@ -496,14 +497,14 @@ class FileListContext implements Context, ActorAwareInterface { public function iSeeThatItIsNotPossibleToCreateNewFiles() { // Once a file list is loaded the "Create" menu button is always in the // DOM, so it is checked if it is visible or not. - PHPUnit_Framework_Assert::assertFalse($this->actor->find(self::createMenuButton($this->fileListAncestor))->isVisible()); + Assert::assertFalse($this->actor->find(self::createMenuButton($this->fileListAncestor))->isVisible()); } /** * @Then I see that the file list contains a file named :fileName */ public function iSeeThatTheFileListContainsAFileNamed($fileName) { - PHPUnit_Framework_Assert::assertNotNull($this->actor->find(self::rowForFile($this->fileListAncestor, $fileName), 10)); + Assert::assertNotNull($this->actor->find(self::rowForFile($this->fileListAncestor, $fileName), 10)); } /** @@ -514,7 +515,7 @@ class FileListContext implements Context, ActorAwareInterface { $this->actor, self::rowForFile($this->fileListAncestor, $fileName), $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { - PHPUnit_Framework_Assert::fail("The file list still contains a file named $fileName after $timeout seconds"); + Assert::fail("The file list still contains a file named $fileName after $timeout seconds"); } } @@ -522,35 +523,35 @@ class FileListContext implements Context, ActorAwareInterface { * @Then I see that :fileName1 precedes :fileName2 in the file list */ public function iSeeThatPrecedesInTheFileList($fileName1, $fileName2) { - PHPUnit_Framework_Assert::assertNotNull($this->actor->find(self::rowForFilePreceding($this->fileListAncestor, $fileName1, $fileName2), 10)); + Assert::assertNotNull($this->actor->find(self::rowForFilePreceding($this->fileListAncestor, $fileName1, $fileName2), 10)); } /** * @Then I see that :fileName is not selected */ public function iSeeThatIsNotSelected($fileName) { - PHPUnit_Framework_Assert::assertFalse($this->actor->find(self::selectionCheckboxInputForFile($this->fileListAncestor, $fileName), 10)->isChecked()); + Assert::assertFalse($this->actor->find(self::selectionCheckboxInputForFile($this->fileListAncestor, $fileName), 10)->isChecked()); } /** * @Then I see that :fileName is marked as favorite */ public function iSeeThatIsMarkedAsFavorite($fileName) { - PHPUnit_Framework_Assert::assertNotNull($this->actor->find(self::favoritedStateIconForFile($this->fileListAncestor, $fileName), 10)); + Assert::assertNotNull($this->actor->find(self::favoritedStateIconForFile($this->fileListAncestor, $fileName), 10)); } /** * @Then I see that :fileName is not marked as favorite */ public function iSeeThatIsNotMarkedAsFavorite($fileName) { - PHPUnit_Framework_Assert::assertNotNull($this->actor->find(self::notFavoritedStateIconForFile($this->fileListAncestor, $fileName), 10)); + Assert::assertNotNull($this->actor->find(self::notFavoritedStateIconForFile($this->fileListAncestor, $fileName), 10)); } /** * @Then I see that :fileName has unread comments */ public function iSeeThatHasUnreadComments($fileName) { - PHPUnit_Framework_Assert::assertTrue($this->actor->find(self::commentActionForFile($this->fileListAncestor, $fileName), 10)->isVisible()); + Assert::assertTrue($this->actor->find(self::commentActionForFile($this->fileListAncestor, $fileName), 10)->isVisible()); } private function waitForRowForFileToBeFullyOpaque($fileName) { @@ -567,7 +568,7 @@ class FileListContext implements Context, ActorAwareInterface { }; if (!Utils::waitFor($fileRowIsFullyOpaqueCallback, $timeout = 2 * $this->actor->getFindTimeoutMultiplier(), $timeoutStep = 1)) { - PHPUnit_Framework_Assert::fail("The row for file $fileName in file list is not fully opaque after $timeout seconds"); + Assert::fail("The row for file $fileName in file list is not fully opaque after $timeout seconds"); } } diff --git a/tests/acceptance/features/bootstrap/FilesAppContext.php b/tests/acceptance/features/bootstrap/FilesAppContext.php index 906a57b9e61..fe93bf194a2 100644 --- a/tests/acceptance/features/bootstrap/FilesAppContext.php +++ b/tests/acceptance/features/bootstrap/FilesAppContext.php @@ -22,6 +22,7 @@ */ use Behat\Behat\Context\Context; +use PHPUnit\Framework\Assert; class FilesAppContext implements Context, ActorAwareInterface { use ActorAware; @@ -295,7 +296,7 @@ class FilesAppContext implements Context, ActorAwareInterface { * @Then I see that the current page is the Files app */ public function iSeeThatTheCurrentPageIsTheFilesApp() { - PHPUnit_Framework_Assert::assertStringStartsWith( + Assert::assertStringStartsWith( $this->actor->locatePath("/apps/files/"), $this->actor->getSession()->getCurrentUrl()); @@ -313,7 +314,7 @@ class FilesAppContext implements Context, ActorAwareInterface { $this->actor, self::detailsView(), $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { - PHPUnit_Framework_Assert::fail("The details view is not open yet after $timeout seconds"); + Assert::fail("The details view is not open yet after $timeout seconds"); } } @@ -325,7 +326,7 @@ class FilesAppContext implements Context, ActorAwareInterface { $this->actor, self::detailsView(), $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { - PHPUnit_Framework_Assert::fail("The details view is not closed yet after $timeout seconds"); + Assert::fail("The details view is not closed yet after $timeout seconds"); } } @@ -333,7 +334,7 @@ class FilesAppContext implements Context, ActorAwareInterface { * @Then I see that the file name shown in the details view is :fileName */ public function iSeeThatTheFileNameShownInTheDetailsViewIs($fileName) { - PHPUnit_Framework_Assert::assertEquals( + Assert::assertEquals( $this->actor->find(self::fileNameInDetailsView(), 10)->getText(), $fileName); } @@ -341,7 +342,7 @@ class FilesAppContext implements Context, ActorAwareInterface { * @Then I see that the file is marked as favorite in the details view */ public function iSeeThatTheFileIsMarkedAsFavoriteInTheDetailsView() { - PHPUnit_Framework_Assert::assertNotNull( + Assert::assertNotNull( $this->actor->find(self::favoritedStateIconInFileDetailsInDetailsView(), 10)); } @@ -349,7 +350,7 @@ class FilesAppContext implements Context, ActorAwareInterface { * @Then I see that the file is not marked as favorite in the details view */ public function iSeeThatTheFileIsNotMarkedAsFavoriteInTheDetailsView() { - PHPUnit_Framework_Assert::assertNotNull( + Assert::assertNotNull( $this->actor->find(self::notFavoritedStateIconInFileDetailsInDetailsView(), 10)); } @@ -357,7 +358,7 @@ class FilesAppContext implements Context, ActorAwareInterface { * @Then I see that the input field for tags in the details view is shown */ public function iSeeThatTheInputFieldForTagsInTheDetailsViewIsShown() { - PHPUnit_Framework_Assert::assertTrue( + Assert::assertTrue( $this->actor->find(self::inputFieldForTagsInDetailsView(), 10)->isVisible()); } @@ -365,7 +366,7 @@ class FilesAppContext implements Context, ActorAwareInterface { * @Then I see that the input field for tags in the details view contains the tag :tag */ public function iSeeThatTheInputFieldForTagsInTheDetailsViewContainsTheTag($tag) { - PHPUnit_Framework_Assert::assertTrue( + Assert::assertTrue( $this->actor->find(self::itemInInputFieldForTagsInDetailsViewForTag($tag), 10)->isVisible()); } @@ -376,7 +377,7 @@ class FilesAppContext implements Context, ActorAwareInterface { $this->iSeeThatTheInputFieldForTagsInTheDetailsViewIsShown(); try { - PHPUnit_Framework_Assert::assertFalse( + Assert::assertFalse( $this->actor->find(self::itemInInputFieldForTagsInDetailsViewForTag($tag))->isVisible()); } catch (NoSuchElementException $exception) { } @@ -386,7 +387,7 @@ class FilesAppContext implements Context, ActorAwareInterface { * @Then I see that the tag :tag in the dropdown for tags in the details view is checked */ public function iSeeThatTheTagInTheDropdownForTagsInTheDetailsViewIsChecked($tag) { - PHPUnit_Framework_Assert::assertTrue( + Assert::assertTrue( $this->actor->find(self::checkmarkInItemInDropdownForTag($tag), 10)->isVisible()); } @@ -394,10 +395,10 @@ class FilesAppContext implements Context, ActorAwareInterface { * @Then I see that the tag :tag in the dropdown for tags in the details view is not checked */ public function iSeeThatTheTagInTheDropdownForTagsInTheDetailsViewIsNotChecked($tag) { - PHPUnit_Framework_Assert::assertTrue( + Assert::assertTrue( $this->actor->find(self::itemInDropdownForTag($tag), 10)->isVisible()); - PHPUnit_Framework_Assert::assertFalse( + Assert::assertFalse( $this->actor->find(self::checkmarkInItemInDropdownForTag($tag))->isVisible()); } @@ -409,7 +410,7 @@ class FilesAppContext implements Context, ActorAwareInterface { $this->actor, self::loadingIconForTabInDetailsViewNamed($tabName), $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { - PHPUnit_Framework_Assert::fail("The $tabName tab in the details view has not been loaded after $timeout seconds"); + Assert::fail("The $tabName tab in the details view has not been loaded after $timeout seconds"); } } } diff --git a/tests/acceptance/features/bootstrap/FilesAppSharingContext.php b/tests/acceptance/features/bootstrap/FilesAppSharingContext.php index 07ebbba1a36..4540d7ae48d 100644 --- a/tests/acceptance/features/bootstrap/FilesAppSharingContext.php +++ b/tests/acceptance/features/bootstrap/FilesAppSharingContext.php @@ -22,6 +22,7 @@ */ use Behat\Behat\Context\Context; +use PHPUnit\Framework\Assert; class FilesAppSharingContext implements Context, ActorAwareInterface { use ActorAware; @@ -513,7 +514,7 @@ class FilesAppSharingContext implements Context, ActorAwareInterface { * @Then I see that the file is shared with me by :sharedByName */ public function iSeeThatTheFileIsSharedWithMeBy($sharedByName) { - PHPUnit_Framework_Assert::assertEquals( + Assert::assertEquals( $this->actor->find(self::sharedByLabel(), 10)->getText(), "Shared with you by $sharedByName"); } @@ -521,7 +522,7 @@ class FilesAppSharingContext implements Context, ActorAwareInterface { * @Then I see that the file is shared with :sharedWithName */ public function iSeeThatTheFileIsSharedWith($sharedWithName) { - PHPUnit_Framework_Assert::assertTrue( + Assert::assertTrue( $this->actor->find(self::sharedWithRow($sharedWithName), 10)->isVisible()); } @@ -533,7 +534,7 @@ class FilesAppSharingContext implements Context, ActorAwareInterface { $this->actor, self::sharedWithRow($sharedWithName), $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { - PHPUnit_Framework_Assert::fail("The shared with $sharedWithName row is still shown after $timeout seconds"); + Assert::fail("The shared with $sharedWithName row is still shown after $timeout seconds"); } } @@ -541,9 +542,9 @@ class FilesAppSharingContext implements Context, ActorAwareInterface { * @Then I see that resharing the file is not allowed */ public function iSeeThatResharingTheFileIsNotAllowed() { - PHPUnit_Framework_Assert::assertEquals( + Assert::assertEquals( $this->actor->find(self::shareWithInput(), 10)->getWrappedElement()->getAttribute("disabled"), "disabled"); - PHPUnit_Framework_Assert::assertEquals( + Assert::assertEquals( $this->actor->find(self::shareWithInput(), 10)->getWrappedElement()->getAttribute("placeholder"), "Resharing is not allowed"); } @@ -555,7 +556,7 @@ class FilesAppSharingContext implements Context, ActorAwareInterface { $this->actor, self::shareLinkAddNewButton(), $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { - PHPUnit_Framework_Assert::fail("The add new share link button is still shown after $timeout seconds"); + Assert::fail("The add new share link button is still shown after $timeout seconds"); } } @@ -566,7 +567,7 @@ class FilesAppSharingContext implements Context, ActorAwareInterface { $this->showShareWithMenuIfNeeded($sharedWithName); $shareWithMenuTriggerElement = $this->actor->find(self::shareWithMenuTrigger($sharedWithName), 10); - PHPUnit_Framework_Assert::assertEquals( + Assert::assertEquals( $this->actor->find(self::canEditCheckboxInput($sharedWithName, $shareWithMenuTriggerElement), 10)->getWrappedElement()->getAttribute("disabled"), "disabled"); } @@ -577,7 +578,7 @@ class FilesAppSharingContext implements Context, ActorAwareInterface { $this->showShareWithMenuIfNeeded($sharedWithName); $shareWithMenuTriggerElement = $this->actor->find(self::shareWithMenuTrigger($sharedWithName), 10); - PHPUnit_Framework_Assert::assertTrue( + Assert::assertTrue( $this->actor->find(self::canEditCheckboxInput($sharedWithName, $shareWithMenuTriggerElement), 10)->isChecked()); } @@ -588,7 +589,7 @@ class FilesAppSharingContext implements Context, ActorAwareInterface { $this->showShareWithMenuIfNeeded($sharedWithName); $shareWithMenuTriggerElement = $this->actor->find(self::shareWithMenuTrigger($sharedWithName), 10); - PHPUnit_Framework_Assert::assertFalse( + Assert::assertFalse( $this->actor->find(self::canEditCheckboxInput($sharedWithName, $shareWithMenuTriggerElement), 10)->isChecked()); } @@ -599,7 +600,7 @@ class FilesAppSharingContext implements Context, ActorAwareInterface { $this->showShareWithMenuIfNeeded($sharedWithName); $shareWithMenuTriggerElement = $this->actor->find(self::shareWithMenuTrigger($sharedWithName), 10); - PHPUnit_Framework_Assert::assertEquals( + Assert::assertEquals( $this->actor->find(self::canCreateCheckboxInput($sharedWithName, $shareWithMenuTriggerElement), 10)->getWrappedElement()->getAttribute("disabled"), "disabled"); } @@ -610,7 +611,7 @@ class FilesAppSharingContext implements Context, ActorAwareInterface { $this->showShareWithMenuIfNeeded($sharedWithName); $shareWithMenuTriggerElement = $this->actor->find(self::shareWithMenuTrigger($sharedWithName), 10); - PHPUnit_Framework_Assert::assertTrue( + Assert::assertTrue( $this->actor->find(self::canCreateCheckboxInput($sharedWithName, $shareWithMenuTriggerElement), 10)->isChecked()); } @@ -621,7 +622,7 @@ class FilesAppSharingContext implements Context, ActorAwareInterface { $this->showShareWithMenuIfNeeded($sharedWithName); $shareWithMenuTriggerElement = $this->actor->find(self::shareWithMenuTrigger($sharedWithName), 10); - PHPUnit_Framework_Assert::assertFalse( + Assert::assertFalse( $this->actor->find(self::canCreateCheckboxInput($sharedWithName, $shareWithMenuTriggerElement), 10)->isChecked()); } @@ -636,7 +637,7 @@ class FilesAppSharingContext implements Context, ActorAwareInterface { $this->actor, self::canReshareCheckbox($sharedWithName, $shareWithMenuTriggerElement), $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { - PHPUnit_Framework_Assert::fail("The resharing checkbox for $sharedWithName is still shown after $timeout seconds"); + Assert::fail("The resharing checkbox for $sharedWithName is still shown after $timeout seconds"); } } @@ -647,7 +648,7 @@ class FilesAppSharingContext implements Context, ActorAwareInterface { $this->showShareWithMenuIfNeeded($sharedWithName); $shareWithMenuTriggerElement = $this->actor->find(self::shareWithMenuTrigger($sharedWithName), 10); - PHPUnit_Framework_Assert::assertTrue( + Assert::assertTrue( $this->actor->find(self::canReshareCheckboxInput($sharedWithName, $shareWithMenuTriggerElement), 10)->isChecked()); } @@ -658,7 +659,7 @@ class FilesAppSharingContext implements Context, ActorAwareInterface { $this->showShareWithMenuIfNeeded($sharedWithName); $shareWithMenuTriggerElement = $this->actor->find(self::shareWithMenuTrigger($sharedWithName), 10); - PHPUnit_Framework_Assert::assertFalse( + Assert::assertFalse( $this->actor->find(self::canReshareCheckboxInput($sharedWithName, $shareWithMenuTriggerElement), 10)->isChecked()); } @@ -669,7 +670,7 @@ class FilesAppSharingContext implements Context, ActorAwareInterface { $this->showShareLinkMenuIfNeeded(); $shareLinkMenuTriggerElement = $this->actor->find(self::shareLinkMenuTrigger(), 10); - PHPUnit_Framework_Assert::assertTrue($this->actor->find(self::hideDownloadCheckboxInput($shareLinkMenuTriggerElement), 10)->isChecked()); + Assert::assertTrue($this->actor->find(self::hideDownloadCheckboxInput($shareLinkMenuTriggerElement), 10)->isChecked()); } /** @@ -679,7 +680,7 @@ class FilesAppSharingContext implements Context, ActorAwareInterface { $this->showShareLinkMenuIfNeeded(); $shareLinkMenuTriggerElement = $this->actor->find(self::shareLinkMenuTrigger(), 10); - PHPUnit_Framework_Assert::assertFalse($this->actor->find(self::hideDownloadCheckboxInput($shareLinkMenuTriggerElement), 10)->isChecked()); + Assert::assertFalse($this->actor->find(self::hideDownloadCheckboxInput($shareLinkMenuTriggerElement), 10)->isChecked()); } /** @@ -708,7 +709,7 @@ class FilesAppSharingContext implements Context, ActorAwareInterface { $this->actor, self::disabledPasswordProtectField($shareLinkMenuTriggerElement), $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { - PHPUnit_Framework_Assert::fail("The password protect field is still disabled after $timeout seconds"); + Assert::fail("The password protect field is still disabled after $timeout seconds"); } } @@ -719,8 +720,8 @@ class FilesAppSharingContext implements Context, ActorAwareInterface { $this->showShareLinkMenuIfNeeded(); $shareLinkMenuTriggerElement = $this->actor->find(self::shareLinkMenuTrigger(), 10); - PHPUnit_Framework_Assert::assertTrue($this->actor->find(self::passwordProtectCheckboxInput($shareLinkMenuTriggerElement), 10)->isChecked(), "Password protect checkbox is checked"); - PHPUnit_Framework_Assert::assertTrue($this->actor->find(self::passwordProtectField($shareLinkMenuTriggerElement), 10)->isVisible(), "Password protect field is visible"); + Assert::assertTrue($this->actor->find(self::passwordProtectCheckboxInput($shareLinkMenuTriggerElement), 10)->isChecked(), "Password protect checkbox is checked"); + Assert::assertTrue($this->actor->find(self::passwordProtectField($shareLinkMenuTriggerElement), 10)->isVisible(), "Password protect field is visible"); } /** @@ -730,7 +731,7 @@ class FilesAppSharingContext implements Context, ActorAwareInterface { $this->showShareLinkMenuIfNeeded(); $shareLinkMenuTriggerElement = $this->actor->find(self::shareLinkMenuTrigger(), 10); - PHPUnit_Framework_Assert::assertTrue($this->actor->find(self::passwordProtectByTalkCheckboxInput($shareLinkMenuTriggerElement), 10)->isChecked()); + Assert::assertTrue($this->actor->find(self::passwordProtectByTalkCheckboxInput($shareLinkMenuTriggerElement), 10)->isChecked()); } /** @@ -740,7 +741,7 @@ class FilesAppSharingContext implements Context, ActorAwareInterface { $this->showShareLinkMenuIfNeeded(); $shareLinkMenuTriggerElement = $this->actor->find(self::shareLinkMenuTrigger(), 10); - PHPUnit_Framework_Assert::assertFalse($this->actor->find(self::passwordProtectByTalkCheckboxInput($shareLinkMenuTriggerElement), 10)->isChecked()); + Assert::assertFalse($this->actor->find(self::passwordProtectByTalkCheckboxInput($shareLinkMenuTriggerElement), 10)->isChecked()); } /** @@ -751,7 +752,7 @@ class FilesAppSharingContext implements Context, ActorAwareInterface { $shareLinkMenuTriggerElement = $this->actor->find(self::shareLinkMenuTrigger(), 10); try { - PHPUnit_Framework_Assert::assertFalse( + Assert::assertFalse( $this->actor->find(self::passwordProtectByTalkCheckbox($shareLinkMenuTriggerElement))->isVisible()); } catch (NoSuchElementException $exception) { } diff --git a/tests/acceptance/features/bootstrap/LoginPageContext.php b/tests/acceptance/features/bootstrap/LoginPageContext.php index bf44d31fb03..e22ee22e743 100644 --- a/tests/acceptance/features/bootstrap/LoginPageContext.php +++ b/tests/acceptance/features/bootstrap/LoginPageContext.php @@ -23,6 +23,7 @@ use Behat\Behat\Context\Context; use Behat\Behat\Hook\Scope\BeforeScenarioScope; +use PHPUnit\Framework\Assert; class LoginPageContext implements Context, ActorAwareInterface { use ActorAware; @@ -90,7 +91,7 @@ class LoginPageContext implements Context, ActorAwareInterface { * @Then I see that the current page is the Login page */ public function iSeeThatTheCurrentPageIsTheLoginPage() { - PHPUnit_Framework_Assert::assertStringStartsWith( + Assert::assertStringStartsWith( $this->actor->locatePath("/login"), $this->actor->getSession()->getCurrentUrl()); } @@ -99,7 +100,7 @@ class LoginPageContext implements Context, ActorAwareInterface { * @Then I see that a wrong password message is shown */ public function iSeeThatAWrongPasswordMessageIsShown() { - PHPUnit_Framework_Assert::assertTrue( + Assert::assertTrue( $this->actor->find(self::wrongPasswordMessage(), 10)->isVisible()); } @@ -107,7 +108,7 @@ class LoginPageContext implements Context, ActorAwareInterface { * @Then I see that the disabled user message is shown */ public function iSeeThatTheDisabledUserMessageIsShown() { - PHPUnit_Framework_Assert::assertTrue( + Assert::assertTrue( $this->actor->find(self::userDisabledMessage(), 10)->isVisible()); } diff --git a/tests/acceptance/features/bootstrap/PublicShareContext.php b/tests/acceptance/features/bootstrap/PublicShareContext.php index 2213cf877f9..2895202ed7f 100644 --- a/tests/acceptance/features/bootstrap/PublicShareContext.php +++ b/tests/acceptance/features/bootstrap/PublicShareContext.php @@ -22,6 +22,7 @@ */ use Behat\Behat\Context\Context; +use PHPUnit\Framework\Assert; class PublicShareContext implements Context, ActorAwareInterface { use ActorAware; @@ -143,7 +144,7 @@ class PublicShareContext implements Context, ActorAwareInterface { * @Then I see that the current page is the Authenticate page for the shared link I wrote down */ public function iSeeThatTheCurrentPageIsTheAuthenticatePageForTheSharedLinkIWroteDown() { - PHPUnit_Framework_Assert::assertEquals( + Assert::assertEquals( $this->actor->getSharedNotebook()["shared link"] . "/authenticate/showShare", $this->actor->getSession()->getCurrentUrl()); } @@ -152,7 +153,7 @@ class PublicShareContext implements Context, ActorAwareInterface { * @Then I see that the current page is the Authenticate page for the direct download shared link I wrote down */ public function iSeeThatTheCurrentPageIsTheAuthenticatePageForTheDirectDownloadSharedLinkIWroteDown() { - PHPUnit_Framework_Assert::assertEquals( + Assert::assertEquals( $this->actor->getSharedNotebook()["shared link"] . "/authenticate/downloadShare", $this->actor->getSession()->getCurrentUrl()); } @@ -161,7 +162,7 @@ class PublicShareContext implements Context, ActorAwareInterface { * @Then I see that the current page is the shared link I wrote down */ public function iSeeThatTheCurrentPageIsTheSharedLinkIWroteDown() { - PHPUnit_Framework_Assert::assertEquals( + Assert::assertEquals( $this->actor->getSharedNotebook()["shared link"], $this->actor->getSession()->getCurrentUrl()); @@ -172,7 +173,7 @@ class PublicShareContext implements Context, ActorAwareInterface { * @Then I see that the current page is the direct download shared link I wrote down */ public function iSeeThatTheCurrentPageIsTheDirectDownloadSharedLinkIWroteDown() { - PHPUnit_Framework_Assert::assertEquals( + Assert::assertEquals( $this->actor->getSharedNotebook()["shared link"] . "/download", $this->actor->getSession()->getCurrentUrl()); } @@ -181,7 +182,7 @@ class PublicShareContext implements Context, ActorAwareInterface { * @Then I see that a wrong password for the shared file message is shown */ public function iSeeThatAWrongPasswordForTheSharedFileMessageIsShown() { - PHPUnit_Framework_Assert::assertTrue( + Assert::assertTrue( $this->actor->find(self::wrongPasswordMessage(), 10)->isVisible()); } @@ -194,19 +195,19 @@ class PublicShareContext implements Context, ActorAwareInterface { // command not having been processed by the browser. if (!WaitFor::elementToBeEventuallyShown( $this->actor, self::shareMenu(), $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { - PHPUnit_Framework_Assert::fail("The Share menu is not visible yet after $timeout seconds"); + Assert::fail("The Share menu is not visible yet after $timeout seconds"); } // The acceptance tests are run in a window wider than the mobile breakpoint, so the // download item should not be shown in the menu (although it will be in // the DOM). - PHPUnit_Framework_Assert::assertFalse( + Assert::assertFalse( $this->actor->find(self::downloadItemInShareMenu())->isVisible(), "Download item in share menu is visible"); - PHPUnit_Framework_Assert::assertTrue( + Assert::assertTrue( $this->actor->find(self::directLinkItemInShareMenu())->isVisible(), "Direct link item in share menu is not visible"); - PHPUnit_Framework_Assert::assertTrue( + Assert::assertTrue( $this->actor->find(self::saveItemInShareMenu())->isVisible(), "Save item in share menu is not visible"); } @@ -216,7 +217,7 @@ class PublicShareContext implements Context, ActorAwareInterface { */ public function iSeeThatTheShareMenuButtonIsNotShown() { try { - PHPUnit_Framework_Assert::assertFalse( + Assert::assertFalse( $this->actor->find(self::shareMenuButton())->isVisible()); } catch (NoSuchElementException $exception) { } @@ -226,7 +227,7 @@ class PublicShareContext implements Context, ActorAwareInterface { * @Then I see that the shared file preview shows the text :text */ public function iSeeThatTheSharedFilePreviewShowsTheText($text) { - PHPUnit_Framework_Assert::assertContains($text, $this->actor->find(self::textPreview(), 10)->getText()); + Assert::assertContains($text, $this->actor->find(self::textPreview(), 10)->getText()); } /** @@ -235,7 +236,7 @@ class PublicShareContext implements Context, ActorAwareInterface { public function iSeeThatTheDownloadButtonIsShown() { if (!WaitFor::elementToBeEventuallyShown( $this->actor, self::downloadButton(), $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { - PHPUnit_Framework_Assert::fail("The download button is not visible yet after $timeout seconds"); + Assert::fail("The download button is not visible yet after $timeout seconds"); } } @@ -244,7 +245,7 @@ class PublicShareContext implements Context, ActorAwareInterface { */ public function iSeeThatTheDownloadButtonIsNotShown() { try { - PHPUnit_Framework_Assert::assertFalse( + Assert::assertFalse( $this->actor->find(self::downloadButton())->isVisible()); } catch (NoSuchElementException $exception) { } diff --git a/tests/acceptance/features/bootstrap/SearchContext.php b/tests/acceptance/features/bootstrap/SearchContext.php index bd4ba2beaef..ba0d9d9933d 100644 --- a/tests/acceptance/features/bootstrap/SearchContext.php +++ b/tests/acceptance/features/bootstrap/SearchContext.php @@ -22,6 +22,7 @@ */ use Behat\Behat\Context\Context; +use PHPUnit\Framework\Assert; class SearchContext implements Context, ActorAwareInterface { use ActorAware; @@ -99,7 +100,7 @@ class SearchContext implements Context, ActorAwareInterface { * @Then I see that the search result :number is :name */ public function iSeeThatTheSearchResultIs($number, $name) { - PHPUnit_Framework_Assert::assertEquals( + Assert::assertEquals( $name, $this->actor->find(self::searchResultName($number), 10)->getText()); } @@ -107,7 +108,7 @@ class SearchContext implements Context, ActorAwareInterface { * @Then I see that the search result :number was found in :path */ public function iSeeThatTheSearchResultWasFoundIn($number, $path) { - PHPUnit_Framework_Assert::assertEquals( + Assert::assertEquals( $path, $this->actor->find(self::searchResultPath($number), 10)->getText()); } } diff --git a/tests/acceptance/features/bootstrap/SettingsContext.php b/tests/acceptance/features/bootstrap/SettingsContext.php index 6b60b2c3176..1e0eadd044a 100644 --- a/tests/acceptance/features/bootstrap/SettingsContext.php +++ b/tests/acceptance/features/bootstrap/SettingsContext.php @@ -22,6 +22,7 @@ */ use Behat\Behat\Context\Context; +use PHPUnit\Framework\Assert; class SettingsContext implements Context, ActorAwareInterface { use ActorAware; @@ -180,7 +181,7 @@ class SettingsContext implements Context, ActorAwareInterface { * @Then I see that shares are accepted by default */ public function iSeeThatSharesAreAcceptedByDefault() { - PHPUnit_Framework_Assert::assertTrue( + Assert::assertTrue( $this->actor->find(self::acceptSharesByDefaultCheckboxInput(), 10)->isChecked()); } @@ -188,7 +189,7 @@ class SettingsContext implements Context, ActorAwareInterface { * @Then I see that resharing is enabled */ public function iSeeThatResharingIsEnabled() { - PHPUnit_Framework_Assert::assertTrue( + Assert::assertTrue( $this->actor->find(self::allowResharingCheckboxInput(), 10)->isChecked()); } @@ -196,7 +197,7 @@ class SettingsContext implements Context, ActorAwareInterface { * @Then I see that resharing is disabled */ public function iSeeThatResharingIsDisabled() { - PHPUnit_Framework_Assert::assertFalse( + Assert::assertFalse( $this->actor->find(self::allowResharingCheckboxInput(), 10)->isChecked()); } @@ -204,7 +205,7 @@ class SettingsContext implements Context, ActorAwareInterface { * @Then I see that username autocompletion is restricted to groups */ public function iSeeThatUsernameAutocompletionIsRestrictedToGroups() { - PHPUnit_Framework_Assert::assertTrue( + Assert::assertTrue( $this->actor->find(self::restrictUsernameAutocompletionToGroupsCheckboxInput(), 10)->isChecked()); } @@ -212,7 +213,7 @@ class SettingsContext implements Context, ActorAwareInterface { * @Then I see that username autocompletion is not restricted to groups */ public function iSeeThatUsernameAutocompletionIsNotRestrictedToGroups() { - PHPUnit_Framework_Assert::assertFalse( + Assert::assertFalse( $this->actor->find(self::restrictUsernameAutocompletionToGroupsCheckboxInput(), 10)->isChecked()); } @@ -220,7 +221,7 @@ class SettingsContext implements Context, ActorAwareInterface { * @Then I see that shares are not accepted by default */ public function iSeeThatSharesAreNotAcceptedByDefault() { - PHPUnit_Framework_Assert::assertFalse( + Assert::assertFalse( $this->actor->find(self::acceptSharesByDefaultCheckboxInput(), 10)->isChecked()); } @@ -228,7 +229,7 @@ class SettingsContext implements Context, ActorAwareInterface { * @Then I see that the button to select tags is shown */ public function iSeeThatTheButtonToSelectTagsIsShown() { - PHPUnit_Framework_Assert::assertTrue($this->actor->find(self::systemTagsSelectTagButton(), 10)->isVisible()); + Assert::assertTrue($this->actor->find(self::systemTagsSelectTagButton(), 10)->isVisible()); } /** @@ -243,7 +244,7 @@ class SettingsContext implements Context, ActorAwareInterface { // necessary to repeatedly open the dropdown until the tag is shown in // the dropdown (or the limit of tries is reached). - PHPUnit_Framework_Assert::assertTrue($this->actor->find(self::systemTagsSelectTagButton(), 10)->isVisible()); + Assert::assertTrue($this->actor->find(self::systemTagsSelectTagButton(), 10)->isVisible()); $actor = $this->actor; @@ -277,6 +278,6 @@ class SettingsContext implements Context, ActorAwareInterface { } } - PHPUnit_Framework_Assert::fail("The dropdown in system tags section in Administration Settings does not contain the tag $tag after $numberOfTries tries"); + Assert::fail("The dropdown in system tags section in Administration Settings does not contain the tag $tag after $numberOfTries tries"); } } diff --git a/tests/acceptance/features/bootstrap/SettingsMenuContext.php b/tests/acceptance/features/bootstrap/SettingsMenuContext.php index 678d7c5eabb..1572dea3faa 100644 --- a/tests/acceptance/features/bootstrap/SettingsMenuContext.php +++ b/tests/acceptance/features/bootstrap/SettingsMenuContext.php @@ -23,6 +23,7 @@ */ use Behat\Behat\Context\Context; +use PHPUnit\Framework\Assert; class SettingsMenuContext implements Context, ActorAwareInterface { use ActorAware; @@ -155,7 +156,7 @@ class SettingsMenuContext implements Context, ActorAwareInterface { * @Then I see that the Settings menu is shown */ public function iSeeThatTheSettingsMenuIsShown() { - PHPUnit_Framework_Assert::assertTrue( + Assert::assertTrue( $this->actor->find(self::settingsMenu(), 10)->isVisible()); } @@ -163,14 +164,14 @@ class SettingsMenuContext implements Context, ActorAwareInterface { * @Then I see that the Settings menu has only :items items */ public function iSeeThatTheSettingsMenuHasOnlyXItems($items) { - PHPUnit_Framework_Assert::assertCount(intval($items), self::menuItems()); + Assert::assertCount(intval($items), self::menuItems()); } /** * @Then I see that the :itemText item in the Settings menu is shown */ public function iSeeThatTheItemInTheSettingsMenuIsShown($itemText) { - PHPUnit_Framework_Assert::assertTrue( + Assert::assertTrue( $this->actor->find(self::menuItemFor($itemText), 10)->isVisible()); } @@ -181,7 +182,7 @@ class SettingsMenuContext implements Context, ActorAwareInterface { $this->iSeeThatTheSettingsMenuIsShown(); try { - PHPUnit_Framework_Assert::assertFalse( + Assert::assertFalse( $this->actor->find(self::menuItemFor($itemText))->isVisible()); } catch (NoSuchElementException $exception) { } @@ -191,7 +192,7 @@ class SettingsMenuContext implements Context, ActorAwareInterface { * @Then I see that the :itemText settings panel is shown */ public function iSeeThatTheItemSettingsPanelIsShown($itemText) { - PHPUnit_Framework_Assert::assertTrue( + Assert::assertTrue( $this->actor->find(self::settingsPanelFor($itemText), 10)->isVisible() ); } @@ -200,7 +201,7 @@ class SettingsMenuContext implements Context, ActorAwareInterface { * @Then I see that the :itemText entry in the settings panel is shown */ public function iSeeThatTheItemEntryInTheSettingsPanelIsShown($itemText) { - PHPUnit_Framework_Assert::assertTrue( + Assert::assertTrue( $this->actor->find(self::settingsPanelEntryFor($itemText), 10)->isVisible() ); } @@ -210,7 +211,7 @@ class SettingsMenuContext implements Context, ActorAwareInterface { */ public function iSeeThatTheItemSettingsPanelIsNotShown($itemText) { try { - PHPUnit_Framework_Assert::assertFalse( + Assert::assertFalse( $this->actor->find(self::settingsPanelFor($itemText), 10)->isVisible() ); } catch (NoSuchElementException $exception) { diff --git a/tests/acceptance/features/bootstrap/ThemingAppContext.php b/tests/acceptance/features/bootstrap/ThemingAppContext.php index de25bafd6c3..70fb2b01e16 100644 --- a/tests/acceptance/features/bootstrap/ThemingAppContext.php +++ b/tests/acceptance/features/bootstrap/ThemingAppContext.php @@ -22,6 +22,7 @@ */ use Behat\Behat\Context\Context; +use PHPUnit\Framework\Assert; class ThemingAppContext implements Context, ActorAwareInterface { use ActorAware; @@ -88,7 +89,7 @@ class ThemingAppContext implements Context, ActorAwareInterface { // background of the input element, it means the color element has been // initialized. - PHPUnit_Framework_Assert::assertTrue($this->actor->find(self::inputFieldFor("Color"), 10)->isVisible()); + Assert::assertTrue($this->actor->find(self::inputFieldFor("Color"), 10)->isVisible()); $actor = $this->actor; @@ -103,7 +104,7 @@ class ThemingAppContext implements Context, ActorAwareInterface { }; if (!Utils::waitFor($colorSelectorLoadedCallback, $timeout = 10 * $this->actor->getFindTimeoutMultiplier(), $timeoutStep = 1)) { - PHPUnit_Framework_Assert::fail("The color selector in Theming app has not been loaded after $timeout seconds"); + Assert::fail("The color selector in Theming app has not been loaded after $timeout seconds"); } } @@ -117,7 +118,7 @@ class ThemingAppContext implements Context, ActorAwareInterface { // HEX Color, convert to RGB array. $tmpColor = sscanf($color, "%02X%02X%02X"); } else { - PHPUnit_Framework_Assert::fail("The acceptance test does not know how to handle the color string : '$color'. " + Assert::fail("The acceptance test does not know how to handle the color string : '$color'. " . "Please provide # before HEX colors in your features."); } return $tmpColor; @@ -136,7 +137,7 @@ class ThemingAppContext implements Context, ActorAwareInterface { }; if (!Utils::waitFor($headerColorMatchesCallback, $timeout = 10 * $this->actor->getFindTimeoutMultiplier(), $timeoutStep = 1)) { - PHPUnit_Framework_Assert::fail("The header color is not $color yet after $timeout seconds"); + Assert::fail("The header color is not $color yet after $timeout seconds"); } } @@ -144,7 +145,7 @@ class ThemingAppContext implements Context, ActorAwareInterface { * @Then I see that the parameters in the Theming app are eventually saved */ public function iSeeThatTheParametersInTheThemingAppAreEventuallySaved() { - PHPUnit_Framework_Assert::assertTrue($this->actor->find(self::statusMessage(), 10)->isVisible()); + Assert::assertTrue($this->actor->find(self::statusMessage(), 10)->isVisible()); $actor = $this->actor; @@ -157,7 +158,7 @@ class ThemingAppContext implements Context, ActorAwareInterface { }; if (!Utils::waitFor($savedStatusMessageShownCallback, $timeout = 10 * $this->actor->getFindTimeoutMultiplier(), $timeoutStep = 1)) { - PHPUnit_Framework_Assert::fail("The 'Saved' status messages in Theming app has not been shown after $timeout seconds"); + Assert::fail("The 'Saved' status messages in Theming app has not been shown after $timeout seconds"); } } } diff --git a/tests/acceptance/features/bootstrap/ToastContext.php b/tests/acceptance/features/bootstrap/ToastContext.php index 5a67d7f2581..3dc941901c1 100644 --- a/tests/acceptance/features/bootstrap/ToastContext.php +++ b/tests/acceptance/features/bootstrap/ToastContext.php @@ -22,6 +22,7 @@ */ use Behat\Behat\Context\Context; +use PHPUnit\Framework\Assert; class ToastContext implements Context, ActorAwareInterface { use ActorAware; @@ -47,7 +48,7 @@ class ToastContext implements Context, ActorAwareInterface { * @Then I see that the :message toast is shown */ public function iSeeThatTheToastIsShown($message) { - PHPUnit_Framework_Assert::assertTrue($this->actor->find( + Assert::assertTrue($this->actor->find( self::toastMessage($message), 10)->isVisible()); } } diff --git a/tests/acceptance/features/bootstrap/UsersSettingsContext.php b/tests/acceptance/features/bootstrap/UsersSettingsContext.php index 6b0aa787791..02e1825e4c9 100644 --- a/tests/acceptance/features/bootstrap/UsersSettingsContext.php +++ b/tests/acceptance/features/bootstrap/UsersSettingsContext.php @@ -24,6 +24,7 @@ */ use Behat\Behat\Context\Context; +use PHPUnit\Framework\Assert; class UsersSettingsContext implements Context, ActorAwareInterface { use ActorAware; @@ -271,7 +272,7 @@ class UsersSettingsContext implements Context, ActorAwareInterface { $this->actor, self::rowForUser($user), $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { - PHPUnit_Framework_Assert::fail("The user $user in the list of users is not shown yet after $timeout seconds"); + Assert::fail("The user $user in the list of users is not shown yet after $timeout seconds"); } } @@ -283,7 +284,7 @@ class UsersSettingsContext implements Context, ActorAwareInterface { $this->actor, self::rowForUser($user), $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { - PHPUnit_Framework_Assert::fail("The user $user in the list of users is still shown after $timeout seconds"); + Assert::fail("The user $user in the list of users is still shown after $timeout seconds"); } } @@ -291,7 +292,7 @@ class UsersSettingsContext implements Context, ActorAwareInterface { * @Then I see that the new user form is shown */ public function iSeeThatTheNewUserFormIsShown() { - PHPUnit_Framework_Assert::assertTrue( + Assert::assertTrue( $this->actor->find(self::newUserForm(), 10)->isVisible()); } @@ -299,7 +300,7 @@ class UsersSettingsContext implements Context, ActorAwareInterface { * @Then I see that the :action action in the :user actions menu is shown */ public function iSeeTheAction($action, $user) { - PHPUnit_Framework_Assert::assertTrue( + Assert::assertTrue( $this->actor->find(self::theAction($action, $user), 10)->isVisible()); } @@ -307,7 +308,7 @@ class UsersSettingsContext implements Context, ActorAwareInterface { * @Then I see that the :column column is shown */ public function iSeeThatTheColumnIsShown($column) { - PHPUnit_Framework_Assert::assertTrue( + Assert::assertTrue( $this->actor->find(self::theColumn($column), 10)->isVisible()); } @@ -315,7 +316,7 @@ class UsersSettingsContext implements Context, ActorAwareInterface { * @Then I see that the :field of :user is :value */ public function iSeeThatTheFieldOfUserIs($field, $user, $value) { - PHPUnit_Framework_Assert::assertEquals( + Assert::assertEquals( $this->actor->find(self::inputForUserInCell($field, $user), 10)->getValue(), $value); } @@ -323,7 +324,7 @@ class UsersSettingsContext implements Context, ActorAwareInterface { * @Then I see that the display name for the user :user is :displayName */ public function iSeeThatTheDisplayNameForTheUserIs($user, $displayName) { - PHPUnit_Framework_Assert::assertEquals( + Assert::assertEquals( $displayName, $this->actor->find(self::displayNameCellForUser($user), 10)->getValue()); } @@ -349,7 +350,7 @@ class UsersSettingsContext implements Context, ActorAwareInterface { $this->actor, self::classCellForUser($cell . ' icon-loading-small', $user), $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { - PHPUnit_Framework_Assert::fail("The loading icon for user $user is still shown after $timeout seconds"); + Assert::fail("The loading icon for user $user is still shown after $timeout seconds"); } } @@ -357,7 +358,7 @@ class UsersSettingsContext implements Context, ActorAwareInterface { * @Then I see that the user quota of :user is :quota */ public function iSeeThatTheuserQuotaIs($user, $quota) { - PHPUnit_Framework_Assert::assertEquals( + Assert::assertEquals( $this->actor->find(self::selectedSelectOption('quota', $user), 2)->getText(), $quota); } @@ -369,7 +370,7 @@ class UsersSettingsContext implements Context, ActorAwareInterface { $this->actor, self::editModeOn($user), $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { - PHPUnit_Framework_Assert::fail("The edit mode for user $user in the list of users is not on yet after $timeout seconds"); + Assert::fail("The edit mode for user $user in the list of users is not on yet after $timeout seconds"); } } } |