ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
FilenameSanitizing.php
Go to the documentation of this file.
1<?php
2
19namespace ILIAS\Filesystem\Util;
20
21use PHPUnit\Framework\Attributes\DataProvider;
22use PHPUnit\Framework\TestCase;
24
28class FilenameSanitizing extends TestCase
29{
30 public static function provideFilenames(): \Iterator
31 {
32 yield ["Control\u{00a0}Character", 'ControlCharacter'];
33 yield ["Soft\u{00ad}Hyphen", 'SoftHyphen'];
34 yield ["No\u{0083}Break", 'NoBreak'];
35 yield ["ZeroWidth\u{200C}NonJoiner", 'ZeroWidthNonJoiner'];
36 yield ["ZeroWidth\u{200d}Joiner", 'ZeroWidthJoiner'];
37 yield ["Invisible\u{2062}Times", 'InvisibleTimes'];
38 yield ["Invisible\u{2063}Comma", 'InvisibleComma'];
39 yield ["Funky\u{200B}Whitespace", 'FunkyWhitespace'];
40 }
41
42 #[DataProvider('provideFilenames')]
43 public function testSanitize(string $filename, string $expected): void
44 {
45 $this->assertSame($expected, Util::sanitizeFilename($filename));
46 }
47}
$filename
Definition: buildRTE.php:78
testSanitize(string $filename, string $expected)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...