Passed
Pull Request — master (#12)
by Sergey
02:32
created

GetTimeIntervalsTest   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 14
dl 0
loc 28
rs 10
c 1
b 0
f 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A testGetTimeIntervals() 0 11 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SergeyNezbritskiy\NovaPoshta\Tests\Integration\Models\Common;
6
7
use PHPUnit\Framework\TestCase;
8
use SergeyNezbritskiy\NovaPoshta\Models\Common;
9
use SergeyNezbritskiy\NovaPoshta\NovaPoshtaApiException;
10
use SergeyNezbritskiy\NovaPoshta\Tests\AssertEntityByPropertiesTrait;
11
use SergeyNezbritskiy\NovaPoshta\Tests\ConstantsInterface;
12
use SergeyNezbritskiy\NovaPoshta\Tests\UsesConnectionTrait;
13
14
class GetTimeIntervalsTest extends TestCase implements ConstantsInterface
15
{
16
    use AssertEntityByPropertiesTrait;
17
    use UsesConnectionTrait;
18
19
    private Common $model;
20
21
    protected function setUp(): void
22
    {
23
        $connection = $this->getConnection();
24
        $this->model = new Common($connection);
25
    }
26
27
    /**
28
     * @return void
29
     * @throws NovaPoshtaApiException
30
     */
31
    public function testGetTimeIntervals(): void
32
    {
33
        $actualResult = $this->model->getTimeIntervals(self::CITY_REF);
34
        $this->assertNotEmpty($actualResult);
35
        $entity = array_shift($actualResult);
36
        $expectedKeys = [
37
            'Number',
38
            'Start',
39
            'End',
40
        ];
41
        $this->assertEntity($entity, $expectedKeys);
42
    }
43
}
44