We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
1 | <?php |
||
14 | class ExecutorTest extends TestCase |
||
15 | { |
||
16 | /** @var RequestExecutor */ |
||
17 | private $executor; |
||
18 | |||
19 | /** @var EventDispatcher|\PHPUnit_Framework_MockObject_MockObject */ |
||
20 | private $dispatcher; |
||
21 | |||
22 | private $request = ['query' => 'query debug{ myField }', 'variables' => [], 'operationName' => null]; |
||
23 | |||
24 | public function setUp() |
||
25 | { |
||
26 | $this->dispatcher = $this->getMockBuilder(EventDispatcher::class)->setMethods(['dispatch'])->getMock(); |
||
27 | $this->dispatcher->expects($this->any())->method('dispatch')->willReturnArgument(1); |
||
28 | |||
29 | $this->executor = new RequestExecutor(new Executor(), $this->dispatcher); |
||
|
|||
30 | $queryType = new ObjectType([ |
||
31 | 'name' => 'Query', |
||
32 | 'fields' => [ |
||
33 | 'myField' => [ |
||
34 | 'type' => Type::boolean(), |
||
35 | 'resolve' => function () { |
||
36 | return false; |
||
37 | }, |
||
38 | ], |
||
39 | ], |
||
40 | ]); |
||
41 | $this->executor->addSchema('global', new Schema(['query' => $queryType])); |
||
42 | } |
||
43 | |||
44 | /** |
||
45 | * @expectedException \RuntimeException |
||
46 | * @expectedExceptionMessage Execution result should be an object instantiating "GraphQL\Executor\ExecutionResult". |
||
47 | */ |
||
48 | public function testInvalidExecutorReturnNotObject() |
||
53 | |||
54 | /** |
||
55 | * @expectedException \RuntimeException |
||
56 | * @expectedExceptionMessage Execution result should be an object instantiating "GraphQL\Executor\ExecutionResult". |
||
57 | */ |
||
58 | public function testInvalidExecutorReturnInvalidObject() |
||
63 | |||
64 | /** |
||
65 | * @expectedException \RuntimeException |
||
66 | * @expectedExceptionMessage PromiseAdapter should be an object instantiating "Overblog\GraphQLBundle\Executor\Promise\PromiseAdapterInterface" or "GraphQL\Executor\Promise\PromiseAdapter" with a "wait" method. |
||
67 | */ |
||
68 | public function testInvalidExecutorAdapterPromise() |
||
73 | |||
74 | /** |
||
75 | * @expectedException \RuntimeException |
||
76 | * @expectedExceptionMessage At least one schema should be declare. |
||
77 | */ |
||
78 | public function testGetSchemaNoSchemaFound() |
||
82 | |||
83 | private function createExecutorExecuteMock($returnValue) |
||
93 | } |
||
94 |
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: