testValidationPasses()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * File: ManufacturersScrappedValidatorTest.php
4
 *
5
 * @author      Maciej Sławik <[email protected]>
6
 * Github:      https://github.com/maciejslawik
7
 */
8
9
namespace MSlwk\Otomoto\App\Test\Unit\Manufacturer\Validator;
10
11
use MSlwk\Otomoto\App\Exception\ManufacturersNotFoundException;
12
use MSlwk\Otomoto\App\Manufacturer\Data\ManufacturerDTO;
13
use MSlwk\Otomoto\App\Manufacturer\Data\ManufacturerDTOArray;
14
use MSlwk\Otomoto\App\Manufacturer\Validator\ManufacturersScrappedValidator;
15
use PHPUnit\Framework\TestCase;
16
17
/**
18
 * Class ManufacturersScrappedValidatorTest
19
 * @package MSlwk\Otomoto\App\Test\Unit\Manufacturer\Validator
20
 */
21
class ManufacturersScrappedValidatorTest extends TestCase
22
{
23
    /**
24
     * @var ManufacturersScrappedValidator
25
     */
26
    private $validator;
27
28
    /**
29
     * @return void
30
     */
31
    protected function setUp()
32
    {
33
        $this->validator = new ManufacturersScrappedValidator();
34
    }
35
36
    /**
37
     * @test
38
     */
39
    public function testValidationPasses()
40
    {
41
        $manufacturerDTO = new ManufacturerDTO('manufacturer');
42
        $manufacturerDTOArray = new ManufacturerDTOArray($manufacturerDTO);
43
44
        $this->assertEmpty($this->validator->validate($manufacturerDTOArray));
0 ignored issues
show
Bug introduced by
Are you sure the usage of $this->validator->validate($manufacturerDTOArray) targeting MSlwk\Otomoto\App\Manufa...edValidator::validate() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
45
    }
46
47
    /**
48
     * @test
49
     */
50
    public function testValidationThrowsException()
51
    {
52
        $manufacturerDTOArray = new ManufacturerDTOArray();
53
54
        $this->expectException(ManufacturersNotFoundException::class);
55
        $this->validator->validate($manufacturerDTOArray);
56
    }
57
}
58