Skip to content

Commit

Permalink
Creating a failing test for FriendsOfBehat#88
Browse files Browse the repository at this point in the history
  • Loading branch information
DonCallisto committed Jun 18, 2020
1 parent 8d0cec7 commit 7e13510
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions features/dependency_injection/autowiring_contexts.feature
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,48 @@ Feature: Autowiring contexts
"""
When I run Behat
Then it should pass

Scenario: Autowiring a context with test client
Given a feature file containing:
"""
Feature:
Scenario:
Then the client should be passed
"""
And a context file "tests/SomeContext.php" containing:
"""
<?php
namespace App\Tests;
use Behat\Behat\Context\Context;
use Symfony\Component\BrowserKit\AbstractBrowser;
final class SomeContext implements Context
{
private $client;
public function __construct(AbstractBrowser $client) { $this->client = $client; }
/** @Then the client should be passed */
public function clientShouldBePassed(): void
{
assert(is_object($this->client));
assert($this->client instanceof AbstractBrowser);
}
}
"""
And a YAML services file containing:
"""
services:
_defaults:
autowire: true
autoconfigure: true
bind:
$client: '@test.client'
App\Tests\:
resource: '../tests/*'
"""
When I run Behat
Then it should pass

0 comments on commit 7e13510

Please sign in to comment.