File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1042,6 +1042,39 @@ public function testCorrectlyExtendInputObjectType(): void
10421042 self ::assertSame ($ inputSDL , $ this ->printAllASTNodes ($ someInput ));
10431043 }
10441044
1045+ /** @see it('Correctly extend input object type with @oneOf directive') */
1046+ public function testCorrectlyExtendInputObjectTypeWithOneOfDirective (): void
1047+ {
1048+ $ inputSDL = <<<'GRAPHQL'
1049+ input SomeInput {
1050+ first: String
1051+ }
1052+
1053+ extend input SomeInput @oneOf {
1054+ second: Int
1055+ }
1056+
1057+ GRAPHQL;
1058+
1059+ $ schema = BuildSchema::build ($ inputSDL );
1060+
1061+ $ someInput = $ schema ->getType ('SomeInput ' );
1062+ assert ($ someInput instanceof InputObjectType);
1063+
1064+ // Verify that the @oneOf directive from the extension is properly applied
1065+ self ::assertTrue ($ someInput ->isOneOf ());
1066+
1067+ $ expectedSomeInputSDL = <<<'GRAPHQL'
1068+ input SomeInput @oneOf {
1069+ first: String
1070+ second: Int
1071+ }
1072+ GRAPHQL;
1073+
1074+ self ::assertSame ($ expectedSomeInputSDL , SchemaPrinter::printType ($ someInput ));
1075+ self ::assertSame ($ inputSDL , $ this ->printAllASTNodes ($ someInput ));
1076+ }
1077+
10451078 /** @see it('Correctly assign AST nodes') */
10461079 public function testCorrectlyAssignASTNodes (): void
10471080 {
You can’t perform that action at this time.
0 commit comments