Passed
Pull Request — master (#3)
by Sergey
02:10
created

ClientTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 9
c 1
b 0
f 0
dl 0
loc 21
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testNotSupportedProperty() 0 6 1
A setUp() 0 3 1
A testAddressModelProperty() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SergeyNezbritskiy\NovaPoshta\Tests\Unit;
6
7
use Exception;
8
use PHPUnit\Framework\TestCase;
9
use SergeyNezbritskiy\NovaPoshta\Client;
10
use SergeyNezbritskiy\NovaPoshta\Models\Address;
11
12
/**
13
 * Class ClientTest
14
 * Unit test for \SergeyNezbritskiy\NovaPoshta\Client
15
 * @see Client
16
 */
17
class ClientTest extends TestCase
18
{
19
    private Client $object;
20
21
    protected function setUp(): void
22
    {
23
        $this->object = new Client('some-key');
24
    }
25
26
    public function testAddressModelProperty(): void
27
    {
28
        $addressModel = $this->object->address;
29
        $this->assertInstanceOf(Address::class, $addressModel);
30
    }
31
32
    public function testNotSupportedProperty(): void
33
    {
34
        $property = 'someNotSupportedModel';
35
        $this->expectExceptionMessage('Model `someNotSupportedModel` not supported by Nova Poshta API Client');
36
        $this->expectException(Exception::class);
37
        $this->object->$property;
38
    }
39
}
40