GetDocumentDeliveryDateTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A testGetDeliveryDateTest() 0 9 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SergeyNezbritskiy\NovaPoshta\Tests\Integration\Models\InternetDocument;
6
7
use DateTime;
8
use PHPUnit\Framework\TestCase;
9
use SergeyNezbritskiy\NovaPoshta\Models\InternetDocument;
10
use SergeyNezbritskiy\NovaPoshta\NovaPoshtaApiException;
11
use SergeyNezbritskiy\NovaPoshta\Tests\AssertEntityByPropertiesTrait;
12
use SergeyNezbritskiy\NovaPoshta\Tests\ConstantsInterface;
13
use SergeyNezbritskiy\NovaPoshta\Tests\UsesConnectionTrait;
14
15
class GetDocumentDeliveryDateTest extends TestCase implements ConstantsInterface
16
{
17
    use AssertEntityByPropertiesTrait;
18
    use UsesConnectionTrait;
19
20
    private InternetDocument $model;
21
22
    protected function setUp(): void
23
    {
24
        $connection = $this->getConnection();
25
        $this->model = new InternetDocument($connection);
26
    }
27
28
    /**
29
     * @throws NovaPoshtaApiException
30
     */
31
    public function testGetDeliveryDateTest(): void
32
    {
33
        $actualResult = $this->model->getDocumentDeliveryDate([
34
            'DateTime' => (new DateTime())->format('d.m.Y'),
35
            'ServiceType' => 'WarehouseWarehouse',
36
            'CitySender' => self::CITY_REF_KHARKIV,
37
            'CityRecipient' => self::CITY_REF_KYIV,
38
        ]);
39
        $this->assertEntity($actualResult, ['date', 'timezone', 'timezone_type']);
40
    }
41
}
42