/**
  * @author nathanhelenihi
  * @group api
  * @dataProvider fixtureAuthCfgObject
  */
 public function testCallApi(array $fxt)
 {
     if (!$fxt['from_env']) {
         $this->markTestSkipped('Environment credentials not set.');
     }
     $obj = new RoomUpdate($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                <RoomUpdate>\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                    <UpdateRooms>\n                        <RoomTypes>\n                            <RoomType>\n                                <RoomId>23655</RoomId>\n                                <Label>SuiteY</Label>\n                                <Units>5</Units>\n                                <Occupancy>2</Occupancy>\n                                <Gender>MI</Gender>\n                                <PrivateRoom>true</PrivateRoom>\n                            </RoomType>\n                        </RoomTypes>\n                    </UpdateRooms>\n                </RoomUpdate>\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 RoomUpdate($fxt);
     $obj->setConfig('dataFormat', 'array');
     if (!$obj->isEnabled()) {
         $this->markTestSkipped('API is disabled!');
     }
     // No optional args should fail (at least 1 required)
     $caught = false;
     try {
         $rsp = $obj->callApiWithParams(array());
     } catch (\exception $e) {
         $caught = true;
         $this->assertInstanceOf('MyAllocator\\phpsdk\\src\\Exception\\ApiException', $e);
     }
     if (!$caught) {
         $this->fail('should have thrown an exception');
     }
     // Update single room type
     $data = array('Room' => array('RoomId' => '23649', 'Units' => '3', 'PrivateRoom' => 'true', 'Gender' => 'MA', 'Occupancy' => '2', 'Label' => 'Suite G'));
     $rsp = $obj->callApiWithParams($data);
     $this->assertTrue(isset($rsp['response']['body']['Success']));
     $this->assertEquals($rsp['response']['body']['Success'], 'true');
     // Update multiple room type
     $data = array('Rooms' => array(array('RoomId' => '23650', 'Label' => 'Suite H'), array('RoomId' => '22797', 'Label' => 'King')));
     $rsp = $obj->callApiWithParams($data);
     $this->assertTrue(isset($rsp['response']['body']['Success']));
     $this->assertEquals($rsp['response']['body']['Success'], 'true');
 }