@@ 43-54 (lines=12) @@ | ||
40 | $this->assertEquals(1327968000, $result, null, 1E-8); |
|
41 | } |
|
42 | ||
43 | public function testDATEtoPHPObject() |
|
44 | { |
|
45 | Functions::setReturnDateType(Functions::RETURNDATE_PHP_OBJECT); |
|
46 | $result = DateTime::DATE(2012, 1, 31); |
|
47 | Functions::setReturnDateType(Functions::RETURNDATE_EXCEL); |
|
48 | // Must return an object... |
|
49 | $this->assertTrue(is_object($result)); |
|
50 | // ... of the correct type |
|
51 | $this->assertTrue(is_a($result, 'DateTime')); |
|
52 | // ... with the correct value |
|
53 | $this->assertEquals($result->format('d-M-Y'), '31-Jan-2012'); |
|
54 | } |
|
55 | ||
56 | public function testDATEwith1904Calendar() |
|
57 | { |
|
@@ 221-232 (lines=12) @@ | ||
218 | $this->assertEquals(27020, $result, null, 1E-8); |
|
219 | } |
|
220 | ||
221 | public function testTIMEtoPHPObject() |
|
222 | { |
|
223 | Functions::setReturnDateType(Functions::RETURNDATE_PHP_OBJECT); |
|
224 | $result = DateTime::TIME(7, 30, 20); |
|
225 | Functions::setReturnDateType(Functions::RETURNDATE_EXCEL); |
|
226 | // Must return an object... |
|
227 | $this->assertTrue(is_object($result)); |
|
228 | // ... of the correct type |
|
229 | $this->assertTrue(is_a($result, 'DateTime')); |
|
230 | // ... with the correct value |
|
231 | $this->assertEquals($result->format('H:i:s'), '07:30:20'); |
|
232 | } |
|
233 | ||
234 | /** |
|
235 | * @dataProvider providerTIMEVALUE |
|
@@ 381-392 (lines=12) @@ | ||
378 | $this->assertEquals(1324857600, $result, null, 1E-8); |
|
379 | } |
|
380 | ||
381 | public function testEDATEtoPHPObject() |
|
382 | { |
|
383 | Functions::setReturnDateType(Functions::RETURNDATE_PHP_OBJECT); |
|
384 | $result = DateTime::EDATE('2012-1-26', -1); |
|
385 | Functions::setReturnDateType(Functions::RETURNDATE_EXCEL); |
|
386 | // Must return an object... |
|
387 | $this->assertTrue(is_object($result)); |
|
388 | // ... of the correct type |
|
389 | $this->assertTrue(is_a($result, 'DateTime')); |
|
390 | // ... with the correct value |
|
391 | $this->assertEquals($result->format('d-M-Y'), '26-Dec-2011'); |
|
392 | } |
|
393 | ||
394 | /** |
|
395 | * @dataProvider providerEOMONTH |
|
@@ 418-429 (lines=12) @@ | ||
415 | $this->assertEquals(1325289600, $result, null, 1E-8); |
|
416 | } |
|
417 | ||
418 | public function testEOMONTHtoPHPObject() |
|
419 | { |
|
420 | Functions::setReturnDateType(Functions::RETURNDATE_PHP_OBJECT); |
|
421 | $result = DateTime::EOMONTH('2012-1-26', -1); |
|
422 | Functions::setReturnDateType(Functions::RETURNDATE_EXCEL); |
|
423 | // Must return an object... |
|
424 | $this->assertTrue(is_object($result)); |
|
425 | // ... of the correct type |
|
426 | $this->assertTrue(is_a($result, 'DateTime')); |
|
427 | // ... with the correct value |
|
428 | $this->assertEquals($result->format('d-M-Y'), '31-Dec-2011'); |
|
429 | } |
|
430 | ||
431 | /** |
|
432 | * @dataProvider providerDATEDIF |