1 | <?php |
||
8 | class DocY10KTest extends TestCase |
||
9 | { |
||
10 | protected $factory; |
||
11 | protected $calendar; |
||
12 | |||
13 | public function setUp() |
||
14 | { |
||
15 | $this->factory = new ConfigurableFactory(); |
||
16 | $this->calendar = $this->factory->build([ |
||
17 | 'number' => 'rfc2550', |
||
18 | 'additional_symbol_parser' => 'rfc2550', |
||
19 | ]); |
||
20 | } |
||
21 | |||
22 | public function testRFC2550() |
||
23 | { |
||
24 | // Parsing a "normal" y40k date |
||
25 | $date = $this->calendar->parse('40000', 'y'); |
||
26 | |||
27 | $this->assertInstanceOf('DateTimeinterface', $date); |
||
28 | $this->assertEquals($date->format('Y'), '40000'); |
||
29 | |||
30 | // Now formatting it property : |
||
31 | $this->assertEquals($this->calendar->format($date, 'y-m-d'), 'A40000-01-01'); |
||
32 | |||
33 | // Parsing a RFC2550 date : |
||
34 | $date = $this->calendar->parse('A10000', 'y'); |
||
35 | $this->assertInstanceOf('DateTimeinterface', $date); |
||
36 | $this->assertEquals($date->format('Y'), '10000'); |
||
37 | } |
||
38 | } |
||
39 |