/** * @author nathanhelenihi * @group api * @dataProvider fixtureAuthCfgObject */ public function testCallApi(array $fxt) { if (!$fxt['from_env']) { $this->markTestSkipped('Environment credentials not set.'); } $obj = new PropertyCreate($fxt); $obj->setConfig('dataFormat', 'array'); if (!$obj->isEnabled()) { $this->markTestSkipped('API is disabled!'); } // Successful call $rsp = $obj->callApiWithParams(array('PropertyName' => 'PHP SDK Hotel G', 'ExpiryDate' => '2014-12-20', 'Currency' => 'USD', 'Country' => 'US', 'Breakfast' => 'EX')); $this->assertTrue(isset($rsp['response']['body']['Success'])); $this->assertEquals($rsp['response']['body']['Success'], 'true'); }
/** * @author nathanhelenihi * @group api * @dataProvider fixtureAuthCfgObject */ public function testCallApi(array $fxt) { if (!$fxt['from_env']) { $this->markTestSkipped('Environment credentials not set.'); } $obj = new PropertyCreate($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 <PropertyCreate>\n <Auth>\n <VendorId>{$auth->vendorId}</VendorId>\n <VendorPassword>{$auth->vendorPassword}</VendorPassword>\n <UserToken>{$auth->userToken}</UserToken>\n </Auth>\n <PropertyName>PHP SDK Hotel H</PropertyName>\n <ExpiryDate>2014-12-20</ExpiryDate>\n <Currency>USD</Currency>\n <Country>US</Country>\n <Breakfast>EX</Breakfast>\n </PropertyCreate>\n "; $rsp = $obj->callApiWithParams($xml); $this->assertEquals(200, $rsp['response']['code']); $this->assertFalse(strpos($rsp['response']['body'], '<Errors>'), 'Response contains errors!'); }