1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace TheCodingMachine\GraphQL\Controllers\Types; |
4
|
|
|
|
5
|
|
|
use TheCodingMachine\GraphQL\Controllers\AbstractQueryProviderTest; |
6
|
|
|
use TheCodingMachine\GraphQL\Controllers\Fixtures\TestObject; |
7
|
|
|
use TheCodingMachine\GraphQL\Controllers\Fixtures\TestObject2; |
8
|
|
|
use TheCodingMachine\GraphQL\Controllers\Fixtures\TestObjectWithRecursiveList; |
|
|
|
|
9
|
|
|
use TheCodingMachine\GraphQL\Controllers\Fixtures\Types\TestFactory; |
10
|
|
|
use TheCodingMachine\GraphQL\Controllers\GraphQLException; |
11
|
|
|
|
12
|
|
|
class ResolvableInputObjectTypeTest extends AbstractQueryProviderTest |
13
|
|
|
{ |
14
|
|
|
|
15
|
|
|
public function testResolve(): void |
16
|
|
|
{ |
17
|
|
|
$inputType = new ResolvableInputObjectType('InputObject', |
18
|
|
|
$this->getControllerQueryProviderFactory(), |
19
|
|
|
$this->getTypeMapper(), |
20
|
|
|
new TestFactory(), |
21
|
|
|
'myFactory', |
22
|
|
|
$this->getHydrator(), |
23
|
|
|
'my comment'); |
24
|
|
|
|
25
|
|
|
$this->assertSame('InputObject', $inputType->name); |
26
|
|
|
$this->assertCount(2, $inputType->getFields()); |
27
|
|
|
$this->assertSame('my comment', $inputType->description); |
28
|
|
|
|
29
|
|
|
$obj = $inputType->resolve(['string' => 'foobar', 'bool' => false]); |
30
|
|
|
$this->assertInstanceOf(TestObject::class, $obj); |
31
|
|
|
$this->assertSame('foobar', $obj->getTest()); |
32
|
|
|
$this->assertSame(false, $obj->isTestBool()); |
33
|
|
|
|
34
|
|
|
$obj = $inputType->resolve(['string' => 'foobar']); |
35
|
|
|
$this->assertInstanceOf(TestObject::class, $obj); |
36
|
|
|
$this->assertSame('foobar', $obj->getTest()); |
37
|
|
|
$this->assertSame(true, $obj->isTestBool()); |
38
|
|
|
|
39
|
|
|
$this->expectException(GraphQLException::class); |
40
|
|
|
$this->expectExceptionMessage("Expected argument 'string' was not provided in GraphQL input type 'InputObject' used in factory 'TheCodingMachine\GraphQL\Controllers\Fixtures\Types\TestFactory::myFactory()'"); |
41
|
|
|
$inputType->resolve([]); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
public function testListResolve(): void |
45
|
|
|
{ |
46
|
|
|
$inputType = new ResolvableInputObjectType('InputObject2', |
47
|
|
|
$this->getControllerQueryProviderFactory(), |
48
|
|
|
$this->getTypeMapper(), |
49
|
|
|
new TestFactory(), |
50
|
|
|
'myListFactory', |
51
|
|
|
$this->getHydrator(), |
52
|
|
|
null); |
53
|
|
|
|
54
|
|
|
$obj = $inputType->resolve(['date' => '2018-12-25', 'stringList' => |
55
|
|
|
[ |
56
|
|
|
'foo', |
57
|
|
|
'bar' |
58
|
|
|
], |
59
|
|
|
'dateList' => [ |
60
|
|
|
'2018-12-25' |
61
|
|
|
]]); |
62
|
|
|
$this->assertInstanceOf(TestObject2::class, $obj); |
63
|
|
|
$this->assertSame('2018-12-25-foo-bar-1', $obj->getTest2()); |
64
|
|
|
} |
65
|
|
|
} |
66
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths