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
|
|||
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 |
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.