/** * @author nathanhelenihi * @group api * @dataProvider fixtureAuthCfgObject */ public function testCallApi(array $fxt) { if (!$fxt['from_env']) { $this->markTestSkipped('Environment credentials not set.'); } $obj = new ARIUpdate($fxt); $obj->setConfig('dataFormat', 'xml'); if (!$obj->isEnabled()) { $this->markTestSkipped('API is disabled!'); } $auth = $fxt['auth']; //<loop_delay>10</loop_delay> $options = "\n <Options>\n <QueryForStatus>true</QueryForStatus>\n <loop_delay>30</loop_delay>\n <FailIfUpdateActive>false</FailIfUpdateActive>\n </Options>\n "; $xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n <ARIUpdate>\n <Auth>\n <VendorId>{$auth->vendorId}</VendorId>\n <VendorPassword>{$auth->vendorPassword}</VendorPassword>\n <UserToken>{$auth->userToken}</UserToken>\n <PropertyId>{$auth->propertyId}</PropertyId>\n </Auth>\n " . $options . "\n <Channels>\n <Channel>loop</Channel>\n <Channel>boo</Channel>\n </Channels>\n <Allocations>\n <Allocation>\n <RoomId>23651</RoomId>\n <StartDate>2014-12-01</StartDate>\n <EndDate>2014-12-30</EndDate>\n <Units>2</Units>\n <MinStay>1</MinStay>\n <MaxStay>3</MaxStay>\n <Prices>\n <Price>451.00</Price>\n <Price weekend=\"true\">500.00</Price>\n </Prices>\n </Allocation>\n <Allocation>\n <RoomId>23651</RoomId>\n <StartDate>2014-12-10</StartDate>\n <EndDate>2014-12-10</EndDate>\n <Units>2</Units>\n <MinStay>1</MinStay>\n <MaxStay>3</MaxStay>\n <Prices>\n <Price>700.00</Price>\n <Price weekend=\"true\">800.00</Price>\n </Prices>\n </Allocation>\n <Allocation>\n <RoomId>22905</RoomId>\n <StartDate>2014-12-11</StartDate>\n <EndDate>2014-12-11</EndDate>\n <Units>2</Units>\n <MinStay>1</MinStay>\n <MaxStay>3</MaxStay>\n <Prices>\n <Price>700.00</Price>\n <Price weekend=\"true\">800.00</Price>\n </Prices>\n </Allocation>\n </Allocations>\n </ARIUpdate>\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) { if (!$fxt['from_env']) { $this->markTestSkipped('Environment credentials not set.'); } $obj = new ARIUpdate($fxt); $obj->setConfig('dataFormat', 'array'); if (!$obj->isEnabled()) { $this->markTestSkipped('API is disabled!'); } /* $data = array( 'Options' => array( 'QueryForStatus' => 'true', //'loop_delay' => 30, 'FailIfUpdateActive' => 'false' ), 'Channels' => array( 'air', 'boo', 'loc' //'all' ), 'Allocations' => array( array( 'RoomId' => '23651', 'StartDate' => '2015-01-05', 'EndDate' => '2017-01-07', 'Units' => '2', 'MinStay' => '1', 'MaxStay' => '3', 'Price' => '30.00', 'Price-Weekend' => '40.00' ), array( 'RoomId' => '23651', 'StartDate' => '2014-12-10', 'EndDate' => '2014-12-10', 'Units' => '2', 'MinStay' => '1', 'MaxStay' => '3', 'Price' => '1.00', 'Price-Weekend' => '2.00' ), array( 'RoomId' => '22905', 'StartDate' => '2014-12-11', 'EndDate' => '2014-12-11', 'Units' => '2', 'MinStay' => '1', 'MaxStay' => '3', 'Price' => '3.00', 'Price-Weekend' => '4.00' ) ) ); */ $data = array('Options' => array('QueryForStatus' => 'true', 'FailIfUpdateActive' => 'false'), 'Channels' => array('loop', 'boo'), 'Allocations' => array(array('RoomId' => '23651', 'StartDate' => '2015-03-01', 'EndDate' => '2016-03-31', 'Units' => '5', 'MinStay' => '1', 'Price' => '50.00'))); $rsp = $obj->callApiWithParams($data); $this->assertTrue(isset($rsp['response']['body']['Success'])); }