-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from pamil/naming-things-vol-2
Split features, rework naming & implementation
- Loading branch information
Showing
3 changed files
with
104 additions
and
64 deletions.
There are no files selected for viewing
64 changes: 0 additions & 64 deletions
64
features/using_variadic_arguments_in_behat_steps_definitions.feature
This file was deleted.
Oops, something went wrong.
52 changes: 52 additions & 0 deletions
52
features/using_variadic_arguments_in_steps_definitions_with_named_parameters.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
52 changes: 52 additions & 0 deletions
52
features/using_variadic_arguments_in_steps_definitions_with_not_named_parameters.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |