public function testMap() { $arrayObject = new ArrayObject([1, 2, 3]); $new = $arrayObject->map(function ($elem) { return $elem * 2; }); $this->assertNotSame($arrayObject, $new); $this->assertEquals([2, 4, 6], $new->getArrayCopy()); }
/** * @param string $fileName * @param ArrayObject $args * * @return Process */ private function getPhpProcess($fileName, ArrayObject $args) { $cmd = sprintf('%s %s %s', PHP_BINARY, $fileName, $args->map('escapeshellarg')->implode(' ')); return new Process($cmd, dirname($fileName), null, null, 10); }