1 | <?php |
||
8 | class TwoDigitsYearTest extends PHPUnit_Framework_TestCase |
||
9 | { |
||
10 | protected $converter; |
||
11 | |||
12 | public function setUp() |
||
13 | { |
||
14 | $this->converter = new TwoDigitsYear(); |
||
15 | } |
||
16 | |||
17 | public function provideTwoWaySamples() |
||
18 | { |
||
19 | yield [2000, '00']; |
||
20 | yield [1990, '90']; |
||
21 | yield [2010, '10']; |
||
22 | yield [1950, '50']; |
||
23 | yield [2049, '49']; |
||
24 | } |
||
25 | |||
26 | /** |
||
27 | * @dataProvider provideTwoWaySamples |
||
28 | */ |
||
29 | public function testConverter($year, $formatted) |
||
30 | { |
||
31 | $this->assertSame($formatted, $this->converter->to($year)); |
||
32 | $this->assertSame($year, $this->converter->from($formatted)); |
||
33 | } |
||
34 | } |