Skip to content

Commit

Permalink
Merge pull request #10 from pamil/naming-things-vol-2
Browse files Browse the repository at this point in the history
Split features, rework naming & implementation
  • Loading branch information
lchrusciel committed Aug 25, 2016
2 parents 0ad380c + d6ccedb commit d85fcc0
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 64 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
Feature: Using variadic arguments in steps definitions with named parameters
In order to make Behat steps definitions cleaner and more readable
As a Behat User
I want to use variadic arguments in these

Background:
Given a Behat configuration containing:
"""
default:
extensions:
FriendsOfBehat\VariadicExtension: ~
"""
And a context file "features/bootstrap/FeatureContext.php" containing:
"""
<?php
use Behat\Behat\Context\Context;
class FeatureContext implements Context
{
/**
* @When I pass :firstArgument and :secondArgument as arguments
* @When I pass :firstArgument, :secondArgument and :thirdArgument as arguments
*/
public function iPass(...$arguments)
{
printf('Number of passed arguments: %d', count($arguments));
}
}
"""

Scenario: Using two variadic arguments as the only ones
Given a feature file "features/variadics_arguments_support.feature" containing:
"""
Feature: Passing arguments
Scenario: Passing two arguments
When I pass "foo" and "bar" as arguments
"""
When I run Behat
Then it should pass with "Number of passed arguments: 2"

Scenario: Using three variadic arguments as the only ones
Given a feature file "features/variadics_arguments_support.feature" containing:
"""
Feature: Passing arguments
Scenario: Passing three arguments
When I pass "foo", "bar" and "baz" as arguments
"""
When I run Behat
Then it should pass with "Number of passed arguments: 3"
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
Feature: Using variadic arguments in Behat steps definitions with not named parameters
In order to make Behat steps definitions cleaner and more readable
As a Behat User
I want to use variadic arguments in these

Background:
Given a Behat configuration containing:
"""
default:
extensions:
FriendsOfBehat\VariadicExtension: ~
"""
And a context file "features/bootstrap/FeatureContext.php" containing:
"""
<?php
use Behat\Behat\Context\Context;
class FeatureContext implements Context
{
/**
* @When /^I pass "(\w+)" and "(\w+)" as arguments$/
* @When /^I pass "(\w+)", "(\w+)" and "(\w+)" as arguments$/
*/
public function iPass(...$arguments)
{
printf('Number of passed arguments: %d', count($arguments));
}
}
"""

Scenario: Using two variadic arguments as the only ones
Given a feature file "features/variadic_arguments_support.feature" containing:
"""
Feature: Passing arguments
Scenario: Passing two arguments
When I pass "foo" and "bar" as arguments
"""
When I run Behat
Then it should pass with "Number of passed arguments: 2"

Scenario: Using three variadic arguments as the only ones
Given a feature file "features/variadic_arguments_support.feature" containing:
"""
Feature: Passing arguments
Scenario: Passing three arguments
When I pass "foo", "bar" and "baz" as arguments
"""
When I run Behat
Then it should pass with "Number of passed arguments: 3"

0 comments on commit d85fcc0

Please sign in to comment.