1 | <?php |
||||
2 | /******************************************************************************* |
||||
3 | * This file is part of the GraphQL Bundle package. |
||||
4 | * |
||||
5 | * (c) YnloUltratech <[email protected]> |
||||
6 | * |
||||
7 | * For the full copyright and license information, please view the LICENSE |
||||
8 | * file that was distributed with this source code. |
||||
9 | ******************************************************************************/ |
||||
10 | |||||
11 | namespace Ynlo\GraphQLBundle\Behat\Client; |
||||
12 | |||||
13 | use Behat\Behat\Context\Environment\InitializedContextEnvironment; |
||||
14 | use Behat\Behat\EventDispatcher\Tester\EventDispatchingScenarioTester; |
||||
15 | use Behat\Behat\Tester\Result\StepResult; |
||||
16 | use Behat\Behat\Tester\ScenarioTester; |
||||
17 | use Behat\Behat\Tester\StepTester; |
||||
18 | use Behat\Gherkin\Node\FeatureNode; |
||||
19 | use Behat\Gherkin\Node\ScenarioInterface; |
||||
20 | use Behat\Gherkin\Node\StepNode; |
||||
21 | use Behat\Testwork\Environment\Environment; |
||||
22 | use Behat\Testwork\Tester\Result\TestResult; |
||||
23 | |||||
24 | /** |
||||
25 | * Inject GraphQLClient instance on very context implementing ClientAwareInterface |
||||
26 | */ |
||||
27 | class ClientAwareInitializer implements ScenarioTester |
||||
28 | { |
||||
29 | /** |
||||
30 | * @var StepTester |
||||
31 | */ |
||||
32 | private $baseTester; |
||||
33 | |||||
34 | /** |
||||
35 | * @var GraphQLClient |
||||
36 | */ |
||||
37 | private $client; |
||||
38 | |||||
39 | public function __construct(EventDispatchingScenarioTester $baseTester, GraphQLClient $client) |
||||
40 | { |
||||
41 | $this->baseTester = $baseTester; |
||||
0 ignored issues
–
show
|
|||||
42 | $this->client = $client; |
||||
43 | } |
||||
44 | |||||
45 | public function setUp(Environment $env, FeatureNode $feature, ScenarioInterface $step, $skip) |
||||
46 | { |
||||
47 | return $this->baseTester->setUp($env, $feature, $step, $skip); |
||||
0 ignored issues
–
show
$step of type Behat\Gherkin\Node\ScenarioInterface is incompatible with the type Behat\Gherkin\Node\StepNode expected by parameter $step of Behat\Behat\Tester\StepTester::setUp() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
48 | } |
||||
49 | |||||
50 | public function test(Environment $env, FeatureNode $feature, ScenarioInterface $step, $skip) |
||||
51 | { |
||||
52 | /** @var InitializedContextEnvironment $env */ |
||||
53 | foreach ($env->getContexts() as $context) { |
||||
0 ignored issues
–
show
The method
getContexts() does not exist on Behat\Testwork\Environment\Environment . It seems like you code against a sub-type of Behat\Testwork\Environment\Environment such as Behat\Behat\Context\Envi...lizedContextEnvironment or Behat\Behat\Context\Envi...lizedContextEnvironment .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
54 | if ($context instanceof ClientAwareInterface) { |
||||
55 | $context->setClient($this->client); |
||||
56 | } |
||||
57 | } |
||||
58 | |||||
59 | return $this->baseTester->test($env, $feature, $step, $skip); |
||||
0 ignored issues
–
show
$step of type Behat\Gherkin\Node\ScenarioInterface is incompatible with the type Behat\Gherkin\Node\StepNode expected by parameter $step of Behat\Behat\Tester\StepTester::test() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
60 | } |
||||
61 | |||||
62 | public function tearDown(Environment $env, FeatureNode $feature, ScenarioInterface $step, $skip, TestResult $result) |
||||
63 | { |
||||
64 | return $this->baseTester->tearDown($env, $feature, $step, $skip, $result); |
||||
0 ignored issues
–
show
$step of type Behat\Gherkin\Node\ScenarioInterface is incompatible with the type Behat\Gherkin\Node\StepNode expected by parameter $step of Behat\Behat\Tester\StepTester::tearDown() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
65 | } |
||||
66 | } |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..