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
SourceHostTest.php
Go to the documentation of this file.
1
<?php
2
declare(strict_types = 1);
3
4
namespace
TYPO3\CMS\Redirects\Tests\Unit\Evaluation
;
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\Redirects\Evaluation\SourceHost
;
20
use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
21
22
class
SourceHostTest
extends
UnitTestCase
23
{
27
public
function
evaluateFieldValueWorksWithDifferentInputsDataProvider
(): array
28
{
29
return
[
30
// Valid formats
31
'www.domain.com'
=> [
'www.domain.com'
,
'www.domain.com'
],
32
'domain.com'
=> [
'domain.com'
,
'domain.com'
],
33
'127.0.0.1'
=> [
'127.0.0.1'
,
'127.0.0.1'
],
34
'2001:0db8:85a3:08d3::0370:7344'
=> [
'2001:0db8:85a3:08d3::0370:7344'
,
'2001:0db8:85a3:08d3::0370:7344'
],
35
'http://127.0.0.1'
=> [
'http://127.0.0.1'
,
'127.0.0.1'
],
36
'http://www.domain.com'
=> [
'http://www.domain.com'
,
'www.domain.com'
],
37
'https://www.domain.com'
=> [
'https://www.domain.com'
,
'www.domain.com'
],
38
'http://www.domain.com/subfolder/index.php?id=123&foo=bar'
=> [
39
'http://www.domain.com/subfolder/index.php?id=123&foo=bar'
,
40
'www.domain.com'
41
],
42
'https://www.domain.com/subfolder/index.php?id=123&foo=bar'
=> [
43
'https://www.domain.com/subfolder/index.php?id=123&foo=bar'
,
44
'www.domain.com'
45
],
46
'http://www.domain.com/subfolder/'
=> [
'http://www.domain.com/subfolder/'
,
'www.domain.com'
],
47
'https://www.domain.com/subfolder/'
=> [
'https://www.domain.com/subfolder/'
,
'www.domain.com'
],
48
'http://[2001:0db8:85a3:08d3::0370:7344]/'
=> [
49
'http://[2001:0db8:85a3:08d3::0370:7344]/'
,
50
'2001:0db8:85a3:08d3::0370:7344'
51
],
52
'www.domain.com/subfolder/'
=> [
'www.domain.com/subfolder/'
,
'www.domain.com'
],
53
'domain.com/subfolder/'
=> [
'domain.com/subfolder/'
,
'domain.com'
],
54
'www.domain.com/subfolder/index.php?id=123&foo=bar'
=> [
55
'www.domain.com/subfolder/index.php?id=123&foo=bar'
,
56
'www.domain.com'
57
],
58
'domain.com/subfolder/index.php?id=123&foo=bar'
=> [
59
'domain.com/subfolder/index.php?id=123&foo=bar'
,
60
'domain.com'
61
],
62
// special case, * means all domains
63
'*'
=> [
'*'
,
'*'
],
64
65
// Invalid formats
66
'mailto:foo@typo3.org'
=> [
'mailto:foo@typo3.org'
,
''
],
67
'mailto:foo@typo3.org?subject=bar'
=> [
'mailto:foo@typo3.org?subject=bar'
,
''
],
68
];
69
}
70
77
public
function
evaluateFieldValueWorksWithDifferentInputs
(
string
$input,
string
$expected)
78
{
79
$subject =
new
SourceHost
();
80
$this->assertSame($expected, $subject->evaluateFieldValue($input));
81
}
82
}
TYPO3\CMS\Redirects\Evaluation\SourceHost
Definition:
SourceHost.php:25
TYPO3\CMS\Redirects\Tests\Unit\Evaluation\SourceHostTest\evaluateFieldValueWorksWithDifferentInputs
evaluateFieldValueWorksWithDifferentInputs(string $input, string $expected)
Definition:
SourceHostTest.php:77
TYPO3\CMS\Redirects\Tests\Unit\Evaluation\SourceHostTest\evaluateFieldValueWorksWithDifferentInputsDataProvider
array evaluateFieldValueWorksWithDifferentInputsDataProvider()
Definition:
SourceHostTest.php:27
TYPO3\CMS\Redirects\Tests\Unit\Evaluation
Definition:
SourceHostTest.php:4
TYPO3\CMS\Redirects\Tests\Unit\Evaluation\SourceHostTest
Definition:
SourceHostTest.php:23
doxygen
typo3
sysext
redirects
Tests
Unit
Evaluation
SourceHostTest.php
Generated on Tue Oct 5 2021 01:57:55 for TYPO3CMS by
1.8.18