Skip to content
🍺 Extension adding variadic arguments support to Behat steps definitions
Gherkin PHP
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
features Add test for transforming variadic arguments Jan 17, 2017
src Make use of PHP 7.1 syntax Jul 10, 2017
.gitattributes Add .gitattributes Jul 10, 2017
.gitignore Initial commit Aug 25, 2016
.travis.yml [Maintenance] Add support for PHP 7.4 Feb 13, 2020
LICENSE Happy new year! Jan 16, 2017
README.md Refresh the package Feb 13, 2019
behat.yml.dist Initial commit Aug 25, 2016
composer.json Allow Symfony 5 Dec 5, 2019

README.md

Variadic Extension License Version Build status on Linux Scrutinizer Quality Score

Adds variadic arguments support to Behat steps definitions.

Usage

  1. Install it:

    $ composer require friends-of-behat/variadic-extension --dev
  2. Enable it in your Behat configuration:

    # behat.yml
    default:
        # ...
        extensions:
            FriendsOfBehat\VariadicExtension: ~
  3. You can use variadic arguments in steps definitions!

    /**
     * @Given the store has( also) :firstProductName and :secondProductName products
     * @Given the store has( also) :firstProductName, :secondProductName and :thirdProductName products
     * @Given the store has( also) :firstProductName, :secondProductName, :thirdProductName and :fourthProductName products
     */
    public function theStoreHasProducts(...$productsNames)
    {
        foreach ($productsNames as $productName) {
            $this->saveProduct($this->createProduct($productName));
        }
    }
You can’t perform that action at this time.