mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-07-20 02:13:52 +02:00
35 lines
694 B
PHP
35 lines
694 B
PHP
<?php
|
|
/**
|
|
* @package sapphire
|
|
* @subpackage tests
|
|
*/
|
|
class URLSegmentFilterTest extends SapphireTest {
|
|
|
|
function testReplacesCommonEnglishSymbols() {
|
|
$f = new URLSegmentFilter();
|
|
$f->setAllowMultibyte(false);
|
|
$this->assertEquals(
|
|
'john-and-spencer',
|
|
$f->filter('John & Spencer')
|
|
);
|
|
}
|
|
|
|
function testTransliteratesNonAsciiUrls() {
|
|
$f = new URLSegmentFilter();
|
|
$f->setAllowMultibyte(false);
|
|
$this->assertEquals(
|
|
'broetchen',
|
|
$f->filter('Brötchen')
|
|
);
|
|
}
|
|
|
|
function testRetainsNonAsciiUrlsWithAllowMultiByteOption() {
|
|
$f = new URLSegmentFilter();
|
|
$f->setAllowMultibyte(true);
|
|
$this->assertEquals(
|
|
'brötchen',
|
|
$f->filter('Brötchen')
|
|
);
|
|
}
|
|
|
|
} |