Completed
Push — master ( ae5e03...0447ee )
by Jeroen
10:35 queued 04:37
created

Tests/unit/Helper/SlugifierTest.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

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()
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
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
    /**
56
     * {@inheritdoc}
57
     */
58
    protected function tearDown()
59
    {
60
        parent::tearDown();
61
    }
62
}
63