Add more sanity checks

This commit is contained in:
Kamil Kokot
2019-02-12 23:42:41 +01:00
parent 9e9529c320
commit d74cd251d5
4 changed files with 120 additions and 34 deletions

View File

@@ -0,0 +1,56 @@
Feature: Context constructor dependency injection compatibility
Scenario: Using context consturctor dependency injection
Given a working Symfony application with SymfonyExtension configured
And a Behat configuration containing:
"""
default:
suites:
default:
contexts:
- App\Tests\SomeContext:
- "@App\\Foo"
services:
App\Foo: ~
"""
And a class file "src/Foo.php" containing:
"""
<?php
namespace App;
final class Foo
{
}
"""
And a feature file containing:
"""
Feature:
Scenario:
Then it should pass
"""
And a context file "tests/SomeContext.php" containing:
"""
<?php
namespace App\Tests;
use App\Foo;
use Behat\Behat\Context\Context;
final class SomeContext implements Context {
public function __construct(Foo $foo)
{
$this->foo = $foo;
}
/** @Then it should pass */
public function itShouldPass(): void
{
assert($this->foo instanceof Foo);
}
}
"""
When I run Behat
Then it should pass