Skip to content

Commit 7e13510

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

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

features/dependency_injection/autowiring_contexts.feature

+45
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,48 @@ 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+
{
153+
private $client;
154+
155+
public function __construct(AbstractBrowser $client) { $this->client = $client; }
156+
157+
/** @Then the client should be passed */
158+
public function clientShouldBePassed(): void
159+
{
160+
assert(is_object($this->client));
161+
assert($this->client instanceof AbstractBrowser);
162+
}
163+
}
164+
"""
165+
And a YAML services file containing:
166+
"""
167+
services:
168+
_defaults:
169+
autowire: true
170+
autoconfigure: true
171+
bind:
172+
$client: '@test.client'
173+
174+
App\Tests\:
175+
resource: '../tests/*'
176+
"""
177+
When I run Behat
178+
Then it should pass

0 commit comments

Comments
 (0)