Skip to content

Instantly share code, notes, and snippets.

@weaverryan
Created January 22, 2014 23:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save weaverryan/8569663 to your computer and use it in GitHub Desktop.
Save weaverryan/8569663 to your computer and use it in GitHub Desktop.
The Symfony2Extension
<?php
// ...
use Behat\MinkExtension\Context\MinkContext;
use Behat\Symfony2Extension\Context\KernelAwareInterface;
use Symfony\Component\HttpKernel\KernelInterface;
class FeatureContext extends MinkContext implements KernelAwareInterface
{
private $kernel;
/**
* Sets Kernel instance.
*
* @param KernelInterface $kernel HttpKernel instance
*/
public function setKernel(KernelInterface $kernel)
{
$this->kernel = $kernel;
}
/**
* @return \Symfony\Component\DependencyInjection\ContainerInterface
*/
protected function getContainer()
{
return $this->kernel->getContainer();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment