示例#1
0
 /**
  * Tests the value of the last params in the closure in method each.
  * Case of an object.
  */
 public function testEachWithScalarByKeyAndObjects()
 {
     $data = array(0, 1);
     $objects = new resources\Foos($data);
     $result = $objects->each(function ($value, $key, $object) {
         return $object[$key] + 1;
     });
     $this->assertInstanceOf(get_class($objects), $result);
     $this->assertCount(2, $result);
     $this->assertSame(1, $result[0]);
     $this->assertSame(2, $result[1]);
 }