Last active
August 29, 2015 13:58
-
-
Save everzet/10065352 to your computer and use it in GitHub Desktop.
Usage of Behat\Gherkin 2.3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$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 https://github.com/Behat/Gherkin/blob/2.3/src/Behat/Gherkin/Node/FeatureNode.php | |
*/ | |
$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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Idk if is my set-up but this: $gherkin = new Behat\Gherkin(); for me is:
$gherkin = new Behat\Gherkin\Gherkin();