本文整理匯總了PHP中Configuration::setHost方法的典型用法代碼示例。如果您正苦於以下問題:PHP Configuration::setHost方法的具體用法?PHP Configuration::setHost怎麽用?PHP Configuration::setHost使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Configuration
的用法示例。
在下文中一共展示了Configuration::setHost方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testConfiguration
/**
* 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());
}
示例2: testGetInventory
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']);
}
示例3: testSetHost
public function testSetHost()
{
$configuration = new Configuration('my-host');
$configuration->setHost('other-host');
$this->assertAttributeEquals('other-host', 'host', $configuration);
}