Completed
Pull Request — master (#2748)
by Jeroen
14:58
created

SlugifierTest::tearDown()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Tests\Kunstmaan\NodeBundle\Helper;
4
5
use Kunstmaan\UtilitiesBundle\Helper\Slugifier;
6
use PHPUnit\Framework\TestCase;
7
8
/**
9
 * SlugifierTest
10
 */
11
class SlugifierTest extends TestCase
12
{
13
    /**
14
     * @var Slugifier
15
     */
16
    private $slugifier;
17
18
    /**
19
     * {@inheritdoc}
20
     */
21
    public function setUp(): void
22
    {
23
        $this->slugifier = new Slugifier();
24
    }
25
26
    /**
27
     * @param string $text   The text to slugify
28
     * @param string $result The slug it should generate
29
     *
30
     * @dataProvider getSlugifyData
31
     */
32
    public function testSlugify($text, $result)
33
    {
34
        $this->assertEquals($result, $this->slugifier->slugify($text));
35
    }
36
37
    /**
38
     * Provides data to the {@link testSlugify} function
39
     *
40
     * @return array
0 ignored issues
show
Documentation introduced by
Consider making the return type a bit more specific; maybe use string[][].

This check looks for the generic type array as a return type and suggests a more specific type. This type is inferred from the actual code.

Loading history...
41
     */
42
    public function getSlugifyData()
43
    {
44
        return [
45
            ['', ''],
46
            ['test', 'test'],
47
            ['een titel met spaties', 'een-titel-met-spaties'],
48
            ['à partir d\'aujourd\'hui', 'a-partir-daujourdhui'],
49
            ['CaPs ShOulD be LoweRCasEd', 'caps-should-be-lowercased'],
50
            ['áàäåéèëíìïóòöúùüñßæ', 'aaaaeeeiiiooouuunssae'],
51
            ['polish-ążśźęćńół', 'polish-azszecnol'],
52
        ];
53
    }
54
}
55