1919use ApiPlatform \Core \Tests \Fixtures \TestBundle \Entity \Dummy ;
2020use PHPUnit \Framework \TestCase ;
2121use Prophecy \Argument ;
22+ use Ramsey \Uuid \Uuid ;
2223use Symfony \Component \PropertyInfo \Type ;
2324
2425class TypeFactoryTest extends TestCase
@@ -39,10 +40,21 @@ public function typeProvider(): iterable
3940 yield [['type ' => 'boolean ' ], new Type (Type::BUILTIN_TYPE_BOOL )];
4041 yield [['type ' => 'string ' ], new Type (Type::BUILTIN_TYPE_OBJECT )];
4142 yield [['type ' => 'string ' , 'format ' => 'date-time ' ], new Type (Type::BUILTIN_TYPE_OBJECT , false , \DateTimeImmutable::class)];
43+ yield [['type ' => 'string ' , 'format ' => 'uuid ' ], new Type (Type::BUILTIN_TYPE_OBJECT , false , Uuid::class)];
4244 yield [['type ' => 'string ' ], new Type (Type::BUILTIN_TYPE_OBJECT , false , Dummy::class)];
4345 yield [['type ' => 'array ' , 'items ' => ['type ' => 'string ' ]], new Type (Type::BUILTIN_TYPE_STRING , false , null , true )];
4446 }
4547
48+ public function testGetTypeWithSchema (): void
49+ {
50+ $ typeFactory = new TypeFactory ();
51+ $ type = new Type (Type::BUILTIN_TYPE_OBJECT , false , Dummy::class);
52+ $ this ->assertSame (
53+ ['type ' => 'string ' , 'format ' => 'iri-reference ' ],
54+ $ typeFactory ->getType ($ type , 'json ' , null , null , new Schema ())
55+ );
56+ }
57+
4658 public function testGetClassType (): void
4759 {
4860 $ schemaFactoryProphecy = $ this ->prophesize (SchemaFactoryInterface::class);
0 commit comments