Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Gherkin parser, written in php5.3 for Behat project
PHP

This branch is 65 commits behind master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
bin
src/Behat/Gherkin
tests/Behat/Gherkin
.gitignore
.travis.yml
CHANGES.md
CONTRIBUTING.md
LICENSE
README.md
autoload.php
composer.json
i18n.php
libpath.php
package.xml.tpl
phpdoc.ini.dist
phpunit.xml.dist

README.md

Behat Gherkin Parser

This is the php Gherkin parser for Behat. It comes bundled with more than 40 native languages (see i18n.php) support & clean architecture.

  • 3.1 (3.1 Build
Status) - Latest 3.1 version of the parser.
  • 3.0 (3.0 Build
Status) - Previous 3.0 version of the parser.
  • 2.3 (2.3 Build
Status) - Previous 2.3 version of the parser.

Useful Links

Usage Example

<?php

$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'
    ),
    'en-pirate' => array(
        'feature'          => 'Ahoy matey!',
        'background'       => 'Yo-ho-ho',
        'scenario'         => 'Heave to',
        'scenario_outline' => 'Shiver me timbers',
        'examples'         => 'Dead men tell no tales',
        'given'            => 'Gangway!',
        'when'             => 'Blimey!',
        'then'             => 'Let go and haul',
        'and'              => 'Aye',
        'but'              => 'Avast!'
    )
));
$lexer  = new Behat\Gherkin\Lexer($keywords);
$parser = new Behat\Gherkin\Parser($lexer);

$feature = $parser->parse(file_get_contents('some.feature'));

Installing Dependencies

$> curl http://getcomposer.org/installer | php
$> php composer.phar update

Contributors

Something went wrong with that request. Please try again.