public function testRejectRemovesElementsPassingTruthTest() { $c = new Collection(['foo', 'bar']); $this->assertEquals(['foo'], $c->reject('bar')->values()->all()); $c = new Collection(['foo', 'bar']); $this->assertEquals(['foo'], $c->reject(function ($v) { return $v == 'bar'; })->values()->all()); $c = new Collection(['foo', null]); $this->assertEquals(['foo'], $c->reject(null)->values()->all()); $c = new Collection(['foo', 'bar']); $this->assertEquals(['foo', 'bar'], $c->reject('baz')->values()->all()); $c = new Collection(['foo', 'bar']); $this->assertEquals(['foo', 'bar'], $c->reject(function ($v) { return $v == 'baz'; })->values()->all()); }