Skip to content

Commit

Permalink
improve test of filter in Collection (#43258)
Browse files Browse the repository at this point in the history
If no callback is supplied, all entries of the collection that are equivalent to false will be removed
  • Loading branch information
moharami authored Jul 18, 2022
1 parent b3b6f5b commit b15dc2a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/Support/SupportCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

/**
Expand Down

0 comments on commit b15dc2a

Please sign in to comment.