/**
  * Tests `Collection::each`.
  */
 public function testEach()
 {
     $collection = new DocumentSet(array('data' => array('Lorem Ipsum', 'value', 'bar')));
     $collection->each(function ($value) {
         return $value . ' test';
     });
     $expected = array('Lorem Ipsum test', 'value test', 'bar test');
     $this->assertEqual($expected, $collection->to('array'));
 }
Exemple #2
0
 public function testEach()
 {
     $collection = new DocumentSet();
     $collection->set(array('title' => 'Lorem Ipsum', 'key' => 'value', 'foo' => 'bar'));
     $collection->each(function ($value) {
         return $value . ' test';
     });
     $expected = array('Lorem Ipsum test', 'value test', 'bar test');
     $this->assertEqual($collection->to('array'), $expected);
 }