Created
August 13, 2011 15:00
-
-
Save everzet/1143930 to your computer and use it in GitHub Desktop.
How to use MinkContext inside BehatBundle as subcontext
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Acme\DemoBundle\Features\Context; | |
use Behat\BehatBundle\Context\BehatContext, | |
Behat\Behat\Exception\PendingException; | |
use Behat\Gherkin\Node\PyStringNode, | |
Behat\Gherkin\Node\TableNode; | |
/** | |
* Feature context. | |
*/ | |
class FeatureContext extends BehatContext | |
{ | |
/** | |
* BehatBundle's main context constructor gets | |
* KernelInterface instance as single parameter | |
*/ | |
public function __construct($kernel) | |
{ | |
// Instantiate and use BehatBundle's MinkContext with provided $kernel | |
$this->useContext('mink', new MinkContext($kernel)); | |
} | |
/** | |
* Get Mink session from MinkContext | |
*/ | |
public function getSession($name = null) | |
{ | |
reutrn $this->getSubcontext('mink')->getSession($name); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Acme\DemoBundle\Features\Context; | |
use Behat\BehatBundle\Context\MinkContext as BaseMinkContext, | |
Behat\Behat\Exception\PendingException; | |
use Behat\Gherkin\Node\PyStringNode, | |
Behat\Gherkin\Node\TableNode; | |
/** | |
* Mink-enabled context. | |
*/ | |
class MinkContext extends BaseMinkContext | |
{ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You have a typo in
Also thank you for your work on Behat/Mink