CustomClientIdempotencyKeyUnitTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
eloc 7
c 1
b 0
f 1
dl 0
loc 28
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testSetIdempotencyKey() 0 8 1
A testIdempotencyGetSet() 0 9 1
1
<?php
2
namespace Mezon\CustomClient\Tests;
3
4
use PHPUnit\Framework\TestCase;
5
use Mezon\CustomClient\CustomClient;
6
7
/**
8
 *
9
 * @psalm-suppress PropertyNotSetInConstructor
10
 */
11
class CustomClientIdempotencyKeyUnitTest extends TestCase
12
{
13
14
    /**
15
     * Testing getters/setters for the field
16
     */
17
    public function testIdempotencyGetSet(): void
18
    {
19
        // setup
20
        $client = new CustomClient('some url', []);
21
22
        // test bodyand assertions
23
        $client->setIdempotencyKey('i-key');
24
25
        $this->assertEquals('i-key', $client->getIdempotencyKey(), 'Invalid idempotency key');
26
    }
27
28
    /**
29
     * Testing setting idempotency key
30
     */
31
    public function testSetIdempotencyKey(): void
32
    {
33
        // setup
34
        $client = new TestClient('http://unit.test');
35
        $client->setIdempotencyKey('iKey');
36
37
        // test body and assertions
38
        $this->assertStringContainsString('iKey', implode('', $client->getCommonHeadersPublic()));
39
    }
40
}
41