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