Skip to content

Commit 7fe046d

Browse files
committed
Creating a failing test for FriendsOfBehat#88
1 parent 8d0cec7 commit 7fe046d

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

features/dependency_injection/autowiring_contexts.feature

+41
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,44 @@ Feature: Autowiring contexts
131131
"""
132132
When I run Behat
133133
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 context file "tests/SomeContext.php" containing:
143+
"""
144+
<?php
145+
146+
namespace App\Tests;
147+
148+
use Behat\Behat\Context\Context;
149+
use Symfony\Component\BrowserKit\AbstractBrowser;
150+
151+
final class SomeContext implements Context {
152+
private $client;
153+
154+
public function __construct(?AbstractBrowser $client) { $this->client = $client; }
155+
156+
/** @Then the client should be passed */
157+
public function clientShouldBePassed(): void
158+
{
159+
assert(is_object($this->client));
160+
assert($this->client instanceof AbstractBrowser);
161+
}
162+
}
163+
"""
164+
And a YAML services file containing:
165+
"""
166+
services:
167+
_defaults:
168+
autowire: true
169+
170+
App\Tests\SomeContext:
171+
public: true
172+
"""
173+
When I run Behat
174+
Then it should pass

0 commit comments

Comments
 (0)