/**
  * @expectedException RuntimeException
  */
 public function testWalkFailsForInvalidCallback()
 {
     $xao = new XArray([1, 2]);
     // ArrayObject::count() is non-static and accepts no parameters
     // though the syntax for the callable is correct the execution will fail
     $xao->map(['ArrayObject', 'count']);
 }
 public function testGetPreviousObject()
 {
     $xao = new XArray([1, 2, 3]);
     $obj = $xao->map(function ($value) {
         return 2 * $value;
     });
     $this->assertSame($xao, $obj->back());
 }
 public function testFilterAcceptsCallback()
 {
     $array = [1, 2, 3];
     $xao = new XArray($array);
     $test = new CallbackTestMethods();
     $obj = $xao->map([$test, 'filter']);
     $this->assertEquals($array, (array) $obj);
 }
 /**
  * @depends testMapAcceptsFunction
  */
 public function testMapPreserveKeys()
 {
     $array = ['x' => 28, 'y' => 68, 'z' => 4];
     $xao = new XArray($array);
     $this->assertEquals($array, (array) $xao->map('test_map', true));
 }