Files
openapi-generator/samples/client/petstore/php/OpenAPIClient-php/tests/DebugTest.php
William Cheng 3453c7ba10 Test PHP clients in Github workflow (#21643)
* test php clients in github workflow

* trigger build failure

* update workflow

* Revert "trigger build failure"

This reverts commit 572a69f6bcbab426103c77de55c069bd74b5e7fb.

* update tests

* update tests

* update test

* fix tests

* fix async test

* update tests
2025-07-28 18:33:52 +08:00

40 lines
1.0 KiB
PHP

<?php
namespace OpenAPI\Client;
use PHPUnit\Framework\TestCase;
class DebugTest extends TestCase
{
public static function setUpBeforeClass(): void
{
parent::setUpBeforeClass();
$newPet = new Model\Pet;
$newPet->setId(1);
$newPet->setName("PHP Unit Test");
$config = (new Configuration())->setHost('http://localhost/v2');
(new Api\PetApi(null, $config))->addPetWithHttpInfo($newPet);
}
public function testEnableDebugOutput()
{
$this->expectOutputRegex('#GET /v2/pet/1 HTTP/1.1#');
$config = (new Configuration())->setHost('http://localhost/v2');
$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())->setHost('http://localhost/v2');
$config->setDebug(true);
$api = new Api\PetApi(null, $config);
$promise = $api->getPetByIdAsync(1);
$promise->wait();
}
}