<?php namespace Application\Bundle\ApiBundle\Features\Context; use Application\Bundle\ApiBundle\Listener\ConsoleEventSubscriber; use MFB\Behat\Context\KernelAwareFeatureContext; use MFB\Behat\Subcontext\CommandContext; use MFB\Behat\Subcontext\ResponseContext; use VIPSoft\DoctrineDataFixturesExtension\Context\FixtureAwareContextInterface; /** * Feature context. */ class FeatureContext extends KernelAwareFeatureContext implements FixtureAwareContextInterface { /** * This method should return an array of FQCN DataFixture class names. * * @return array */ public function getFixtures() { return array( 'MFB\DataFixturesBundle\DataFixtures\ORM\SomeFixture', 'MFB\DataFixturesBundle\DataFixtures\ORM\AnotherFixture' ); } /** * @BeforeScenario */ public function beforeScenario() { $this ->getSession() ->setRequestHeader('HTTP_ACCEPT', 'application/json,text/html') ; } /** * @param array $parameters */ public function __construct($parameters) { $this->useContext('response', new ResponseContext($parameters)); $this->useContext( 'command', new CommandContext( 'Symfony\Bundle\FrameworkBundle\Console\Application', array( 'mfb:test:exception:command' => 'Application\Bundle\ApiBundle\Tests\Stub\ExceptionThrowingCommand', 'mfb:test:failing:command' => 'Application\Bundle\ApiBundle\Tests\Stub\FailingCommand' ), array( 'subscriber' => array( new ConsoleEventSubscriber() ) ) )); } }