@@ -67,4 +67,45 @@ public function testValuePathNegationMatchesRFCSection341(): void
6767 'Groups without the user should remain when using not(valuePath) filter. '
6868 );
6969 }
70+
71+ public function testMultiConditionFilterCombinesCriteriaWithAnd (): void
72+ {
73+ $ matchingUser = factory (User::class)->create ([
74+ 'name ' => 'te-matching-user ' ,
75+ 'formatted ' => 'te matching formatted ' ,
76+ 77+ ]);
78+
79+ $ formattedOnlyUser = factory (User::class)->create ([
80+ 'name ' => 'AlphaName ' ,
81+ 'formatted ' => 'te formatted only ' ,
82+ 83+ ]);
84+
85+ $ userNameOnlyUser = factory (User::class)->create ([
86+ 'name ' => 'te username only ' ,
87+ 'formatted ' => 'AlphaDisplay ' ,
88+ 89+ ]);
90+
91+ $ filter = rawurlencode ('name.formatted co "te" and userName co "te" ' );
92+
93+ $ response = $ this ->get ("/scim/v2/Users?filter= {$ filter }&count=200 " );
94+ $ response ->assertStatus (200 );
95+
96+ $ ids = collect ($ response ->json ('Resources ' ))->pluck ('id ' );
97+
98+ $ this ->assertTrue (
99+ $ ids ->contains ((string )$ matchingUser ->id ),
100+ 'Expected user that matches both conditions to be returned. '
101+ );
102+ $ this ->assertFalse (
103+ $ ids ->contains ((string )$ formattedOnlyUser ->id ),
104+ 'User matching only the formatted condition should be excluded. '
105+ );
106+ $ this ->assertFalse (
107+ $ ids ->contains ((string )$ userNameOnlyUser ->id ),
108+ 'User matching only the userName condition should be excluded. '
109+ );
110+ }
70111}
0 commit comments