ManufacturerUrlSuffixProviderTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 23
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A testProviderReturnsCorrectUrlSuffix() 0 18 1
1
<?php
2
/**
3
 * File: ManufacturerUrlSuffixProviderTest.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\Url;
10
11
use MSlwk\Otomoto\App\Manufacturer\Data\ManufacturerDTO;
12
use MSlwk\Otomoto\App\Manufacturer\Url\ManufacturerUrlSuffixProvider;
13
use MSlwk\Otomoto\App\Slugify\SlugifierInterface;
14
use PHPUnit\Framework\MockObject\MockObject;
15
use PHPUnit\Framework\TestCase;
16
17
/**
18
 * Class ManufacturerUrlSuffixProviderTest
19
 * @package MSlwk\Otomoto\App\Test\Unit\Manufacturer\Url
20
 */
21
class ManufacturerUrlSuffixProviderTest extends TestCase
22
{
23
    /**
24
     * @test
25
     */
26
    public function testProviderReturnsCorrectUrlSuffix()
27
    {
28
        /** @var MockObject|SlugifierInterface $slugifier */
29
        $slugifier = $this->getMockBuilder(SlugifierInterface::class)
30
            ->disableOriginalConstructor()
31
            ->getMock();
32
33
        $suffixProvider = new ManufacturerUrlSuffixProvider($slugifier);
34
35
        $manufacturerDTO = new ManufacturerDTO('Alfa Romeo');
36
        $slugifier->expects($this->once())
37
            ->method('slugify')
38
            ->with($manufacturerDTO->getName())
39
            ->will($this->returnValue('alfa-romeo'));
40
41
        $expectedSuffix = '/osobowe/alfa-romeo/';
42
43
        $this->assertEquals($expectedSuffix, $suffixProvider->getUrlSuffix($manufacturerDTO));
44
    }
45
}
46