Exemplo n.º 1
0
 /**
  * @covers Fuel\Common\Arr::pluck
  * @group Common
  */
 public function testPluck()
 {
     $collection = array(array('id' => 2, 'name' => 'Bill', 'surname' => 'Cosby'), array('id' => 5, 'name' => 'Chris', 'surname' => 'Rock'), array('id' => 7, 'name' => 'Bert', 'surname' => 'Visser'));
     $ids = Arr::pluck($collection, 'id');
     $this->assertEquals(array(2, 5, 7), $ids);
     $names = Arr::pluck($collection, 'name', 'id');
     $this->assertEquals(array(2 => 'Bill', 5 => 'Chris', 7 => 'Bert'), $names);
 }