/** * @dataProvider searchResultsProvider */ public function test_Properties($data) { $data = json_decode($data)[0]; $sellerInfo = $this->sellerFactory->create($data); $this->assertInstanceOf('\\TravelPSDK\\Flight\\Seller\\Info', $sellerInfo); $ticketFactory = new TicketFactory($sellerInfo); $this->assertTrue(isset($data->proposals)); $this->assertInternalType('array', $data->proposals); foreach ($data->proposals as $proposal) { $ticket = $ticketFactory->create($proposal); $this->doPropertiesTest($ticket); } }
/** * @param SellerInfo $sellerInfo * @return \ArrayIterator */ private function buildTicketsCollection($sellerInfo) { $proposals = $this->sellerData->proposals; $collection = new TicketsCollection(); if (empty($proposals)) { return $collection; } $ticketFactory = new TicketFactory($sellerInfo); foreach ($proposals as $proposal) { $ticket = $ticketFactory->create($proposal); $collection->append($ticket); } return $collection; }