| Conditions | 1 |
| Paths | 1 |
| Total Lines | 24 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 32 | public function testMarsTime() |
||
| 33 | { |
||
| 34 | $this->assertEquals( |
||
| 35 | $this->mars->format( |
||
| 36 | new DateTime('1873-12-30 00:00:00'), |
||
| 37 | "Y-m-d H:i:s" |
||
| 38 | ), |
||
| 39 | '0001-01-01 23:21:28' |
||
| 40 | ); |
||
| 41 | |||
| 42 | /** |
||
| 43 | * According to http://jtauber.github.io/mars-clock/, the MSD of this date |
||
| 44 | * is 51232 sols after 1873-12-29 00:00:00 UTC, which is our era start. |
||
| 45 | * That means the internal eraDayIndex should be 51232 aswell, year should be |
||
| 46 | * ceil(51232/668.5921) = 77, and day index should be (51232 mod 668.5921) = 419 |
||
| 47 | */ |
||
| 48 | $this->assertEquals( |
||
| 49 | $this->mars->format( |
||
| 50 | new DateTime('2018-02-13 00:00:00 UTC'), |
||
| 51 | "Y z" |
||
| 52 | ), |
||
| 53 | '0077 419' |
||
| 54 | ); |
||
| 55 | } |
||
| 56 | } |
||
| 57 |