Beispiel #1
0
 public function testFilter()
 {
     $resultSet = new ResultSet(array(1 => array('_id' => 1, 'field' => 'value1'), 2 => array('_id' => 2, 'field' => 'value2'), 3 => array('_id' => 3, 'field' => 'value3')));
     // skip even ids
     $newSet = $resultSet->filter(function ($item) {
         return $item['_id'] % 2 !== 0;
     });
     $this->assertEquals(array(1 => array('_id' => 1, 'field' => 'value1'), 3 => array('_id' => 3, 'field' => 'value3')), iterator_to_array($newSet));
 }