Created
June 19, 2012 08:08
-
-
Save jonathaningram/2952919 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
default: | |
extensions: | |
Behat\Symfony2Extension\Extension: ~ | |
Behat\MinkExtension\Extension: | |
base_url: 'http://localadmin.example.com' | |
selenium2: ~ | |
sahi: ~ | |
goutte: ~ | |
default_session: goutte | |
javascript_session: sahi |
This file contains hidden or 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 | |
use Behat\Behat\Context\ClosuredContextInterface; | |
use Behat\Behat\Context\TranslatedContextInterface; | |
use Behat\Behat\Context\BehatContext; | |
use Behat\Behat\Context\Step; | |
use Behat\Behat\Exception\PendingException; | |
use Behat\Gherkin\Node\PyStringNode; | |
use Behat\Mink\Mink; | |
use Behat\MinkExtension\Context\MinkContext; | |
use Behat\MinkExtension\Context\MinkAwareInterface; | |
use Behat\Symfony2Extension\Context\KernelAwareInterface; | |
use Behat\CommonContexts\SymfonyDoctrineContext; | |
use Symfony\Component\HttpKernel\KernelInterface; | |
use Symfony\Component\DependencyInjection\ContainerInterface; | |
require_once 'PHPUnit/Autoload.php'; | |
require_once 'PHPUnit/Framework/Assert/Functions.php'; | |
/** | |
* Features context. | |
*/ | |
class FeatureContext extends BehatContext implements MinkAwareInterface, KernelAwareInterface | |
{ | |
private $mink; | |
private $minkParameters; | |
/** | |
* @var KernelInterface $kernel | |
*/ | |
private $kernel; | |
/** | |
* Initializes context. | |
*/ | |
public function __construct() | |
{ | |
$this->useContext('symfony_doctrine', new SymfonyDoctrineContext()); | |
$this->useContext('mink', new MinkContext()); | |
} | |
/** | |
* {@inheritdoc} | |
*/ | |
public function setMink(Mink $mink) | |
{ | |
$this->mink = $mink; | |
} | |
/** | |
* {@inheritdoc} | |
*/ | |
public function setMinkParameters(array $parameters) | |
{ | |
$this->minkParameters = $parameters; | |
} | |
/** | |
* {@inheritdoc} | |
*/ | |
public function setKernel(KernelInterface $kernel) | |
{ | |
$this->kernel = $kernel; | |
} | |
/** | |
* Returns the kernel's service container. | |
* | |
* @return ContainerInterface | |
*/ | |
public function getContainer() | |
{ | |
return $this->kernel->getContainer(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@everzet wow that's such a comprehensive reply! Thanks! Hopefully you can transform it into a doc article or cookbook entry.
Just tried it out and 2. seems to be working, so thanks very much for your time!