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 7fe046d
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions features/dependency_injection/autowiring_contexts.feature
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,44 @@ 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
App\Tests\SomeContext:
public: true
"""
When I run Behat
Then it should pass

0 comments on commit 7fe046d

Please sign in to comment.