File tree Expand file tree Collapse file tree 4 files changed +27
-3
lines changed
Expand file tree Collapse file tree 4 files changed +27
-3
lines changed Original file line number Diff line number Diff line change @@ -227,7 +227,7 @@ public function test_only_related_with_many_relation_object_classes()
227227 {
228228 // Scopes are wrapped in their own AndGroup for isolation
229229 $ this ->assertEquals (
230- '(&(&( |(objectclass=top)(objectclass=person)(objectclass=organizationalperson)(objectclass=user))(|(objectclass=top)(objectclass=group) ))) ' ,
230+ '(&(|(objectclass=top)(objectclass=person)(objectclass=organizationalperson)(objectclass=user))(|(objectclass=top)(objectclass=group))) ' ,
231231 (new ModelHasManyStubWithManyRelated )->relation ()->onlyRelated ()->getQuery ()->getUnescapedQuery ()
232232 );
233233 }
Original file line number Diff line number Diff line change @@ -82,7 +82,7 @@ public function test_new_queries_apply_object_class_scopes()
8282
8383 // Scopes are wrapped in their own AndGroup for isolation
8484 $ this ->assertEquals (
85- '(&(&( objectclass=foo)(objectclass=bar)(objectclass=baz) )) ' ,
85+ '(&(objectclass=foo)(objectclass=bar)(objectclass=baz)) ' ,
8686 ModelWithObjectClassStub::query ()->getUnescapedQuery ()
8787 );
8888 }
Original file line number Diff line number Diff line change @@ -167,7 +167,7 @@ public function test_scopes_remain_enforced_with_complex_queries()
167167 {
168168 // The scope (foo=bar) must always be present and enforced at the root AND level
169169 $ this ->assertEquals (
170- '(&(|(name=\4a\6f\68\6e)(name=\4a\61\6e\65))(active=\74\72\75\65)(&(foo=bar))) ' ,
170+ '(&(&( |(name=\4a\6f\68\6e)(name=\4a\61\6e\65))(active=\74\72\75\65) )(&(foo=bar))) ' ,
171171 ModelWithGlobalScopeTestStub::query ()
172172 ->where ('name ' , '= ' , 'John ' )
173173 ->orWhere ('name ' , '= ' , 'Jane ' )
Original file line number Diff line number Diff line change @@ -165,4 +165,28 @@ public function test_add_select_with_variadic_arguments()
165165 $ this ->assertContains ('mail ' , $ selects );
166166 $ this ->assertContains ('objectguid ' , $ selects );
167167 }
168+
169+ public function test_or_filter_extracts_filters_from_nested_query ()
170+ {
171+ $ b = $ this ->newBuilder ();
172+
173+ $ query = $ b ->orFilter (function ($ query ) {
174+ $ query ->whereEquals ('foo ' , '1 ' );
175+ $ query ->whereEquals ('foo ' , '2 ' );
176+ })->getUnescapedQuery ();
177+
178+ $ this ->assertEquals ('(|(foo=1)(foo=2)) ' , $ query );
179+ }
180+
181+ public function test_and_filter_extracts_filters_from_nested_query ()
182+ {
183+ $ b = $ this ->newBuilder ();
184+
185+ $ query = $ b ->andFilter (function ($ query ) {
186+ $ query ->whereEquals ('foo ' , '1 ' );
187+ $ query ->whereEquals ('foo ' , '2 ' );
188+ })->getUnescapedQuery ();
189+
190+ $ this ->assertEquals ('(&(foo=1)(foo=2)) ' , $ query );
191+ }
168192}
You can’t perform that action at this time.
0 commit comments