Completed
Push — master ( e9933e...972910 )
by Jan
04:27
created

FormatterTest::testFormatAmount()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 2
1
<?php declare(strict_types = 1);
2
3
namespace SlevomatEET;
4
5
class FormatterTest extends \PHPUnit\Framework\TestCase
6
{
7
8
	/**
9
	 * @dataProvider dataTestFormatAmount
10
	 * @param int|null $value
11
	 * @param string|null $expected
12
	 */
13
	public function testFormatAmount(int $value = null, string $expected = null)
14
	{
15
		$this->assertSame($expected, Formatter::formatAmount($value));
16
	}
17
18
	public function dataTestFormatAmount(): array
19
	{
20
		return [
21
			[0, '0.00'],
22
			[10000, '100.00'],
23
			[150, '1.50'],
24
			[-5500, '-55.00'],
25
			[-12425, '-124.25'],
26
			[-12420, '-124.20'],
27
			[null, null],
28
		];
29
	}
30
31
	/**
32
	 * @dataProvider dataTestFormatDateTime
33
	 * @param \DateTimeImmutable $value
34
	 * @param string $expected
35
	 */
36
	public function testFormatDateTime(\DateTimeImmutable $value, string $expected)
37
	{
38
		$this->assertSame($expected, Formatter::formatDateTime($value));
39
	}
40
41
	public function dataTestFormatDateTime()
42
	{
43
		return [
44
			[new \DateTimeImmutable('2016-03-11 11:05:00', new \DateTimeZone('Europe/Prague')), '2016-03-11T11:05:00+01:00'],
45
			[new \DateTimeImmutable('2016-08-11 11:05:00', new \DateTimeZone('Europe/Prague')), '2016-08-11T11:05:00+02:00'],
46
		];
47
	}
48
49
}
50