mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MINOR Specifically turning off Transliterator in FileNameFilterTest, was assumed to be on regardless of setting (surfaced by d1ebe1ce9
)
This commit is contained in:
parent
4a2fe9877d
commit
ea7310c36a
@ -8,6 +8,7 @@ class FileNameFilterTest extends SapphireTest {
|
||||
function testFilter() {
|
||||
$name = 'Brötchen für allë-mit_Unterstrich!.jpg';
|
||||
$filter = new FileNameFilter();
|
||||
$filter->setTransliterator(false);
|
||||
$this->assertEquals(
|
||||
'Brtchen-fr-all-mit-Unterstrich.jpg',
|
||||
$filter->filter($name)
|
||||
@ -17,7 +18,7 @@ class FileNameFilterTest extends SapphireTest {
|
||||
function testFilterWithTransliterator() {
|
||||
$name = 'Brötchen für allë-mit_Unterstrich!.jpg';
|
||||
$filter = new FileNameFilter();
|
||||
$filter->setTransliterator(Object::create('Transliterator'));
|
||||
$filter->setTransliterator(new Transliterator());
|
||||
$this->assertEquals(
|
||||
'Broetchen-fuer-alle-mit-Unterstrich.jpg',
|
||||
$filter->filter($name)
|
||||
@ -25,11 +26,12 @@ class FileNameFilterTest extends SapphireTest {
|
||||
}
|
||||
|
||||
function testFilterWithCustomRules() {
|
||||
$name = 'Brötchen für allë-mit_Unterstrich!.jpg';
|
||||
$name = 'Kuchen ist besser.jpg';
|
||||
$filter = new FileNameFilter();
|
||||
$filter->setTransliterator(false);
|
||||
$filter->setReplacements(array('/[\s-]/' => '_'));
|
||||
$this->assertEquals(
|
||||
'Brötchen__für_allë_mit_Unterstrich!.jpg',
|
||||
'Kuchen_ist_besser.jpg',
|
||||
$filter->filter($name)
|
||||
);
|
||||
}
|
||||
@ -37,6 +39,7 @@ class FileNameFilterTest extends SapphireTest {
|
||||
function testFilterWithEmptyString() {
|
||||
$name = 'ö ö ö.jpg';
|
||||
$filter = new FileNameFilter();
|
||||
$filter->setTransliterator(new Transliterator());
|
||||
$result = $filter->filter($name);
|
||||
$this->assertFalse(
|
||||
empty($result)
|
||||
|
Loading…
Reference in New Issue
Block a user