@@ -68,6 +68,22 @@ function ($item, $next, $prev) use (&$arr, &$arrNext, &$arrPrev): bool {
6868 $ this ->assertSame ([$ e2 , $ e1 , null ], $ arrNext );
6969 $ this ->assertSame ([null , $ e0 , $ e2 ], $ arrPrev );
7070
71+ $ coll = $ collection ->only ([0 , 71 , 'n ' ]);
72+ $ this ->assertSame ([0 => $ e0 , 'n ' => $ e1 ], $ coll ->all ());
73+ $ this ->assertSame ($ coll , $ coll ->only ([0 , 71 , 'n ' ]));
74+
75+ $ coll = $ collection ->onlyIn ([2 => true , 'm ' => true ]);
76+ $ this ->assertSame ([2 => $ e2 ], $ coll ->all ());
77+ $ this ->assertSame ($ coll , $ coll ->onlyIn ([2 => true , 'm ' => true ]));
78+
79+ $ coll = $ collection ->except ([0 , 71 , 'n ' ]);
80+ $ this ->assertSame ([2 => $ e2 ], $ coll ->all ());
81+ $ this ->assertSame ($ coll , $ coll ->except ([0 , 71 , 'n ' ]));
82+
83+ $ coll = $ collection ->exceptIn ([0 => true , 1 => true , 2 => true ]);
84+ $ this ->assertSame (['n ' => $ e1 ], $ coll ->all ());
85+ $ this ->assertSame ($ coll , $ coll ->exceptIn ([0 => true , 1 => true , 2 => true ]));
86+
7187 $ arr = $ arrNext = $ arrPrev = [];
7288 $ found = $ collection ->find (
7389 function ($ item , $ next , $ prev ) use (&$ arr , &$ arrNext , &$ arrPrev ): bool {
@@ -136,6 +152,18 @@ function () use (&$count) {
136152 $ coll = $ collection ->filter (fn () => true );
137153 $ this ->assertSame ($ collection , $ coll );
138154
155+ $ coll = $ collection ->only ([]);
156+ $ this ->assertSame ($ collection , $ coll );
157+
158+ $ coll = $ collection ->onlyIn ([]);
159+ $ this ->assertSame ($ collection , $ coll );
160+
161+ $ coll = $ collection ->except ([]);
162+ $ this ->assertSame ($ collection , $ coll );
163+
164+ $ coll = $ collection ->exceptIn ([]);
165+ $ this ->assertSame ($ collection , $ coll );
166+
139167 $ this ->assertNull ($ collection ->find (fn () => true ));
140168
141169 $ coll = $ collection ->slice (0 );
0 commit comments