@@ -87,7 +87,7 @@ public function testApply(): void
87
87
);
88
88
}
89
89
90
- public function testApplyWithNestedProperty (): void
90
+ public function testApplyWithNestedArrayProperty (): void
91
91
{
92
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
93
$ barType = new Type (Type::BUILTIN_TYPE_STRING );
@@ -119,6 +119,38 @@ public function testApplyWithNestedProperty(): void
119
119
);
120
120
}
121
121
122
+ public function testApplyWithNestedObjectProperty (): void
123
+ {
124
+ $ fooType = new Type (Type::BUILTIN_TYPE_OBJECT , false , Foo::class);
125
+ $ barType = new Type (Type::BUILTIN_TYPE_STRING );
126
+
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 ();
130
+
131
+ $ resourceClassResolverProphecy = $ this ->prophesize (ResourceClassResolverInterface::class);
132
+ $ resourceClassResolverProphecy ->isResourceClass (Foo::class)->willReturn (true )->shouldBeCalled ();
133
+
134
+ $ nameConverterProphecy = $ this ->prophesize (NameConverterInterface::class);
135
+ $ nameConverterProphecy ->normalize ('foo.bar ' , Foo::class, null , Argument::type ('array ' ))->willReturn ('foo.bar ' )->shouldBeCalled ();
136
+ $ nameConverterProphecy ->normalize ('foo ' , Foo::class, null , Argument::type ('array ' ))->willReturn ('foo ' )->shouldBeCalled ();
137
+
138
+ $ matchFilter = new MatchFilter (
139
+ $ this ->prophesize (PropertyNameCollectionFactoryInterface::class)->reveal (),
140
+ $ propertyMetadataFactoryProphecy ->reveal (),
141
+ $ resourceClassResolverProphecy ->reveal (),
142
+ $ this ->prophesize (IriConverterInterface::class)->reveal (),
143
+ $ this ->prophesize (PropertyAccessorInterface::class)->reveal (),
144
+ $ nameConverterProphecy ->reveal (),
145
+ ['foo.bar ' => null ]
146
+ );
147
+
148
+ self ::assertSame (
149
+ ['bool ' => ['must ' => [['nested ' => ['path ' => 'foo ' , 'query ' => ['match ' => ['foo.bar ' => 'Krupicka ' ]]]]]]],
150
+ $ matchFilter ->apply ([], Foo::class, null , ['filters ' => ['foo.bar ' => 'Krupicka ' ]])
151
+ );
152
+ }
153
+
122
154
public function testApplyWithInvalidFilters (): void
123
155
{
124
156
$ propertyNameCollectionFactoryProphecy = $ this ->prophesize (PropertyNameCollectionFactoryInterface::class);
0 commit comments