/** * @dataProvider mappedData */ public function testMapping($path, $map, $expected) { $mapper = new DataMapper(); foreach ($map as $key => $value) { // Don't judge me, I'm lazy is_int($key) && $key < 100 ? $mapper->map($value) : $mapper->map($key, $value); } $this->assertEquals($expected, $mapper->data($path)); }
/** * @param $array * @return array */ public function formatArray($array) { $map = new Map($this->mapping); $dataMapper = new DataMapper(); $dataMapper->setMap($map); $result = array(); foreach ($array as $value) { $result[] = $dataMapper->map($value); } return $result; }