Files
openapi-generator/samples/client/petstore/php/OpenAPIToolsClient-php/tests/ExceptionTest.php
Akihito Nakano 376d9af9c0 Rename default packages for php client (#315)
* Rename default packages for php client

* Generate php client (OAS3)

* Rename namespace for tests

* Delete unnecessary 'use'

* Rename method/variable

* Update php client (OAS3)

* Generate php client (OAS2)

* Rename namespace for tests

* Delete unused files

* Fix tests
2018-05-07 23:04:06 +08:00

42 lines
988 B
PHP

<?php
namespace OpenAPITools\Client;
use GuzzleHttp\Client;
class ExceptionTest extends \PHPUnit_Framework_TestCase
{
/**
* @expectedException \OpenAPITools\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 \OpenAPITools\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();
}
}