TYPO3CMS
9.5
Main Page
Related Pages
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Variables
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
Files
File List
File Members
All
$
d
e
r
u
Functions
Variables
$
e
r
Examples
•
All
Classes
Namespaces
Files
Functions
Variables
Pages
FilePathSanitizerTest.php
Go to the documentation of this file.
1
<?php
2
declare(strict_types = 1);
3
4
namespace
TYPO3\CMS\Frontend\Tests\Unit\Resource
;
5
6
/*
7
* This file is part of the TYPO3 CMS project.
8
*
9
* It is free software; you can redistribute it and/or modify it under
10
* the terms of the GNU General Public License, either version 2
11
* of the License, or any later version.
12
*
13
* For the full copyright and license information, please read the
14
* LICENSE.txt file that was distributed with this source code.
15
*
16
* The TYPO3 project - inspiring people to share!
17
*/
18
19
use
TYPO3\CMS\Core\Resource\Exception\FileDoesNotExistException
;
20
use
TYPO3\CMS\Core\Resource\Exception\InvalidFileNameException
;
21
use
TYPO3\CMS\Frontend\Resource\FilePathSanitizer
;
22
use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
23
27
class
FilePathSanitizerTest
extends
UnitTestCase
28
{
32
public
function
sanitizeReturnsUrlCorrectly
(): void
33
{
34
$subject =
new
FilePathSanitizer
();
35
$this->assertSame(
'http://example.com'
, $subject->sanitize(
'http://example.com'
));
36
$this->assertSame(
'https://example.com'
, $subject->sanitize(
'https://example.com'
));
37
}
38
42
public
function
sanitizeReturnsFileCorrectly
(): void
43
{
44
$subject =
new
FilePathSanitizer
();
45
$this->assertSame(
'typo3/index.php'
, $subject->sanitize(
'typo3/index.php'
));
46
}
47
51
public
function
sanitizeFailsIfDirectoryGiven
(): void
52
{
53
$this->expectException(FileDoesNotExistException::class);
54
$subject =
new
FilePathSanitizer
();
55
$subject->sanitize(__DIR__);
56
}
57
61
public
function
sanitizeThrowsExceptionWithInvalidFileName
(): void
62
{
63
$this->expectException(InvalidFileNameException::class);
64
$this->assertNull((
new
FilePathSanitizer
())->sanitize(
' '
));
65
$this->assertNull((
new
FilePathSanitizer
())->sanitize(
'something/../else'
));
66
}
67
}
TYPO3\CMS\Frontend\Resource\FilePathSanitizer
Definition:
FilePathSanitizer.php:37
TYPO3\CMS\Frontend\Tests\Unit\Resource\FilePathSanitizerTest\sanitizeFailsIfDirectoryGiven
sanitizeFailsIfDirectoryGiven()
Definition:
FilePathSanitizerTest.php:51
TYPO3\CMS\Core\Resource\Exception\FileDoesNotExistException
Definition:
FileDoesNotExistException.php:21
TYPO3\CMS\Frontend\Tests\Unit\Resource
Definition:
FilePathSanitizerTest.php:4
TYPO3\CMS\Frontend\Tests\Unit\Resource\FilePathSanitizerTest\sanitizeReturnsFileCorrectly
sanitizeReturnsFileCorrectly()
Definition:
FilePathSanitizerTest.php:42
TYPO3\CMS\Frontend\Tests\Unit\Resource\FilePathSanitizerTest\sanitizeThrowsExceptionWithInvalidFileName
sanitizeThrowsExceptionWithInvalidFileName()
Definition:
FilePathSanitizerTest.php:61
TYPO3\CMS\Frontend\Tests\Unit\Resource\FilePathSanitizerTest\sanitizeReturnsUrlCorrectly
sanitizeReturnsUrlCorrectly()
Definition:
FilePathSanitizerTest.php:32
TYPO3\CMS\Frontend\Tests\Unit\Resource\FilePathSanitizerTest
Definition:
FilePathSanitizerTest.php:28
TYPO3\CMS\Core\Resource\Exception\InvalidFileNameException
Definition:
InvalidFileNameException.php:21
doxygen
typo3
sysext
frontend
Tests
Unit
Resource
FilePathSanitizerTest.php
Generated on Tue Oct 5 2021 01:57:47 for TYPO3CMS by
1.8.18