/**
  * @author nathanhelenihi
  * @group api
  * @dataProvider fixtureAuthCfgObject
  */
 public function testCallApi(array $fxt)
 {
     if (!$fxt['from_env']) {
         $this->markTestSkipped('Environment credentials not set.');
     }
     $obj = new HelloUser();
     $obj->setConfig('dataFormat', 'xml');
     $auth = $fxt['auth'];
     $xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n                <HelloUser>\n                    <Auth>\n                        <UserId>{$auth->userId}</UserId>\n                        <UserPassword>{$auth->userPassword}</UserPassword>\n                    </Auth>\n                    <hello>world</hello>\n                </HelloUser>\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.');
     }
     // Auth null
     $obj = new HelloUser();
     $obj->setConfig('dataFormat', 'array');
     try {
         $rsp = $obj->callApiWithParams(array('hello' => 'world'));
     } catch (\exception $e) {
         $this->assertInstanceOf('MyAllocator\\phpsdk\\src\\Exception\\ApiAuthenticationException', $e);
     }
     // Successful call
     $obj = new HelloUser($fxt);
     $obj->setConfig('dataFormat', 'array');
     $rsp = $obj->callApiWithParams(array('hello' => 'world'));
     $this->assertTrue(isset($rsp['response']['body']['hello']));
     $this->assertEquals('world', $rsp['response']['body']['hello']);
 }