SluggableHelperTest   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 5
eloc 7
dl 0
loc 32
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A testMixedCase() 0 3 1
A getSlug() 0 5 1
A testEmptyString() 0 3 1
A testLowerCase() 0 3 1
A testUpperCase() 0 3 1
1
<?php declare(strict_types = 1);
2
3
namespace Suilven\Sluggable\Tests;
4
5
use SilverStripe\Dev\SapphireTest;
6
use Suilven\Sluggable\Helper\SluggableHelper;
7
8
class SluggableHelperTest extends SapphireTest
9
{
10
11
    public function testLowerCase(): void
12
    {
13
        $this->assertEquals('this-is-lower-case', $this->getSlug('this is lower case'));
14
    }
15
16
17
    public function testUpperCase(): void
18
    {
19
        $this->assertEquals('this-is-upper-case', $this->getSlug('THIS IS UPPER CASE'));
20
    }
21
22
23
    public function testMixedCase(): void
24
    {
25
        $this->assertEquals('this-is-mixed-case', $this->getSlug('THIs-Is-Mixed-case'));
26
    }
27
28
29
    public function testEmptyString(): void
30
    {
31
        $this->assertEquals('', $this->getSlug(''));
32
    }
33
34
35
    private function getSlug(string $title): string
36
    {
37
        $helper = new SluggableHelper();
38
39
        return $helper->getSlug($title);
40
    }
41
}
42