William Cheng e5be838fa8
Update PHP client default value (#417)
* update php default value

* update php samples with oas3
2018-05-11 15:28:09 +08:00

42 lines
973 B
PHP

<?php
namespace OpenAPI\Client;
use GuzzleHttp\Client;
class ExceptionTest extends \PHPUnit_Framework_TestCase
{
/**
* @expectedException \OpenAPI\Client\ApiException
* @expectedExceptionCode 404
* @expectedExceptionMessage http://petstore.swagger.io/INVALID_URL/store/inventory
*/
public function testNotFound()
{
$config = new Configuration();
$config->setHost('http://petstore.swagger.io/INVALID_URL');
$api = new Api\StoreApi(
new Client(),
$config
);
$api->getInventory();
}
/**
* @expectedException \OpenAPI\Client\ApiException
* @expectedExceptionMessage Could not resolve host
*/
public function testWrongHost()
{
$config = new Configuration();
$config->setHost('http://wrong_host.zxc');
$api = new Api\StoreApi(
new Client(),
$config
);
$api->getInventory();
}
}