Skip to content

Commit f3b058c

Browse files
authored
Merge pull request #18 from pamil/transforming-variadic-arguments
Add test for transforming variadic arguments
2 parents ff870fd + 636186a commit f3b058c

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
Feature: Transforming variadic arguments in step definitions
2+
In order to make Behat steps definitions cleaner and more readable
3+
As a Behat User
4+
I want to have transformed variadic arguments in these
5+
6+
Background:
7+
Given a Behat configuration containing:
8+
"""
9+
default:
10+
extensions:
11+
FriendsOfBehat\VariadicExtension: ~
12+
"""
13+
And a context file "features/bootstrap/FeatureContext.php" containing:
14+
"""
15+
<?php
16+
17+
use Behat\Behat\Context\Context;
18+
19+
class FeatureContext implements Context
20+
{
21+
/**
22+
* @Transform /^(\w+)$/
23+
*/
24+
public function transform($string)
25+
{
26+
return strtoupper($string);
27+
}
28+
29+
/**
30+
* @When /^I pass "(\w+)" and "(\w+)" as arguments$/
31+
*/
32+
public function iPass(...$arguments)
33+
{
34+
printf('Arguments: %s', join(', ', $arguments));
35+
}
36+
}
37+
"""
38+
39+
Scenario: Transforming variadic arguments in step definitions
40+
Given a feature file "features/variadic_arguments_support.feature" containing:
41+
"""
42+
Feature: Transforming variadic arguments in step definitions
43+
44+
Scenario: Transforming variadic arguments in step definitions
45+
When I pass "foo" and "bar" as arguments
46+
"""
47+
When I run Behat
48+
Then it should pass with "Arguments: FOO, BAR"

0 commit comments

Comments
 (0)