Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Gherkin parser, written in php5.3 for Behat project

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 bin
Octocat-spinner-32 i18n
Octocat-spinner-32 src
Octocat-spinner-32 tests
Octocat-spinner-32 .gitignore added composer files to ignore December 01, 2011
Octocat-spinner-32 .travis.yml
Octocat-spinner-32 CHANGES.md
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.md
Octocat-spinner-32 autoload.php
Octocat-spinner-32 composer.json
Octocat-spinner-32 libpath.php release script February 15, 2011
Octocat-spinner-32 package.xml.tpl
Octocat-spinner-32 phpdoc.ini.dist initial commit January 04, 2011
Octocat-spinner-32 phpunit.xml.dist
README.md

Behat Gherkin Parser

Build Status

This is the new Gherkin parser for Behat. It comes bundled with more than 40 native languages (see i18n) support & much cleaner architecture than previous one.

Gherkin parser from now on will be separate project from Behat core itself and has no foreign dependencies, which means, that you can use it in your DSL-specific projects.

Usage

<?php

$keywords = new Behat\Gherkin\Keywords\ArrayKeywords(array(
    'en' => array(
        'Feature'           => 'Feature',
        'Background'        => 'Background',
        'Scenario'          => 'Scenario',
        'Scenario Outline'  => 'Scenario Outline',
        'Examples'          => 'Examples',
        'Step Types'        => 'Given|When|Then|And|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',
        'Step Types'        => 'Let go and haul|Gangway!|Blimey!|Avast!|Aye'
    )
));
$lexer  = new Behat\Gherkin\Lexer($keywords);
$parser = new Behat\Gherkin\Parser($lexer);

$arrayOfFeatures = $parser->parse('/path/to/file.feature OR feature itself');

Note on Patches/Pull Requests

  • Fork the project develop branch (all new development happens here, master for releases & hotfixes only).
  • Make your feature addition or bug fix.
  • Add unit tests for it (look at tests/Behat/Gherkin for examples). This is important so I don't break it in a future version unintentionally.
  • Commit
  • Send me a pull request.

Running tests

phpunit

If you get errors about missing dependencies - just install them

wget -nc http://getcomposer.org/composer.phar
php composer.phar update

Gherkin Parser itself has no required dependencies, but test suite has.

Copyright

Copyright (c) 2010 Konstantin Kudryashov (ever.zet). See LICENSE for details.

Contributors

  • Konstantin Kudryashov everzet [lead developer]
Something went wrong with that request. Please try again.