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

SlugGeneratorSpec   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 1
dl 0
loc 30
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A it_is_initializable() 0 4 1
A it_implements_slug_generator_interface() 0 4 1
A it_generates_slug_based_on_given_name() 0 5 1
A it_generates_slug_without_punctuation_marks() 0 6 1
A it_generates_slug_without_special_signs() 0 4 1
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