/**
  * @author nathanhelenihi
  * @group api
  * @dataProvider fixtureAuthCfgObject
  */
 public function testCallApi(array $fxt)
 {
     if (!$fxt['from_env']) {
         $this->markTestSkipped('Environment credentials not set.');
     }
     $obj = new RoomRemove($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');
     }
     // Remove single room type
     $data = array('Room' => array('RoomId' => '23644'));
     $rsp = $obj->callApiWithParams($data);
     $this->assertTrue(isset($rsp['response']['body']['Success']));
     $this->assertEquals($rsp['response']['body']['Success'], 'true');
     // Remove multiple room types
     $data = array('Rooms' => array(array('RoomId' => '23645'), array('RoomId' => '23646'), array('RoomId' => '23647'), array('RoomId' => '23648')));
     $rsp = $obj->callApiWithParams($data);
     $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 RoomRemove($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                <RoomRemove>\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                    <RemoveRooms>\n                        <RoomTypeIds>\n                            <RoomTypeId>23655</RoomTypeId>\n                        </RoomTypeIds>\n                    </RemoveRooms>\n                </RoomRemove>\n        ";
     $rsp = $obj->callApiWithParams($xml);
     $this->assertEquals(200, $rsp['response']['code']);
     $this->assertFalse(strpos($rsp['response']['body'], '<Errors>'), 'Response contains errors!');
 }