|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Jobles\Tests\Careerjet; |
|
4
|
|
|
|
|
5
|
|
|
use Jobles\Careerjet\Locale; |
|
6
|
|
|
|
|
7
|
|
|
class LocaleTest extends \PHPUnit_Framework_TestCase |
|
8
|
|
|
{ |
|
9
|
|
|
public function testInvalidCountryShouldThrowInvalidArgumentException() |
|
10
|
|
|
{ |
|
11
|
|
|
$this->expectException(\InvalidArgumentException::class); |
|
12
|
|
|
$this->expectExceptionMessage('Please use a valid country'); |
|
13
|
|
|
|
|
14
|
|
|
Locale::byCountryAndLanguage('Invalid country'); |
|
15
|
|
|
} |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* @dataProvider localeDataProvider |
|
19
|
|
|
* @param $country |
|
20
|
|
|
* @param $language |
|
21
|
|
|
* @param $locale |
|
22
|
|
|
*/ |
|
23
|
|
|
public function testLocales($country, $language, $locale) |
|
24
|
|
|
{ |
|
25
|
|
|
$this->assertEquals($locale, Locale::byCountryAndLanguage($country, $language)); |
|
26
|
|
|
} |
|
27
|
|
|
|
|
28
|
|
|
public function localeDataProvider() |
|
29
|
|
|
{ |
|
30
|
|
|
return [ |
|
31
|
|
|
['Australia', null, 'en_AU'], |
|
32
|
|
|
['Austria', null, 'de_AT'], |
|
33
|
|
|
['Argentina', null, 'es_AR'], |
|
34
|
|
|
['Belgium', 'French', 'fr_BE'], |
|
35
|
|
|
['Belgium', 'Dutch', 'nl_BE'], |
|
36
|
|
|
['Bolivia', null, 'es_BO'], |
|
37
|
|
|
['Brazil', null, 'pt_BR'], |
|
38
|
|
|
['Canada', 'French', 'fr_CA'], |
|
39
|
|
|
['Canada', 'English', 'en_CA'], |
|
40
|
|
|
['Chile', null, 'es_CL'], |
|
41
|
|
|
['China', 'English', 'en_CN'], |
|
42
|
|
|
['China', 'Chinese', 'zh_CN'], |
|
43
|
|
|
['Costa Rica', null, 'es_CR'], |
|
44
|
|
|
['Czech Republic', null, 'cs_CZ'], |
|
45
|
|
|
['Denmark', null, 'da_DK'], |
|
46
|
|
|
['Dominican Republic', null, 'es_DO'], |
|
47
|
|
|
['Ecuador', null, 'es_EC'], |
|
48
|
|
|
['Finland', null, 'fi_FI'], |
|
49
|
|
|
['France', null, 'fr_FR'], |
|
50
|
|
|
['Germany', null, 'de_DE'], |
|
51
|
|
|
['Guatemala', null, 'es_GT'], |
|
52
|
|
|
['Hungary', null, 'hu_HU'], |
|
53
|
|
|
['Hong Kong', null, 'en_HK'], |
|
54
|
|
|
['Italy', null, 'it_IT'], |
|
55
|
|
|
['Ireland', null, 'en_IE'], |
|
56
|
|
|
['India', null, 'en_IN'], |
|
57
|
|
|
['Japan', null, 'ja_JP'], |
|
58
|
|
|
['Korea', null, 'ko_KR'], |
|
59
|
|
|
['Luxembourg', null, 'fr_LU'], |
|
60
|
|
|
['Malaysia', null, 'en_MY'], |
|
61
|
|
|
['Mexico', null, 'es_MX'], |
|
62
|
|
|
['Morocco', null, 'fr_MA'], |
|
63
|
|
|
['Netherlands', null, 'nl_NL'], |
|
64
|
|
|
['New Zealand', null, 'en_NZ'], |
|
65
|
|
|
['Norway', null, 'no_NO'], |
|
66
|
|
|
['Oman', null, 'en_OM'], |
|
67
|
|
|
['Pakistan', null, 'en_PK'], |
|
68
|
|
|
['Panama', null, 'es_PA'], |
|
69
|
|
|
['Paraguay', null, 'es_PY'], |
|
70
|
|
|
['Philippines', null, 'en_PH'], |
|
71
|
|
|
['Peru', null, 'es_PE'], |
|
72
|
|
|
['Poland', null, 'pl_PL'], |
|
73
|
|
|
['Portugal', null, 'pt_PT'], |
|
74
|
|
|
['Puerto Rico', null, 'es_PR'], |
|
75
|
|
|
['Qatar', null, 'en_QA'], |
|
76
|
|
|
['Russia', null, 'ru_RU'], |
|
77
|
|
|
['Singapore', null, 'en_SG'], |
|
78
|
|
|
['Slovakia', null, 'sk_SK'], |
|
79
|
|
|
['South Africa', null, 'en_ZA'], |
|
80
|
|
|
['Spain', null, 'es_ES'], |
|
81
|
|
|
['Sweden', null, 'sv_SE'], |
|
82
|
|
|
['Switzerland', 'German', 'de_CH'], |
|
83
|
|
|
['Switzerland', 'French', 'fr_CH'], |
|
84
|
|
|
['Taiwan', null, 'en_TW'], |
|
85
|
|
|
['Turkey', null, 'tr_TR'], |
|
86
|
|
|
['Ukraine', 'Russian', 'ru_UA'], |
|
87
|
|
|
['Ukraine', 'Ukrainian', 'uk_UA'], |
|
88
|
|
|
['United Arab Emirates', null, 'en_AE'], |
|
89
|
|
|
['United Kingdom', null, 'en_GB'], |
|
90
|
|
|
['United States', null, 'en_US'], |
|
91
|
|
|
['Uruguay', null, 'es_UY'], |
|
92
|
|
|
['Venezuela', null, 'es_VE'], |
|
93
|
|
|
['Vietnam', 'English', 'en_VN'], |
|
94
|
|
|
['Vietnam', 'Vietnamese', 'vi_VN'], |
|
95
|
|
|
]; |
|
96
|
|
|
} |
|
97
|
|
|
} |
|
98
|
|
|
|