예제 #1
0
 public function test()
 {
     $imp = new Imp();
     $imp->setId('bbb');
     $bidRequest = new BidRequest();
     $bidRequest->setId('aaa')->addImp($imp);
     $this->assertTrue(is_array($bidRequest->toArray()));
 }
예제 #2
0
 public function testMapFromObject()
 {
     $demoMap = ['Native.Request' => 'Id', 'Id' => 'Imp[].Id'];
     $map = MapFactory::create($demoMap);
     $imp = new Imp();
     $imp->setId('impId');
     $bidRequest = new BidRequest();
     $bidRequest->setId('bidRequestId')->addImp($imp);
     $mapper = new Mapper();
     $arrayMapped = $mapper->mapFromObject($map, $bidRequest);
     $this->assertTrue(is_array($arrayMapped));
     $this->assertEquals('bidRequestId', $arrayMapped['native']['request']);
     $this->assertEquals('impId', $arrayMapped['id']);
 }