1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-18 11:51:18 +02:00

DateTime: removed setTimestamp() and getTimestamp(), big int are supported in x64 PHP versions

This commit is contained in:
David Grudl
2018-03-23 13:01:00 +01:00
parent 0a19ccbf80
commit 8f47def4a2
2 changed files with 21 additions and 15 deletions

21
tests/dibi/DateTime.phpt Normal file
View File

@@ -0,0 +1,21 @@
<?php
declare(strict_types=1);
use Dibi\DateTime;
use Tester\Assert;
require __DIR__ . '/bootstrap.php';
date_default_timezone_set('Europe/Prague');
Assert::same('1978-01-23 11:40:00.000000', (string) new DateTime(254400000));
Assert::same('1978-01-23 11:40:00.000000', (string) (new DateTime)->setTimestamp(254400000));
Assert::same(254400000, (new DateTime(254400000))->getTimestamp());
Assert::same('2050-08-13 11:40:00.000000', (string) new DateTime(2544000000));
Assert::same('2050-08-13 11:40:00.000000', (string) (new DateTime)->setTimestamp(2544000000));
Assert::same(is_int(2544000000) ? 2544000000 : '2544000000', (new DateTime(2544000000))->getTimestamp()); // 64 bit
Assert::same('1978-05-05 00:00:00.000000', (string) new DateTime('1978-05-05'));