ILIAS  release_7 Revision v7.30-3-g800a261c036
FilenameSanitizing.php
Go to the documentation of this file.
1<?php
2
19namespace ILIAS\Filesystem\Util;
20
21use PHPUnit\Framework\TestCase;
23
24require_once("./include/Unicode/UtfNormal.php");
25
29class FilenameSanitizing extends TestCase
30{
31 public function provideFilenames() : array
32 {
33 return [
34 ["Control\u{00a0}Character", 'ControlCharacter'],
35 ["Soft\u{00ad}Hyphen", 'SoftHyphen'],
36 ["No\u{0083}Break", 'NoBreak'],
37 ["ZeroWidth\u{200C}NonJoiner", 'ZeroWidthNonJoiner'],
38 ["ZeroWidth\u{200d}Joiner", 'ZeroWidthJoiner'],
39 ["Invisible\u{2062}Times", 'InvisibleTimes'],
40 ["Invisible\u{2063}Comma", 'InvisibleComma'],
41 ["Funky\u{200B}Whitespace", 'FunkyWhitespace'],
42 ];
43 }
44
48 public function testSanitize(string $filename, string $expected) : void
49 {
50 $this->assertEquals($expected, Util::sanitizeFilename($filename));
51 }
52}
$filename
Definition: buildRTE.php:89
An exception for terminatinating execution or to throw for unit testing.
testSanitize(string $filename, string $expected)
@dataProvider provideFilenames
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...