Passed
Push — master ( d657dc...438755 )
by Alex
07:49
created

CustomClientIdempotencyKeyUnitTest   A

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
class CustomClientIdempotencyKeyUnitTest extends TestCase
8
{
9
10
    /**
11
     * Testing getters/setters for the field
12
     */
13
    public function testIdempotencyGetSet(): void
14
    {
15
        // setup
16
        $client = new CustomClient('some url', []);
17
18
        // test bodyand assertions
19
        $client->setIdempotencyKey('i-key');
20
21
        $this->assertEquals('i-key', $client->getIdempotencyKey(), 'Invalid idempotency key');
22
    }
23
24
    /**
25
     * Testing setting idempotency key
26
     */
27
    public function testSetIdempotencyKey(): void
28
    {
29
        // setup
30
        $client = new TestClient('http://unit.test');
31
        $client->setIdempotencyKey('iKey');
32
33
        // test body and assertions
34
        $this->assertStringContainsString('iKey', implode('', $client->getCommonHeadersPublic()));
35
    }
36
}
37