/** * @author nathanhelenihi * @group api * @dataProvider fixtureAuthCfgObject */ public function testCallApi(array $fxt) { if (!$fxt['from_env']) { $this->markTestSkipped('Environment credentials not set.'); } $obj = new LoopBookingCreate($fxt); $obj->setConfig('dataFormat', 'xml'); if (!$obj->isEnabled()) { $this->markTestSkipped('API is disabled!'); } $auth = $fxt['auth']; $xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n <LoopBookingCreate>\n <Auth>\n <VendorId>{$auth->vendorId}</VendorId>\n <VendorPassword>{$auth->vendorPassword}</VendorPassword>\n <UserId>{$auth->userId}</UserId>\n <UserPassword>{$auth->userPassword}</UserPassword>\n <PropertyId>{$auth->propertyId}</PropertyId>\n </Auth>\n <StartDate>2014-12-12</StartDate>\n <EndDate>2014-12-14</EndDate>\n <Units>1</Units>\n <RoomTypeId>23651</RoomTypeId>\n <RateId>123</RateId>\n <RoomDayRate>100.00</RoomDayRate>\n <RoomDayDescription>A description</RoomDayDescription>\n <CustomerFName>Frank</CustomerFName>\n <CustomerLName>Blue</CustomerLName>\n <RoomDesc>A description</RoomDesc>\n <OccupantSmoker>false</OccupantSmoker>\n <OccupantNote>Please not by elevator!</OccupantNote>\n <OccupantFName>Frank</OccupantFName>\n <OccupantLName>Blue</OccupantLName>\n <Occupancy>1</Occupancy>\n <Policy>No smoking.</Policy>\n <ChannelRoomType>123</ChannelRoomType>\n </LoopBookingCreate>\n "; $rsp = $obj->callApiWithParams($xml); $this->assertEquals(200, $rsp['response']['code']); $this->assertFalse(strpos($rsp['response']['body'], '<Errors>'), 'Response contains errors!'); }
/** * @author nathanhelenihi * @group api * @dataProvider fixtureAuthCfgObject */ public function testCallApi(array $fxt) { print_r($fxt); if (!$fxt['from_env']) { $this->markTestSkipped('Environment credentials not set.'); } $obj = new LoopBookingCreate($fxt); $obj->setConfig('dataFormat', 'array'); if (!$obj->isEnabled()) { $this->markTestSkipped('API is disabled!'); } // Create a booking $data = array('Booking' => array('StartDate' => '2014-12-10', 'EndDate' => '2014-12-13', 'Units' => '1', 'RoomTypeId' => '23651', 'RateId' => '123', 'RoomDayRate' => '100.00', 'RoomDayDescription' => 'A fun RoomDay!', 'CustomerFName' => 'Nathan', 'CustomerLName' => 'Meeper', 'RoomDesc' => 'A fun RoomDesc!', 'OccupantSmoker' => 'true', 'OccupantNote' => 'Please do not put me by the elevator. Thanks!', 'OccupantFName' => 'Nathan', 'OccupantLName' => 'Meeper', 'Occupancy' => '1', 'Policy' => 'No smoking.', 'ChannelRoomType' => '123')); $rsp = $obj->callApiWithParams($data); $this->assertTrue(isset($rsp['response']['body']['Booking'])); }