From b15dc2ac7e4c7b382ec5cf09e2983ab94cccc83c Mon Sep 17 00:00:00 2001 From: Amir Moharami Fard Date: Mon, 18 Jul 2022 20:23:32 +0430 Subject: [PATCH] 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 --- tests/Support/SupportCollectionTest.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/Support/SupportCollectionTest.php b/tests/Support/SupportCollectionTest.php index 252e8fb3ba8e..23745fd21a41 100755 --- a/tests/Support/SupportCollectionTest.php +++ b/tests/Support/SupportCollectionTest.php @@ -868,6 +868,9 @@ public function testFilter($collection) $this->assertEquals(['first' => 'Hello', 'second' => 'World'], $c->filter(function ($item, $key) { return $key !== 'id'; })->all()); + + $c = new $collection([1, 2, 3, null, false, '', 0, []]); + $this->assertEquals([1, 2, 3], $c->filter()->all()); } /**