Inheritance: extends Type, implements InputType, implements OutputType, implements GraphQL\Type\Definition\LeafType
Exemplo n.º 1
0
 public function __construct()
 {
     $config = ['name' => 'ContentFormatEnum', 'values' => [self::FORMAT_TEXT, self::FORMAT_HTML]];
     parent::__construct($config);
 }
Exemplo n.º 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);
 }
Exemplo n.º 3
0
 public function __construct()
 {
     $config = ['values' => ['ICON' => Image::SIZE_ICON, 'SMALL' => Image::SIZE_SMALL, 'MEDIUM' => Image::SIZE_MEDIUM, 'ORIGINAL' => Image::SIZE_ORIGINAL]];
     parent::__construct($config);
 }
Exemplo n.º 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());
 }