@@ 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->assertInternalType('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 | { |
|
@@ 213-224 (lines=12) @@ | ||
210 | $this->assertEquals(27020, $result, null, 1E-8); |
|
211 | } |
|
212 | ||
213 | public function testTIMEtoPHPObject() |
|
214 | { |
|
215 | Functions::setReturnDateType(Functions::RETURNDATE_PHP_OBJECT); |
|
216 | $result = DateTime::TIME(7, 30, 20); |
|
217 | Functions::setReturnDateType(Functions::RETURNDATE_EXCEL); |
|
218 | // Must return an object... |
|
219 | $this->assertInternalType('object', $result); |
|
220 | // ... of the correct type |
|
221 | $this->assertTrue(is_a($result, 'DateTime')); |
|
222 | // ... with the correct value |
|
223 | $this->assertEquals($result->format('H:i:s'), '07:30:20'); |
|
224 | } |
|
225 | ||
226 | /** |
|
227 | * @dataProvider providerTIMEVALUE |
|
@@ 367-378 (lines=12) @@ | ||
364 | $this->assertEquals(1324857600, $result, null, 1E-8); |
|
365 | } |
|
366 | ||
367 | public function testEDATEtoPHPObject() |
|
368 | { |
|
369 | Functions::setReturnDateType(Functions::RETURNDATE_PHP_OBJECT); |
|
370 | $result = DateTime::EDATE('2012-1-26', -1); |
|
371 | Functions::setReturnDateType(Functions::RETURNDATE_EXCEL); |
|
372 | // Must return an object... |
|
373 | $this->assertInternalType('object', $result); |
|
374 | // ... of the correct type |
|
375 | $this->assertTrue(is_a($result, 'DateTime')); |
|
376 | // ... with the correct value |
|
377 | $this->assertEquals($result->format('d-M-Y'), '26-Dec-2011'); |
|
378 | } |
|
379 | ||
380 | /** |
|
381 | * @dataProvider providerEOMONTH |
|
@@ 404-415 (lines=12) @@ | ||
401 | $this->assertEquals(1325289600, $result, null, 1E-8); |
|
402 | } |
|
403 | ||
404 | public function testEOMONTHtoPHPObject() |
|
405 | { |
|
406 | Functions::setReturnDateType(Functions::RETURNDATE_PHP_OBJECT); |
|
407 | $result = DateTime::EOMONTH('2012-1-26', -1); |
|
408 | Functions::setReturnDateType(Functions::RETURNDATE_EXCEL); |
|
409 | // Must return an object... |
|
410 | $this->assertInternalType('object', $result); |
|
411 | // ... of the correct type |
|
412 | $this->assertTrue(is_a($result, 'DateTime')); |
|
413 | // ... with the correct value |
|
414 | $this->assertEquals($result->format('d-M-Y'), '31-Dec-2011'); |
|
415 | } |
|
416 | ||
417 | /** |
|
418 | * @dataProvider providerDATEDIF |