Skip to content
🍺 Adds variadic arguments support to Behat steps definitions
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
src
.gitattributes
.gitignore
.travis.yml
LICENSE
README.md
behat.yml.dist
composer.json

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.