Akihito Nakano e8635632a4 [PHP] Fix #6770: Debug flag is not passed (#6808)
* Add testcase which reproduces issue #6770

* Pass debug option if needed

* Update samples

* bin/php-petstore.sh
* bin/security/php-petstore.sh

* Api throws exception when failed to open debug file

* Pass debug option if needed (Async)

* Extract instance method

* Update samples

* bin/php-petstore.sh
* bin/security/php-petstore.sh
2017-11-02 17:14:00 +08:00

27 lines
669 B
PHP

<?php
namespace Swagger\Client;
class DebugTest extends \PHPUnit_Framework_TestCase
{
public function testEnableDebugOutput()
{
$this->expectOutputRegex('#GET /v2/pet/1 HTTP/1.1#');
$config = new Configuration();
$config->setDebug(true);
$api = new Api\PetApi(null, $config);
$api->getPetById(1);
}
public function testEnableDebugOutputAsync()
{
$this->expectOutputRegex('#GET /v2/pet/1 HTTP/1.1#');
$config = new Configuration();
$config->setDebug(true);
$api = new Api\PetApi(null, $config);
$promise = $api->getPetByIdAsync(1);
$promise->wait();
}
}