27
27
use Prophecy \Argument ;
28
28
use Prophecy \PhpUnit \ProphecyTrait ;
29
29
use Symfony \Component \PropertyAccess \PropertyAccessorInterface ;
30
- use Symfony \Component \PropertyInfo \Type ;
31
30
use Symfony \Component \Serializer \NameConverter \NameConverterInterface ;
31
+ use Symfony \Component \TypeInfo \Type ;
32
32
33
33
class MatchFilterTest extends TestCase
34
34
{
@@ -55,8 +55,8 @@ public function testApply(): void
55
55
$ propertyNameCollectionFactoryProphecy ->create (Foo::class)->willReturn (new PropertyNameCollection (['id ' , 'name ' , 'bar ' ]))->shouldBeCalled ();
56
56
57
57
$ propertyMetadataFactoryProphecy = $ this ->prophesize (PropertyMetadataFactoryInterface::class);
58
- $ propertyMetadataFactoryProphecy ->create (Foo::class, 'id ' )->willReturn ((new ApiProperty ())->withBuiltinTypes ([ new Type (Type:: BUILTIN_TYPE_INT )] ))->shouldBeCalled ();
59
- $ propertyMetadataFactoryProphecy ->create (Foo::class, 'name ' )->willReturn ((new ApiProperty ())->withBuiltinTypes ([ new Type (Type:: BUILTIN_TYPE_STRING )] ))->shouldBeCalled ();
58
+ $ propertyMetadataFactoryProphecy ->create (Foo::class, 'id ' )->willReturn ((new ApiProperty ())->withNativeType ( Type:: int () ))->shouldBeCalled ();
59
+ $ propertyMetadataFactoryProphecy ->create (Foo::class, 'name ' )->willReturn ((new ApiProperty ())->withNativeType ( Type:: string () ))->shouldBeCalled ();
60
60
61
61
$ foo = new Foo ();
62
62
$ foo ->setName ('Xavier ' );
@@ -89,12 +89,12 @@ public function testApply(): void
89
89
90
90
public function testApplyWithNestedArrayProperty (): void
91
91
{
92
- $ fooType = new Type (Type:: BUILTIN_TYPE_ARRAY , false , Foo::class, true , new Type (Type::BUILTIN_TYPE_INT ), new Type (Type:: BUILTIN_TYPE_OBJECT , false , Foo::class));
93
- $ barType = new Type (Type:: BUILTIN_TYPE_STRING );
92
+ $ fooType = Type:: list (Type::object ( Foo::class));
93
+ $ barType = Type:: string ( );
94
94
95
95
$ propertyMetadataFactoryProphecy = $ this ->prophesize (PropertyMetadataFactoryInterface::class);
96
- $ propertyMetadataFactoryProphecy ->create (Foo::class, 'foo ' )->willReturn ((new ApiProperty ())->withBuiltinTypes ([ $ fooType] ))->shouldBeCalled ();
97
- $ propertyMetadataFactoryProphecy ->create (Foo::class, 'bar ' )->willReturn ((new ApiProperty ())->withBuiltinTypes ([ $ barType] ))->shouldBeCalled ();
96
+ $ propertyMetadataFactoryProphecy ->create (Foo::class, 'foo ' )->willReturn ((new ApiProperty ())->withNativeType ( $ fooType ))->shouldBeCalled ();
97
+ $ propertyMetadataFactoryProphecy ->create (Foo::class, 'bar ' )->willReturn ((new ApiProperty ())->withNativeType ( $ barType ))->shouldBeCalled ();
98
98
99
99
$ resourceClassResolverProphecy = $ this ->prophesize (ResourceClassResolverInterface::class);
100
100
$ resourceClassResolverProphecy ->isResourceClass (Foo::class)->willReturn (true )->shouldBeCalled ();
@@ -121,12 +121,12 @@ public function testApplyWithNestedArrayProperty(): void
121
121
122
122
public function testApplyWithNestedObjectProperty (): void
123
123
{
124
- $ fooType = new Type (Type:: BUILTIN_TYPE_OBJECT , false , Foo::class);
125
- $ barType = new Type (Type:: BUILTIN_TYPE_STRING );
124
+ $ fooType = Type:: object ( Foo::class);
125
+ $ barType = Type:: string ( );
126
126
127
127
$ propertyMetadataFactoryProphecy = $ this ->prophesize (PropertyMetadataFactoryInterface::class);
128
- $ propertyMetadataFactoryProphecy ->create (Foo::class, 'foo ' )->willReturn ((new ApiProperty ())->withBuiltinTypes ([ $ fooType] ))->shouldBeCalled ();
129
- $ propertyMetadataFactoryProphecy ->create (Foo::class, 'bar ' )->willReturn ((new ApiProperty ())->withBuiltinTypes ([ $ barType] ))->shouldBeCalled ();
128
+ $ propertyMetadataFactoryProphecy ->create (Foo::class, 'foo ' )->willReturn ((new ApiProperty ())->withNativeType ( $ fooType ))->shouldBeCalled ();
129
+ $ propertyMetadataFactoryProphecy ->create (Foo::class, 'bar ' )->willReturn ((new ApiProperty ())->withNativeType ( $ barType ))->shouldBeCalled ();
130
130
131
131
$ resourceClassResolverProphecy = $ this ->prophesize (ResourceClassResolverInterface::class);
132
132
$ resourceClassResolverProphecy ->isResourceClass (Foo::class)->willReturn (true )->shouldBeCalled ();
@@ -156,7 +156,7 @@ public function testApplyWithInvalidFilters(): void
156
156
$ propertyNameCollectionFactoryProphecy ->create (Foo::class)->willReturn (new PropertyNameCollection (['id ' , 'bar ' ]))->shouldBeCalled ();
157
157
158
158
$ propertyMetadataFactoryProphecy = $ this ->prophesize (PropertyMetadataFactoryInterface::class);
159
- $ propertyMetadataFactoryProphecy ->create (Foo::class, 'id ' )->willReturn ((new ApiProperty ())->withBuiltinTypes ([ new Type (Type:: BUILTIN_TYPE_INT )] ))->shouldBeCalled ();
159
+ $ propertyMetadataFactoryProphecy ->create (Foo::class, 'id ' )->willReturn ((new ApiProperty ())->withNativeType ( Type:: int () ))->shouldBeCalled ();
160
160
$ propertyMetadataFactoryProphecy ->create (Foo::class, 'bar ' )->willReturn (new ApiProperty ())->shouldBeCalled ();
161
161
162
162
$ iriConverterProphecy = $ this ->prophesize (IriConverterInterface::class);
@@ -183,11 +183,11 @@ public function testGetDescription(): void
183
183
$ propertyNameCollectionFactoryProphecy ->create (Foo::class)->willReturn (new PropertyNameCollection (['id ' , 'name ' , 'bar ' , 'date ' , 'weird ' ]))->shouldBeCalled ();
184
184
185
185
$ propertyMetadataFactoryProphecy = $ this ->prophesize (PropertyMetadataFactoryInterface::class);
186
- $ propertyMetadataFactoryProphecy ->create (Foo::class, 'id ' )->willReturn ((new ApiProperty ())->withBuiltinTypes ([ new Type (Type:: BUILTIN_TYPE_INT )] ))->shouldBeCalled ();
187
- $ propertyMetadataFactoryProphecy ->create (Foo::class, 'name ' )->willReturn ((new ApiProperty ())->withBuiltinTypes ([ new Type (Type:: BUILTIN_TYPE_STRING )] ))->shouldBeCalled ();
186
+ $ propertyMetadataFactoryProphecy ->create (Foo::class, 'id ' )->willReturn ((new ApiProperty ())->withNativeType ( Type:: int () ))->shouldBeCalled ();
187
+ $ propertyMetadataFactoryProphecy ->create (Foo::class, 'name ' )->willReturn ((new ApiProperty ())->withNativeType ( Type:: string () ))->shouldBeCalled ();
188
188
$ propertyMetadataFactoryProphecy ->create (Foo::class, 'bar ' )->willReturn (new ApiProperty ())->shouldBeCalled ();
189
- $ propertyMetadataFactoryProphecy ->create (Foo::class, 'date ' )->willReturn ((new ApiProperty ())->withBuiltinTypes ([ new Type (Type:: BUILTIN_TYPE_OBJECT , false , \DateTimeImmutable::class)] ))->shouldBeCalled ();
190
- $ propertyMetadataFactoryProphecy ->create (Foo::class, 'weird ' )->willReturn ((new ApiProperty ())->withBuiltinTypes ([ new Type (Type:: BUILTIN_TYPE_RESOURCE )] ))->shouldBeCalled ();
189
+ $ propertyMetadataFactoryProphecy ->create (Foo::class, 'date ' )->willReturn ((new ApiProperty ())->withNativeType ( Type:: object ( \DateTimeImmutable::class)))->shouldBeCalled ();
190
+ $ propertyMetadataFactoryProphecy ->create (Foo::class, 'weird ' )->willReturn ((new ApiProperty ())->withNativeType ( Type:: resource () ))->shouldBeCalled ();
191
191
192
192
$ resourceClassResolverProphecy = $ this ->prophesize (ResourceClassResolverInterface::class);
193
193
$ resourceClassResolverProphecy ->isResourceClass (\DateTimeImmutable::class)->willReturn (false )->shouldBeCalled ();
0 commit comments