public function testCollectionFirstFilter()
{
$collection = new Collection(array('data' => array(0, 1, 2)));
$result = $collection->first(function ($value) {
return $value;
});
$this->assertEqual(1, $result);
$collection = new Collection(array('data' => array('Hello', '', 'Goodbye')));
$result = $collection->first(function ($value) {
return $value;
});
$this->assertEqual('Hello', $result);
$collection = new Collection(array('data' => array('', 'Hello', 'Goodbye')));
$result = $collection->first(function ($value) {
return $value;
});
$this->assertEqual('Hello', $result);
$collection = new Collection(array('data' => array('', 'Hello', 'Goodbye')));
$result = $collection->first();
$this->assertEqual('', $result);
}