We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
1 | <?php |
||
10 | class DefinitionTest extends TestCase |
||
11 | { |
||
12 | protected function setUp() |
||
13 | { |
||
14 | parent::setUp(); |
||
15 | |||
16 | static::bootKernel(['test_case' => 'definition']); |
||
17 | } |
||
18 | |||
19 | public function testDefinesEnumTypeWithDeprecatedValue() |
||
20 | { |
||
21 | /** @var EnumType $enumTypeWithDeprecatedValue */ |
||
22 | $enumTypeWithDeprecatedValue = $this->getType('EnumWithDeprecatedValue'); |
||
23 | $value = $enumTypeWithDeprecatedValue->getValues()[0]; |
||
24 | $this->assertEquals([ |
||
25 | 'name' => 'foo', |
||
26 | 'description' => null, |
||
27 | 'deprecationReason' => 'Just because', |
||
28 | 'value' => 'foo', |
||
29 | ], $value->config); |
||
30 | $this->assertTrue($value->isDeprecated()); |
||
31 | } |
||
32 | |||
33 | public function testDefinesAnObjectTypeWithDeprecatedField() |
||
34 | { |
||
35 | /** @var ObjectType $TypeWithDeprecatedField */ |
||
36 | $TypeWithDeprecatedField = $this->getType('ObjectWithDeprecatedField'); |
||
37 | $field = $TypeWithDeprecatedField->getField('bar'); |
||
38 | $this->assertEquals(Type::string(), $field->getType()); |
||
39 | $this->assertTrue($field->isDeprecated()); |
||
40 | $this->assertEquals('A terrible reason', $field->deprecationReason); |
||
41 | $this->assertEquals('bar', $field->name); |
||
42 | $this->assertEquals([], $field->args); |
||
43 | } |
||
44 | |||
45 | private function getType($type) |
||
46 | { |
||
47 | return $this->getContainer()->get('overblog_graphql.type_resolver')->resolve($type); |
||
48 | } |
||
49 | } |
||
50 |