/** * @author nathanhelenihi * @group api * @dataProvider fixtureAuthCfgObject */ public function testCallApi(array $fxt) { if (!$fxt['from_env']) { $this->markTestSkipped('Environment credentials not set.'); } $obj = new ARIUpdateStatus($fxt); $obj->setConfig('dataFormat', 'array'); if (!$obj->isEnabled()) { $this->markTestSkipped('API is disabled!'); } // No required 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'); } /* // Invalid update id should fail $rsp = $obj->callApiWithParams(array( 'UpdateId' => '123999999999' )); print_r($rsp); $this->assertTrue(isset($rsp['response']['body']['Errors'])); $this->assertEquals($rsp['response']['body']['Errors'][0]['ErrorMsg'], 'No such booking id'); */ // Successful call $rsp = $obj->callApiWithParams(array('UpdateId' => '4464436')); $this->assertTrue(isset($rsp['response']['body']['Channels'])); }