Files
symfony-flex-recipes/behat/symfony2-extension/2.1/features/bootstrap/FeatureContext.php
T
2017-06-05 19:14:00 +01:00

41 lines
877 B
PHP

<?php
use Behat\Behat\Context\Context;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\KernelInterface;
class FeatureContext implements Context
{
/**
* @var KernelInterface
*/
private $kernel;
/**
* @var Response|null
*/
private $response;
public function __construct(KernelInterface $kernel)
{
$this->kernel = $kernel;
}
/**
* @When this is a demo scenario that sends a request to :path
*/
public function thisIsADemoScenarioThatSendsARequestTo(string $path)
{
$this->response = $this->kernel->handle(Request::create($path, 'GET'));
}
/**
* @Then the response should be received
*/
public function theResponseShouldBeReceived()
{
assert($this->response !== null);
}
}