/**
  * @author nathanhelenihi
  * @group api
  * @dataProvider fixtureAuthCfgObject
  */
 public function testCallApi(array $fxt)
 {
     if (!$fxt['from_env']) {
         $this->markTestSkipped('Environment credentials not set.');
     }
     $obj = new BookingList($fxt);
     $obj->setConfig('dataFormat', 'xml');
     if (!$obj->isEnabled()) {
         $this->markTestSkipped('API is disabled!');
     }
     // Arrival Parameters
     $auth = $fxt['auth'];
     $xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n                <BookingList>\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                    <ArrivalStartDate>2014-12-10</ArrivalStartDate>\n                    <ArrivalEndDate>2014-12-15</ArrivalEndDate>\n                </BookingList>\n        ";
     $rsp = $obj->callApiWithParams($xml);
     $this->assertEquals(200, $rsp['response']['code']);
     $this->assertFalse(strpos($rsp['response']['body'], '<Errors>'), 'Response contains errors!');
     // Modification Parameters
     $xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n            <BookingList>\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                <ModificationStartDate>2014-12-10</ModificationStartDate>\n                <ModificationEndDate>2014-12-15</ModificationEndDate>\n            </BookingList>\n        ";
     $rsp = $obj->callApiWithParams($xml);
     $this->assertEquals(200, $rsp['response']['code']);
     $this->assertFalse(strpos($rsp['response']['body'], '<Errors>'), 'Response contains errors!');
     // Arrival Parameters
     $auth = $fxt['auth'];
     $xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n                <BookingList>\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                    <CreationStartDate>2014-12-08</CreationStartDate>\n                    <CreationEndDate>2014-12-15</CreationEndDate>\n                </BookingList>\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 BookingList($fxt);
     $obj->setConfig('dataFormat', 'array');
     if (!$obj->isEnabled()) {
         $this->markTestSkipped('API is disabled!');
     }
     // No optional parameters should throw exception
     $caught = false;
     try {
         $rsp = $obj->callApi();
     } catch (\exception $e) {
         $caught = true;
         $this->assertInstanceOf('MyAllocator\\phpsdk\\src\\Exception\\ApiException', $e);
     }
     if (!$caught) {
         $this->fail('should have thrown an exception');
     }
     /*
             // Arrival parameters
             $rsp = $obj->callApiWithParams(array(
                 'ArrivalStartDate' => '2014-11-01',
                 'ArrivalEndDate' => '2014-12-30'
             ));
             $this->assertTrue(isset($rsp['response']['body']['Bookings']));
     
             // Modification parameters
             $rsp = $obj->callApiWithParams(array(
                 'ModificationStartDate' => '2014-11-01',
                 'ModificationEndDate' => '2014-12-30'
             ));
             $this->assertTrue(isset($rsp['response']['body']['Bookings']));
     */
     // Creation parameters
     $rsp = $obj->callApiWithParams(array('ModificationStartDateTime' => '2015-01-01 00:00:00', 'ModificationEndDateTime' => '2015-07-30 00:00:00'));
     /*
             // Creation parameters
             $rsp = $obj->callApiWithParams(array(
                 'CreationStartDate' => '2015-01-01',
                 'CreationEndDate' => '2015-08-01',
                 'Options' => array(
                     'IncludeArchived' => 'true'
                 )
             ));
     */
     $this->assertTrue(isset($rsp['response']['body']['Bookings']));
 }