Passed
Push — master ( 5b00d5...84fad3 )
by Sergey
49s queued 13s
created

GetWarehouseTypesTest::assertIsWarehouseType()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 6
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SergeyNezbritskiy\Tests\Integration\Models\Address;
6
7
use PHPUnit\Framework\TestCase;
8
use SergeyNezbritskiy\NovaPoshta\Models\Address;
9
use SergeyNezbritskiy\NovaPoshta\NovaPoshtaApiException;
10
use SergeyNezbritskiy\NovaPoshta\Tests\UsesConnectionTrait;
11
12
class GetWarehouseTypesTest extends TestCase
13
{
14
    use UsesConnectionTrait;
15
16
    private Address $model;
17
18
    protected function setUp(): void
19
    {
20
        $connection = $this->getConnection();
21
        $this->model = new Address($connection);
22
    }
23
24
    /**
25
     * @return void
26
     * @throws NovaPoshtaApiException
27
     */
28
    public function testGetWarehouseTypes(): void
29
    {
30
        $actualResult = $this->model->getWarehouseTypes();
31
        $this->assertNotEmpty($actualResult);
32
        $this->assertIsWarehouseType(array_shift($actualResult));
33
    }
34
35
    /**
36
     * @param array $type
37
     * @return void
38
     */
39
    private function assertIsWarehouseType(array $type): void
40
    {
41
        $this->assertCount(3, $type);
42
        $this->assertArrayHasKey('Ref', $type);
0 ignored issues
show
Bug introduced by
It seems like $type can also be of type Countable; however, parameter $array of PHPUnit\Framework\Assert::assertArrayHasKey() does only seem to accept ArrayAccess|array, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

42
        $this->assertArrayHasKey('Ref', /** @scrutinizer ignore-type */ $type);
Loading history...
43
        $this->assertArrayHasKey('DescriptionRu', $type);
44
        $this->assertArrayHasKey('Description', $type);
45
    }
46
}
47