MINOR Specifically turning off Transliterator in FileNameFilterTest, was assumed to be on regardless of setting (surfaced by d1ebe1ce9)

This commit is contained in:
Ingo Schommer 2011-11-14 16:30:53 +01:00
parent 4a2fe9877d
commit ea7310c36a

View File

@ -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)