Passed
Push — master ( ed2d15...6b842d )
by
unknown
17:49 queued 07:36
created

BasicNumberLocalizerTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 28
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A provideLocalizeNumber() 0 14 1
A testLocalizeNumber() 0 6 1
1
<?php
2
3
namespace ValueFormatters\Test;
4
5
use ValueFormatters\BasicNumberLocalizer;
6
7
/**
8
 * @covers ValueFormatters\BasicNumberLocalizer
9
 *
10
 * @group DataValue
11
 * @group DataValueExtensions
12
 *
13
 * @license GPL-2.0-or-later
14
 * @author Daniel Kinzler
15
 */
16
class BasicNumberLocalizerTest extends \PHPUnit\Framework\TestCase {
17
18
	public function provideLocalizeNumber() {
19
		return [
20
			[ '5', '5' ],
21
			[ '+3', '+3' ],
22
			[ '-15', '-15' ],
23
24
			[ '5.3', '5.3' ],
25
			[ '+3.2', '+3.2' ],
26
			[ '-15.77', '-15.77' ],
27
28
			[ 77, '77' ],
29
			[ -7.7, '-7.7' ],
30
		];
31
	}
32
33
	/**
34
	 * @dataProvider provideLocalizeNumber
35
	 */
36
	public function testLocalizeNumber( $localized, $expected ) {
37
		$localizer = new BasicNumberLocalizer();
38
		$localized = $localizer->localizeNumber( $localized );
39
40
		$this->assertSame( $expected, $localized );
41
	}
42
43
}
44