1
|
|
|
<?php |
2
|
|
|
namespace Suilven\Sluggable\Tests; |
3
|
|
|
|
4
|
|
|
use SilverStripe\CMS\Model\SiteTree; |
|
|
|
|
5
|
|
|
use SilverStripe\Core\Config\Config; |
|
|
|
|
6
|
|
|
use SilverStripe\Core\Injector\Injector; |
|
|
|
|
7
|
|
|
use SilverStripe\Core\Kernel; |
|
|
|
|
8
|
|
|
use SilverStripe\Core\Startup\ScheduledFlushDiscoverer; |
|
|
|
|
9
|
|
|
use SilverStripe\Dev\SapphireTest; |
|
|
|
|
10
|
|
|
use Suilven\Sluggable\Extension\Sluggable; |
11
|
|
|
use Suilven\Sluggable\Helper\SluggableHelper; |
12
|
|
|
|
13
|
|
|
class SluggableHelperTest extends SapphireTest |
14
|
|
|
{ |
15
|
|
|
public static function setUpBeforeClass() |
16
|
|
|
{ |
17
|
|
|
parent::setUpBeforeClass(); |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @todo How does one add an extension during tests? |
21
|
|
|
\Page::add_extension(Sluggable::class); |
22
|
|
|
$kernel = Injector::inst()->get(Kernel::class); |
23
|
|
|
ScheduledFlushDiscoverer::scheduleFlush($kernel); |
24
|
|
|
* */ |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
public function testLowerCase() |
28
|
|
|
{ |
29
|
|
|
$this->assertEquals('this-is-lower-case', $this->getSlug('this is lower case')); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
public function testUpperCase() |
33
|
|
|
{ |
34
|
|
|
$this->assertEquals('this-is-upper-case', $this->getSlug('THIS IS UPPER CASE')); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
public function textMixedCase() |
38
|
|
|
{ |
39
|
|
|
$this->assertEquals('this-is-mixed-case', $this->getSlug('THIs-Is-Mixed-case')); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
public function testEmptyString() |
43
|
|
|
{ |
44
|
|
|
$this->assertEquals('', $this->getSlug('')); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
private function getSlug($title) |
48
|
|
|
{ |
49
|
|
|
$helper = new SluggableHelper(); |
50
|
|
|
return $helper->getSlug($title); |
51
|
|
|
} |
52
|
|
|
} |
53
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths