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
|
|
|
use Suilven\Sluggable\Tests\Model\SluggestTestObject; |
13
|
|
|
|
14
|
|
|
class SluggableObjectTest extends SapphireTest |
15
|
|
|
{ |
16
|
|
|
public static function setUpBeforeClass() |
17
|
|
|
{ |
18
|
|
|
parent::setUpBeforeClass(); |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @todo How does one add an extension during tests? |
22
|
|
|
\Page::add_extension(Sluggable::class); |
23
|
|
|
$kernel = Injector::inst()->get(Kernel::class); |
24
|
|
|
ScheduledFlushDiscoverer::scheduleFlush($kernel); |
25
|
|
|
* */ |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
public function testLowerCase() |
29
|
|
|
{ |
30
|
|
|
$this->assertEquals('this-is-lower-case', $this->getSlugFromDataObject('this is lower case')); |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
public function testUpperCase() |
34
|
|
|
{ |
35
|
|
|
$this->assertEquals('this-is-upper-case', $this->getSlugFromDataObject('THIS IS UPPER CASE')); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
public function textMixedCase() |
39
|
|
|
{ |
40
|
|
|
$this->assertEquals('this-is-mixed-case', $this->getSlugFromDataObject('THIs-Is-Mixed-case')); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
public function testEmptyString() |
44
|
|
|
{ |
45
|
|
|
$this->assertEquals('', $this->getSlugFromDataObject('')); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
private function getSlugFromDataObject($title) |
49
|
|
|
{ |
50
|
|
|
$object = new SluggestTestObject(); |
51
|
|
|
$object->DisplayName = $title; |
52
|
|
|
$object->write(); |
53
|
|
|
return $object->Slug; |
54
|
|
|
} |
55
|
|
|
} |
56
|
|
|
|
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