Skip to content

Commit b15dc2a

Browse files
authored
improve test of filter in Collection (#43258)
If no callback is supplied, all entries of the collection that are equivalent to false will be removed
1 parent b3b6f5b commit b15dc2a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tests/Support/SupportCollectionTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -868,6 +868,9 @@ public function testFilter($collection)
868868
$this->assertEquals(['first' => 'Hello', 'second' => 'World'], $c->filter(function ($item, $key) {
869869
return $key !== 'id';
870870
})->all());
871+
872+
$c = new $collection([1, 2, 3, null, false, '', 0, []]);
873+
$this->assertEquals([1, 2, 3], $c->filter()->all());
871874
}
872875

873876
/**

0 commit comments

Comments
 (0)