diff --git a/composer.json b/composer.json index 80d39463..082e02e6 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ "homepage": "https://github.com/FriendsOfBehat/MinkExtension#readme", "require": { "php": "^7.4 || ^8", - "behat/behat": "^3.0.5", + "behat/behat": "^3.10", "behat/mink": "^1.5", "symfony/config": "^4.4 || ^5.0 || ^6.0 || ^7.0" }, diff --git a/src/Behat/MinkExtension/Context/MinkContext.php b/src/Behat/MinkExtension/Context/MinkContext.php index c6eeb0f4..b1f5ff62 100644 --- a/src/Behat/MinkExtension/Context/MinkContext.php +++ b/src/Behat/MinkExtension/Context/MinkContext.php @@ -12,6 +12,9 @@ use Behat\Behat\Context\TranslatableContext; use Behat\Gherkin\Node\TableNode; +use Behat\Step\Given; +use Behat\Step\Then; +use Behat\Step\When; /** * Mink context for Behat BDD tool. @@ -26,10 +29,9 @@ class MinkContext extends RawMinkContext implements TranslatableContext * Example: Given I am on "/" * Example: When I go to "/" * Example: And I go to "/" - * - * @Given /^(?:|I )am on (?:|the )homepage$/ - * @When /^(?:|I )go to (?:|the )homepage$/ */ + #[Given('/^(?:|I )am on (?:|the )homepage$/')] + #[When('/^(?:|I )go to (?:|the )homepage$/')] public function iAmOnHomepage() { $this->visitPath('/'); @@ -40,10 +42,9 @@ public function iAmOnHomepage() * Example: Given I am on "http://batman.com" * Example: And I am on "/articles/isBatmanBruceWayne" * Example: When I go to "/articles/isBatmanBruceWayne" - * - * @Given /^(?:|I )am on "(?P[^"]+)"$/ - * @When /^(?:|I )go to "(?P[^"]+)"$/ */ + #[Given('/^(?:|I )am on "(?P[^"]+)"$/')] + #[When('/^(?:|I )go to "(?P[^"]+)"$/')] public function visit($page) { $this->visitPath($page); @@ -53,9 +54,8 @@ public function visit($page) * Reloads current page * Example: When I reload the page * Example: And I reload the page - * - * @When /^(?:|I )reload the page$/ */ + #[When('/^(?:|I )reload the page$/')] public function reload() { $this->getSession()->reload(); @@ -64,9 +64,8 @@ public function reload() /** * Moves backward one page in history * Example: When I move backward one page - * - * @When /^(?:|I )move backward one page$/ */ + #[When('/^(?:|I )move backward one page$/')] public function back() { $this->getSession()->back(); @@ -75,9 +74,8 @@ public function back() /** * Moves forward one page in history * Example: And I move forward one page - * - * @When /^(?:|I )move forward one page$/ */ + #[When('/^(?:|I )move forward one page$/')] public function forward() { $this->getSession()->forward(); @@ -87,9 +85,8 @@ public function forward() * Presses button with specified id|name|title|alt|value * Example: When I press "Log In" * Example: And I press "Log In" - * - * @When /^(?:|I )press "(?P