Skip to content

Commit cf8002a

Browse files
authored
Merge pull request #7 from overblog/spec-april2016
Migrate to spec april 2016
2 parents 412d6b1 + 8aff92a commit cf8002a

File tree

4 files changed

+15
-11
lines changed

4 files changed

+15
-11
lines changed

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
"bin-dir": "bin"
1616
},
1717
"require": {
18-
"php": "^5.4|~7.0"
18+
"php": "^5.4|~7.0",
19+
"webonyx/graphql-php": "^0.7.2"
1920
},
2021
"require-dev": {
2122
"fabpot/php-cs-fixer": "^1.11",
@@ -24,8 +25,7 @@
2425
"symfony/expression-language": "^2.7|^3.0",
2526
"symfony/filesystem": "^2.7|^3.0",
2627
"symfony/process": "^2.7|^3.0",
27-
"symfony/yaml": "^2.7|^3.0",
28-
"webonyx/graphql-php": "0.6.2"
28+
"symfony/yaml": "^2.7|^3.0"
2929
},
3030
"autoload": {
3131
"psr-4": {

src/Generator/TypeGenerator.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ protected function generateTypes(array $value)
8585
*/
8686
protected function generateResolve(array $value)
8787
{
88-
return $this->callableCallbackFromArrayValue($value, 'resolve', '$value, $args, \\GraphQL\\Type\\Definition\\ResolveInfo $info');
88+
return $this->callableCallbackFromArrayValue($value, 'resolve', '$value, $args, $context, \\GraphQL\\Type\\Definition\\ResolveInfo $info');
8989
}
9090

9191
/**
@@ -94,7 +94,7 @@ protected function generateResolve(array $value)
9494
*/
9595
protected function generateResolveType(array $value)
9696
{
97-
return $this->callableCallbackFromArrayValue($value, 'resolveType', '$value');
97+
return $this->callableCallbackFromArrayValue($value, 'resolveType', '$value, $context, \\GraphQL\\Type\\Definition\\ResolveInfo $info');
9898
}
9999

100100
/**
@@ -103,7 +103,7 @@ protected function generateResolveType(array $value)
103103
*/
104104
protected function generateIsTypeOf(array $value)
105105
{
106-
return $this->callableCallbackFromArrayValue($value, 'isTypeOf', '$value, \\GraphQL\\Type\\Definition\\ResolveInfo $info');
106+
return $this->callableCallbackFromArrayValue($value, 'isTypeOf', '$value, $context, \\GraphQL\\Type\\Definition\\ResolveInfo $info');
107107
}
108108

109109
/**
@@ -112,7 +112,7 @@ protected function generateIsTypeOf(array $value)
112112
*/
113113
protected function generateResolveField(array $value)
114114
{
115-
return $this->callableCallbackFromArrayValue($value, 'resolveField', '$value, $args, \\GraphQL\\Type\\Definition\\ResolveInfo $info');
115+
return $this->callableCallbackFromArrayValue($value, 'resolveField', '$value, $args, $context, \\GraphQL\\Type\\Definition\\ResolveInfo $info');
116116
}
117117

118118
/**

tests/AbstractStarWarsTest.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,18 @@ public function setUp()
3737
Resolver::setHumanType($this->getType('Human'));
3838
Resolver::setDroidType($this->getType('Droid'));
3939

40-
$this->schema = new Schema($this->getType('Query'));
40+
$this->schema = new Schema(['query' => $this->getType('Query')]);
4141
}
4242

4343
/**
4444
* Helper function to test a query and the expected response.
45+
* @param $query
46+
* @param $expected
47+
* @param null $params
4548
*/
4649
protected function assertValidQuery($query, $expected, $params = null)
4750
{
48-
$result = GraphQL::execute($this->schema, $query, null, $params);
51+
$result = GraphQL::execute($this->schema, $query, null, null, $params);
4952

5053
$this->assertEquals(['data' => $expected], $result, json_encode($result));
5154
}

tests/StarWarsIntrospectionTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ public function testAllowsQueryingTheSchemaForTypes()
3333
['name' => 'Query'],
3434
['name' => 'Episode'],
3535
['name' => 'Character'],
36-
['name' => 'Human'],
3736
['name' => 'String'],
37+
['name' => 'Human'],
3838
['name' => 'Droid'],
3939
['name' => '__Schema'],
4040
['name' => '__Type'],
@@ -44,9 +44,10 @@ public function testAllowsQueryingTheSchemaForTypes()
4444
['name' => '__InputValue'],
4545
['name' => '__EnumValue'],
4646
['name' => '__Directive'],
47+
['name' => '__DirectiveLocation'],
4748
['name' => 'ID'],
4849
['name' => 'Float'],
49-
['name' => 'Int']
50+
['name' => 'Int'],
5051
]
5152
]
5253
];

0 commit comments

Comments
 (0)