Example #1
0
 /**
  * Base test configuration
  */
 public function testConfiguration()
 {
     $c = new Configuration('name', 'localhost', 80);
     $this->assertEquals('name', $c->getName());
     $this->assertEquals('new_name', $c->setName('new_name')->getName());
     $this->assertEquals('localhost', $c->getHost());
     $this->assertEquals('new_localhost', $c->setHost('new_localhost')->getHost());
     $this->assertEquals(80, $c->getPort());
     $this->assertEquals(8080, $c->setPort(8080)->getPort());
     $this->assertEquals('user', $c->setUser('user')->getUser());
     $this->assertEquals('password', $c->setPassword('password')->getPassword());
     $this->assertEquals('password', $c->setPassPhrase('password')->getPassPhrase());
     $this->assertEquals(0, $c->setAuthenticationMethod(0)->getAuthenticationMethod());
     $this->assertEquals((isset($_SERVER['HOME']) ? $_SERVER['HOME'] : '~') . '/.config', $c->setConfigFile('~/.config')->getConfigFile());
     $this->assertEquals((isset($_SERVER['HOME']) ? $_SERVER['HOME'] : '~') . '/.pem', $c->setPemFile('~/.pem')->getPemFile());
     $this->assertEquals((isset($_SERVER['HOME']) ? $_SERVER['HOME'] : '~') . '/.pub', $c->setPublicKey('~/.pub')->getPublicKey());
     $this->assertEquals((isset($_SERVER['HOME']) ? $_SERVER['HOME'] : '~') . '/.private', $c->setPrivateKey('~/.private')->getPrivateKey());
 }
Example #2
0
 public function testGetInventory()
 {
     // initialize the API client
     $config = new Configuration();
     $config->setHost('http://petstore.swagger.io/v2');
     $api_client = new APIClient($config);
     $store_api = new Api\StoreApi($api_client);
     // get inventory
     $get_response = $store_api->getInventory();
     $this->assertInternalType("int", $get_response['sold']);
     $this->assertInternalType("int", $get_response['pending']);
 }
Example #3
0
 public function testSetHost()
 {
     $configuration = new Configuration('my-host');
     $configuration->setHost('other-host');
     $this->assertAttributeEquals('other-host', 'host', $configuration);
 }