From e2d180a754eadf026e1a7f288143184e08ffaa20 Mon Sep 17 00:00:00 2001 From: "Cochrane, Mike" Date: Mon, 9 May 2016 20:03:58 +1200 Subject: [PATCH] Explictly set the FileNameFilter replacements before testing them --- tests/filesystem/FileNameFilterTest.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/filesystem/FileNameFilterTest.php b/tests/filesystem/FileNameFilterTest.php index af07208dd..902c83857 100644 --- a/tests/filesystem/FileNameFilterTest.php +++ b/tests/filesystem/FileNameFilterTest.php @@ -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();