Inheritance: extends Type, implements InputType, implements OutputType, implements GraphQL\Type\Definition\LeafType
 public function __construct()
 {
     $config = ['name' => 'ContentFormatEnum', 'values' => [self::FORMAT_TEXT, self::FORMAT_HTML]];
     parent::__construct($config);
 }
Beispiel #2
0
 public function __construct()
 {
     // Option #2: Define enum type using inheritance
     $config = ['values' => ['ICON' => Image::SIZE_ICON, 'SMALL' => Image::SIZE_SMALL, 'MEDIUM' => Image::SIZE_MEDIUM, 'ORIGINAL' => Image::SIZE_ORIGINAL]];
     parent::__construct($config);
 }
 public function __construct()
 {
     $config = ['values' => ['ICON' => Image::SIZE_ICON, 'SMALL' => Image::SIZE_SMALL, 'MEDIUM' => Image::SIZE_MEDIUM, 'ORIGINAL' => Image::SIZE_ORIGINAL]];
     parent::__construct($config);
 }
Beispiel #4
0
 /**
  * @it defines an enum type with deprecated value
  */
 public function testDefinesEnumTypeWithDeprecatedValue()
 {
     $enumTypeWithDeprecatedValue = new EnumType(['name' => 'EnumWithDeprecatedValue', 'values' => ['foo' => ['deprecationReason' => 'Just because']]]);
     $value = $enumTypeWithDeprecatedValue->getValues()[0];
     $this->assertEquals(['name' => 'foo', 'description' => null, 'deprecationReason' => 'Just because', 'value' => 'foo'], (array) $value);
     $this->assertEquals(true, $value->isDeprecated());
 }