-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathApiClientTest.php
More file actions
64 lines (49 loc) · 1.95 KB
/
ApiClientTest.php
File metadata and controls
64 lines (49 loc) · 1.95 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
use Openapi\Client;
use PHPUnit\Framework\TestCase;
final class ApiClientTest extends TestCase
{
private string $testToken = 'test_token_123';
public function testClientCreation(): void
{
$client = new Client($this->testToken);
$this->assertInstanceOf(Client::class, $client);
}
public function testGetRequest(): void
{
$this->markTestSkipped('Requires valid token for integration test');
$client = new Client($this->testToken);
$params = ['denominazione' => 'altravia', 'provincia' => 'RM'];
$result = $client->get('https://test.company.openapi.com/IT-advanced', $params);
$this->assertIsString($result);
}
public function testPostRequest(): void
{
$this->markTestSkipped('Requires valid token for integration test');
$client = new Client($this->testToken);
$payload = ['limit' => 10, 'query' => ['country_code' => 'IT']];
$result = $client->post('https://test.postontarget.com/fields/country', $payload);
$this->assertIsString($result);
}
public function testPutRequest(): void
{
$this->markTestSkipped('Requires valid token for integration test');
$client = new Client($this->testToken);
$result = $client->put('https://example.com/api', ['test' => 'data']);
$this->assertIsString($result);
}
public function testDeleteRequest(): void
{
$this->markTestSkipped('Requires valid token for integration test');
$client = new Client($this->testToken);
$result = $client->delete('https://example.com/api/123');
$this->assertIsString($result);
}
public function testPatchRequest(): void
{
$this->markTestSkipped('Requires valid token for integration test');
$client = new Client($this->testToken);
$result = $client->patch('https://example.com/api/123', ['update' => 'data']);
$this->assertIsString($result);
}
}