LocaleHelperTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 28
dl 0
loc 62
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A status_matrix_provider() 0 50 1
A test_transform() 0 4 1
1
<?php
2
3
namespace Pronamic\WordPress\Pay\Gateways\OmniKassa;
4
5
use PHPUnit_Framework_TestCase;
6
7
/**
8
 * Title: OmniKassa locale helper test
9
 * Description:
10
 * Copyright: 2005-2020 Pronamic
11
 * Company: Pronamic
12
 *
13
 * @author  Remco Tolsma
14
 * @version 2.0.0
15
 * @since   1.1.3
16
 */
17
class LocaleHelperTest extends PHPUnit_Framework_TestCase {
18
	/**
19
	 * Test transform.
20
	 *
21
	 * @dataProvider status_matrix_provider
22
	 */
23
	public function test_transform( $locale, $expected ) {
24
		$language = LocaleHelper::transform( $locale );
25
26
		$this->assertEquals( $expected, $language );
27
	}
28
29
	public function status_matrix_provider() {
30
		return array(
31
			// Czech
32
			array( 'cs_CZ', Locales::CS ),
33
			// Welsh
34
			array( 'cy', Locales::CY ),
35
			// German
36
			array( 'de_DE', Locales::DE ),
37
			// German (Switzerland)
38
			array( 'de_CH', Locales::DE ),
39
			// English
40
			array( 'en_US', Locales::EN ),
41
			// English (Australia)
42
			array( 'en_AU', Locales::EN ),
43
			// English (Canada)
44
			array( 'en_CA', Locales::EN ),
45
			// English (South Africa)
46
			array( 'en_ZA', Locales::EN ),
47
			// English (UK)
48
			array( 'en_GB', Locales::EN ),
49
			// Spanish (Argentina)
50
			array( 'es_AR', Locales::ES ),
51
			// Spanish (Chile)
52
			array( 'es_CL', Locales::ES ),
53
			// Spanish (Colombia)
54
			array( 'es_CO', Locales::ES ),
55
			// Spanish (Mexico)
56
			array( 'es_MX', Locales::ES ),
57
			// Spanish (Peru)
58
			array( 'es_PE', Locales::ES ),
59
			// Spanish (Puerto Rico)
60
			array( 'es_PR', Locales::ES ),
61
			// Spanish (Spain)
62
			array( 'es_ES', Locales::ES ),
63
			// Spanish (Venezuela)
64
			array( 'es_VE', Locales::ES ),
65
			// French (Belgium)
66
			array( 'fr_BE', Locales::FR ),
67
			// French (Canada)
68
			array( 'fr_CA', Locales::FR ),
69
			// French (France)
70
			array( 'fr_FR', Locales::FR ),
71
			// Dutch
72
			array( 'nl_NL', Locales::NL ),
73
			// Dutch (Belgium)
74
			array( 'nl_BE', Locales::NL ),
75
			// Slovak
76
			array( 'sk_SK', Locales::SK ),
77
			// Not supported
78
			array( 'not supported language code', null ),
79
		);
80
	}
81
}
82