mirror of
https://github.com/symfony/recipes.git
synced 2026-09-12 15:46:37 +03:00
41 lines
877 B
PHP
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);
|
|
}
|
|
}
|