public function setUp() { $keywords = new \Behat\Gherkin\Keywords\ArrayKeywords(array('en' => array('feature' => 'Feature', 'background' => 'Background', 'scenario' => 'Scenario', 'scenario_outline' => 'Scenario Outline|Scenario Template', 'examples' => 'Examples|Scenarios', 'given' => 'Given', 'when' => 'When', 'then' => 'Then', 'and' => 'And', 'but' => 'But'))); $keywords->setLanguage('en'); $lexer = $this->getMock('Behat\\Gherkin\\Lexer', null, array($keywords)); $parser = $this->getMock('Behat\\Gherkin\\Parser', null, array($lexer)); $report = $this->getMock('Hal\\BehatWizard\\Domain\\Entity\\ReportInterface'); $repository = $this->getMock('Hal\\BehatWizard\\Domain\\Repository\\ReportInterface'); $container = $this->getMock('\\Symfony\\Component\\DependencyInjection\\ContainerInterface'); $repository->expects($this->any())->method('getReportByFeature')->will($this->returnValue($report)); $container = $this->getMock('Silex\\Application'); $this->factory = new FeatureFactory($parser, $repository, $container); }
public function initialize() { if ($this->initialized) { return true; } $keywords = new \Behat\Gherkin\Keywords\ArrayKeywords(array('en' => array('feature' => 'Feature', 'background' => 'Background', 'scenario' => 'Scenario', 'scenario_outline' => 'Scenario Outline|Scenario Template', 'examples' => 'Examples|Scenarios', 'given' => 'Given', 'when' => 'When', 'then' => 'Then', 'and' => 'And', 'but' => 'But'))); $keywords->setLanguage('en'); $lexer = new \Behat\Gherkin\Lexer($keywords); $parser = new Parser($lexer); foreach ($this->getParameter('templates') as $template) { foreach (glob($template) as $file) { /** @var $feature \Behat\Gherkin\Node\FeatureNode */ $feature = $parser->parse(file_get_contents($file)); /** @var $scenario \Behat\Gherkin\Node\ScenarioNode */ foreach ($feature->getScenarios() as $scenario) { $this->definitionDispatcher->addDefinition(new \Weavora\MinkExtra\Definition\LazyDefinition($scenario)); } } } $this->initialized = true; return true; }