public function testMapFromArray() { $demoMap = ['BidRequest.Imp[].Native.Request:@required' => 'request', 'BidRequest.Imp[].Id' => 'id']; $map = MapFactory::create($demoMap); $source = ['request' => 'native', 'id' => '123']; $mapper = new Mapper(); $arrayMapped = $mapper->mapFromArray($map, $source); $myObject = new BidRequest(); Hydrator::hydrate($arrayMapped, $myObject); $this->assertEquals(1, $myObject->getImp()->count()); $this->assertEquals('123', $myObject->getImp()->current()->getId()); $this->assertEquals('native', $myObject->getImp()->current()->getNative()->getRequest()); }
/** * @dataProvider jsonProvider */ public function testHydrateRecursive($json) { Hydrator::hydrate(json_decode($json, true), new BidRequest()); }