mirror of
https://github.com/retailcrm/graphql-php.git
synced 2025-02-06 07:49:24 +03:00
Added test for enums with null
values
This commit is contained in:
parent
189877c173
commit
1c41fb27ed
@ -253,6 +253,41 @@ class DefinitionTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals(true, $value->isDeprecated());
|
$this->assertEquals(true, $value->isDeprecated());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @it defines an enum type with a value of `null`
|
||||||
|
*/
|
||||||
|
public function testDefinesAnEnumTypeWithAValueOfNullAndUndefined()
|
||||||
|
{
|
||||||
|
$EnumTypeWithNullishValue = new EnumType([
|
||||||
|
'name' => 'EnumWithNullishValue',
|
||||||
|
'values' => [
|
||||||
|
'NULL' => ['value' => null],
|
||||||
|
'UNDEFINED' => ['value' => null],
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
|
||||||
|
$expected = [
|
||||||
|
[
|
||||||
|
'name' => 'NULL',
|
||||||
|
'description' => null,
|
||||||
|
'deprecationReason' => null,
|
||||||
|
'value' => null,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'UNDEFINED',
|
||||||
|
'description' => null,
|
||||||
|
'deprecationReason' => null,
|
||||||
|
'value' => null,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
$actual = $EnumTypeWithNullishValue->getValues();
|
||||||
|
|
||||||
|
$this->assertEquals(count($expected), count($actual));
|
||||||
|
$this->assertEquals($expected[0], (array)$actual[0]);
|
||||||
|
$this->assertEquals($expected[1], (array)$actual[1]);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @it defines an object type with deprecated field
|
* @it defines an object type with deprecated field
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user