We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
1 | <?php |
||
15 | class ExecutorTest extends TestCase |
||
16 | { |
||
17 | /** @var RequestExecutor */ |
||
18 | private $executor; |
||
19 | |||
20 | /** @var EventDispatcher|\PHPUnit_Framework_MockObject_MockObject */ |
||
21 | private $dispatcher; |
||
22 | |||
23 | private $request = ['query' => 'query debug{ myField }', 'variables' => [], 'operationName' => null]; |
||
24 | |||
25 | public function setUp() |
||
26 | { |
||
27 | $this->dispatcher = $this->getMockBuilder(EventDispatcher::class)->setMethods(['dispatch'])->getMock(); |
||
28 | $this->dispatcher->expects($this->any())->method('dispatch')->willReturnArgument(1); |
||
29 | |||
30 | $this->executor = $this->createRequestExecutor(); |
||
31 | $queryType = new ObjectType([ |
||
32 | 'name' => 'Query', |
||
33 | 'fields' => [ |
||
34 | 'myField' => [ |
||
35 | 'type' => Type::boolean(), |
||
36 | 'resolve' => function () { |
||
37 | return false; |
||
38 | }, |
||
39 | ], |
||
40 | ], |
||
41 | ]); |
||
42 | $this->executor->addSchema('global', new Schema(['query' => $queryType])); |
||
43 | } |
||
44 | |||
45 | /** |
||
46 | * @expectedException \RuntimeException |
||
47 | * @expectedExceptionMessage Execution result should be an object instantiating "GraphQL\Executor\ExecutionResult". |
||
48 | */ |
||
49 | public function testInvalidExecutorReturnNotObject() |
||
54 | |||
55 | /** |
||
56 | * @expectedException \RuntimeException |
||
57 | * @expectedExceptionMessage Execution result should be an object instantiating "GraphQL\Executor\ExecutionResult". |
||
58 | */ |
||
59 | public function testInvalidExecutorReturnInvalidObject() |
||
64 | |||
65 | /** |
||
66 | * @expectedException \RuntimeException |
||
67 | * @expectedExceptionMessage PromiseAdapter should be an object instantiating "Overblog\GraphQLBundle\Executor\Promise\PromiseAdapterInterface" or "GraphQL\Executor\Promise\PromiseAdapter" with a "wait" method. |
||
68 | */ |
||
69 | public function testInvalidExecutorAdapterPromise() |
||
74 | |||
75 | /** |
||
76 | * @expectedException \RuntimeException |
||
77 | * @expectedExceptionMessage At least one schema should be declare. |
||
78 | */ |
||
79 | public function testGetSchemaNoSchemaFound() |
||
83 | |||
84 | private function createExecutorExecuteMock($returnValue) |
||
94 | |||
95 | private function createRequestExecutor() |
||
104 | } |
||
105 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: