-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
Expand file tree
/
Copy pathDebugTest.php
More file actions
39 lines (32 loc) · 1.05 KB
/
DebugTest.php
File metadata and controls
39 lines (32 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?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();
}
}