File tree 2 files changed +46
-0
lines changed
features/dependency_injection
2 files changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -131,3 +131,24 @@ Feature: Autowiring contexts
131
131
"""
132
132
When I run Behat
133
133
Then it should pass
134
+
135
+ Scenario : Autowiring a context with test client
136
+ Given a feature file containing:
137
+ """
138
+ Feature:
139
+ Scenario:
140
+ Then the client should be passed
141
+ """
142
+ And a YAML services file containing:
143
+ """
144
+ services:
145
+ _defaults:
146
+ autowire: true
147
+ bind:
148
+ $client: '@test.client'
149
+
150
+ Tests\Behat\Context\:
151
+ resource: '../../../tests/Behat/Context/TestClientInjectionContext.php'
152
+ """
153
+ When I run Behat
154
+ Then it should pass
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ namespace Tests \Behat \Context ;
6
+
7
+ use Behat \Behat \Context \Context ;
8
+ use Symfony \Component \BrowserKit \AbstractBrowser ;
9
+
10
+ final class TestClientInjectionContext implements Context
11
+ {
12
+ private $ client ;
13
+
14
+ public function __construct (AbstractBrowser $ client )
15
+ {
16
+ $ this ->client = $ client ;
17
+ }
18
+
19
+ /** @Then the client should be passed */
20
+ public function clientShouldBePassed (): void
21
+ {
22
+ assert (is_object ($ this ->client ));
23
+ assert ($ this ->client instanceof AbstractBrowser);
24
+ }
25
+ }
You can’t perform that action at this time.
0 commit comments