diff --git a/src/Behat/MinkExtension/Context/MinkContext.php b/src/Behat/MinkExtension/Context/MinkContext.php index 5bce09ae..90ea0380 100644 --- a/src/Behat/MinkExtension/Context/MinkContext.php +++ b/src/Behat/MinkExtension/Context/MinkContext.php @@ -29,7 +29,7 @@ class MinkContext extends RawMinkContext implements TranslatableContext */ public function iAmOnHomepage() { - $this->getSession()->visit($this->locatePath('/')); + $this->visitPath('/'); } /** @@ -40,7 +40,7 @@ public function iAmOnHomepage() */ public function visit($page) { - $this->getSession()->visit($this->locatePath($page)); + $this->visitPath($page); } /** diff --git a/src/Behat/MinkExtension/Context/RawMinkContext.php b/src/Behat/MinkExtension/Context/RawMinkContext.php index c4d45ec4..e7c1726c 100644 --- a/src/Behat/MinkExtension/Context/RawMinkContext.php +++ b/src/Behat/MinkExtension/Context/RawMinkContext.php @@ -113,6 +113,17 @@ public function assertSession($name = null) return $this->getMink()->assertSession($name); } + /** + * Visits provided relative path using provided or default session. + * + * @param string $path + * @param string|null $sessionName + */ + public function visitPath($path, $sessionName = null) + { + $this->getSession($sessionName)->visit($this->locatePath($path)); + } + /** * Locates url, based on provided path. * Override to provide custom routing mechanism.