Skip to content

Instantly share code, notes, and snippets.

@everzet everzet/gherkin_usage.php

Last active Aug 29, 2015
What would you like to do?
Usage of Behat\Gherkin 2.3
$keywords = new Behat\Gherkin\Keywords\CachedArrayKeywords('/path/to/gherkin_lib/i18n.php');
$lexer = new Behat\Gherkin\Lexer($keywords);
$parser = new Behat\Gherkin\Parser($lexer);
$gherkin = new Behat\Gherkin();
$gherkin->addLoader(new Behat\Gherkin\Loader\DirectoryLoader($gherkin));
$gherkin->addLoader(new Behat\Gherkin\Loader\GherkinFileLoader($parser));
$gherkin->setBasePath(__DIR__ . '/features');
* @var FeatureNode[]
* @see
$features = $gherkin->load('/absolute/path/to/your.feature'); // feature at absolute path
$features = $gherkin->load('relative/path/to/your.feature'); // feature at relative path (relative to base path)
$features = $gherkin->load('relative/path/to/your.feature:25'); // feature with all scenarios removed except one starting at line 25
$features = $gherkin->load('some/feature/directory'); // all features in provided directory

This comment has been minimized.

Copy link

naxhh commented Apr 8, 2014

Idk if is my set-up but this: $gherkin = new Behat\Gherkin(); for me is:

$gherkin = new Behat\Gherkin\Gherkin();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.