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
LocalesTest.php
Go to the documentation of this file.
1
<?php
2
namespace
TYPO3\CMS\Core\Tests\Unit\Localization
;
3
4
/*
5
* This file is part of the TYPO3 CMS project.
6
*
7
* It is free software; you can redistribute it and/or modify it under
8
* the terms of the GNU General Public License, either version 2
9
* of the License, or any later version.
10
*
11
* For the full copyright and license information, please read the
12
* LICENSE.txt file that was distributed with this source code.
13
*
14
* The TYPO3 project - inspiring people to share!
15
*/
16
17
use
TYPO3\CMS\Core\Localization\Locales
;
18
use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
19
23
class
LocalesTest
extends
UnitTestCase
24
{
28
public
function
browserLanguageDetectionWorksDataProvider
(): array
29
{
30
return
[
31
'german'
=> [
32
'de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4'
,
33
'de'
,
34
],
35
'english as default'
=> [
36
'en-US;q=0.8,en;q=0.6;de-DE,de;q=0.4'
,
37
'default'
,
38
],
39
'chinese simplified'
=> [
40
'zh-CN,en-US;q=0.5,en;q=0.3'
,
41
'ch'
42
],
43
'chinese simplified han'
=> [
44
'zh-Hans-CN,zh-Hans;q=0.8,en-US;q=0.5,en;q=0.3'
,
45
'ch'
46
],
47
];
48
}
49
57
public
function
browserLanguageDetectionWorks
(
string
$acceptLanguageHeader,
string
$expected)
58
{
59
$detectedLanguage = (
new
Locales
)->getPreferredClientLanguage(
60
$acceptLanguageHeader
61
);
62
$this->assertSame($expected, $detectedLanguage);
63
}
64
}
TYPO3\CMS\Core\Localization\Locales
Definition:
Locales.php:29
TYPO3\CMS\Core\Tests\Unit\Localization\LocalesTest\browserLanguageDetectionWorksDataProvider
array browserLanguageDetectionWorksDataProvider()
Definition:
LocalesTest.php:28
TYPO3\CMS\Core\Tests\Unit\Localization\LocalesTest\browserLanguageDetectionWorks
browserLanguageDetectionWorks(string $acceptLanguageHeader, string $expected)
Definition:
LocalesTest.php:57
TYPO3\CMS\Core\Tests\Unit\Localization
Definition:
LocalesTest.php:2
TYPO3\CMS\Core\Tests\Unit\Localization\LocalesTest
Definition:
LocalesTest.php:24
doxygen
typo3
sysext
core
Tests
Unit
Localization
LocalesTest.php
Generated on Tue Oct 5 2021 01:57:24 for TYPO3CMS by
1.8.18