Completed
Push — to-be-a-hat-or-not-to-be-kuhwa ( 7c7f7b...b72886 )
by Kamil
20:35
created

SlugGeneratorSpec::it_is_initializable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace spec\Sylius\Component\Product\Generator;
13
14
use PhpSpec\ObjectBehavior;
15
use Sylius\Component\Product\Generator\SlugGenerator;
16
use Sylius\Component\Product\Generator\SlugGeneratorInterface;
17
18
/**
19
 * @author Mateusz Zalewski <[email protected]>
20
 */
21
final class SlugGeneratorSpec extends ObjectBehavior
22
{
23
    function it_is_initializable()
24
    {
25
        $this->shouldHaveType(SlugGenerator::class);
26
    }
27
28
    function it_implements_slug_generator_interface()
29
    {
30
        $this->shouldImplement(SlugGeneratorInterface::class);
31
    }
32
33
    function it_generates_slug_based_on_given_name()
34
    {
35
        $this->generate('Cyclades')->shouldReturn('cyclades');
36
        $this->generate('Small World')->shouldReturn('small-world');
37
    }
38
39
    function it_generates_slug_without_punctuation_marks()
40
    {
41
        $this->generate('"Ticket to Ride: Europe"')->shouldReturn('ticket-to-ride-europe');
42
        $this->generate('Tzolk\'in: The Mayan Calendar')->shouldReturn('tzolk-in-the-mayan-calendar');
43
        $this->generate('Game of Thrones: The Board Game')->shouldReturn('game-of-thrones-the-board-game');
44
    }
45
46
    function it_generates_slug_without_special_signs()
47
    {
48
        $this->generate('Wsiąść do Pociągu: Europa')->shouldReturn('wsiasc-do-pociagu-europa');
49
    }
50
}
51