mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Explictly set the FileNameFilter replacements before testing them
This commit is contained in:
parent
aea73cab52
commit
e2d180a754
@ -5,6 +5,18 @@
|
||||
*/
|
||||
class FileNameFilterTest extends SapphireTest {
|
||||
|
||||
public function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
Config::inst()->update('FileNameFilter', 'default_replacements', array(
|
||||
'/\s/' => '-', // remove whitespace
|
||||
'/_/' => '-', // underscores to dashes
|
||||
'/[^A-Za-z0-9+.\-]+/' => '', // remove non-ASCII chars, only allow alphanumeric plus dash and dot
|
||||
'/[\-]{2,}/' => '-', // remove duplicate dashes
|
||||
'/^[\.\-_]+/' => '', // Remove all leading dots, dashes or underscores
|
||||
));
|
||||
}
|
||||
|
||||
public function testFilter() {
|
||||
$name = 'Brötchen für allë-mit_Unterstrich!.jpg';
|
||||
$filter = new FileNameFilter();
|
||||
|
Loading…
Reference in New Issue
Block a user