15
15
16
16
use ApiPlatform \GraphQl \Tests \Fixtures \Enum \GenderTypeEnum ;
17
17
use ApiPlatform \GraphQl \Tests \Fixtures \Type \Definition \DateTimeType ;
18
- use ApiPlatform \GraphQl \Type \TypeBuilderEnumInterface ;
18
+ use ApiPlatform \GraphQl \Type \ContextAwareTypeBuilderInterface ;
19
19
use ApiPlatform \GraphQl \Type \TypeConverter ;
20
20
use ApiPlatform \GraphQl \Type \TypesContainerInterface ;
21
21
use ApiPlatform \Metadata \ApiProperty ;
@@ -54,7 +54,7 @@ class TypeConverterTest extends TestCase
54
54
*/
55
55
protected function setUp (): void
56
56
{
57
- $ this ->typeBuilderProphecy = $ this ->prophesize (TypeBuilderEnumInterface ::class);
57
+ $ this ->typeBuilderProphecy = $ this ->prophesize (ContextAwareTypeBuilderInterface ::class);
58
58
$ this ->typesContainerProphecy = $ this ->prophesize (TypesContainerInterface::class);
59
59
$ this ->resourceMetadataCollectionFactoryProphecy = $ this ->prophesize (ResourceMetadataCollectionFactoryInterface::class);
60
60
$ this ->propertyMetadataFactoryProphecy = $ this ->prophesize (PropertyMetadataFactoryInterface::class);
@@ -155,13 +155,15 @@ public function testConvertTypeInputResource(): void
155
155
$ type = new Type (Type::BUILTIN_TYPE_OBJECT , false , 'dummy ' );
156
156
/** @var Operation $operation */
157
157
$ operation = new Query ();
158
+ /** @var ApiProperty $propertyMetadata */
159
+ $ propertyMetadata = (new ApiProperty ())->withWritableLink (true );
158
160
$ graphqlResourceMetadata = new ResourceMetadataCollection ('dummy ' , [(new ApiResource ())->withGraphQlOperations (['item_query ' => $ operation ])]);
159
161
$ expectedGraphqlType = new ObjectType (['name ' => 'resourceObjectType ' , 'fields ' => []]);
160
162
161
163
$ this ->resourceMetadataCollectionFactoryProphecy ->create ('dummy ' )->willReturn ($ graphqlResourceMetadata );
162
164
$ this ->typeBuilderProphecy ->isCollection ($ type )->willReturn (false );
163
165
$ this ->propertyMetadataFactoryProphecy ->create ('rootClass ' , 'dummyProperty ' , Argument::type ('array ' ))->shouldBeCalled ()->willReturn ((new ApiProperty ())->withWritableLink (true ));
164
- $ this ->typeBuilderProphecy ->getResourceObjectType (' dummy ' , $ graphqlResourceMetadata , $ operation , true , false , 1 )->shouldBeCalled ()->willReturn ($ expectedGraphqlType );
166
+ $ this ->typeBuilderProphecy ->getResourceObjectType ($ graphqlResourceMetadata , $ operation , $ propertyMetadata , [ ' input ' => true , ' wrapped ' => false , ' depth ' => 1 ] )->shouldBeCalled ()->willReturn ($ expectedGraphqlType );
165
167
166
168
$ graphqlType = $ this ->typeConverter ->convertType ($ type , true , $ operation , 'dummy ' , 'rootClass ' , 'dummyProperty ' , 1 );
167
169
$ this ->assertSame ($ expectedGraphqlType , $ graphqlType );
@@ -179,7 +181,11 @@ public function testConvertTypeCollectionResource(Type $type, ObjectType $expect
179
181
180
182
$ this ->typeBuilderProphecy ->isCollection ($ type )->shouldBeCalled ()->willReturn (true );
181
183
$ this ->resourceMetadataCollectionFactoryProphecy ->create ('dummyValue ' )->shouldBeCalled ()->willReturn ($ graphqlResourceMetadata );
182
- $ this ->typeBuilderProphecy ->getResourceObjectType ('dummyValue ' , $ graphqlResourceMetadata , $ collectionOperation , false , false , 0 )->shouldBeCalled ()->willReturn ($ expectedGraphqlType );
184
+ $ this ->typeBuilderProphecy ->getResourceObjectType ($ graphqlResourceMetadata , $ collectionOperation , null , [
185
+ 'input ' => false ,
186
+ 'wrapped ' => false ,
187
+ 'depth ' => 0 ,
188
+ ])->shouldBeCalled ()->willReturn ($ expectedGraphqlType );
183
189
184
190
/** @var Operation $rootOperation */
185
191
$ rootOperation = (new Query ())->withName ('test ' );
0 commit comments