mirror of
https://github.com/dg/dibi.git
synced 2025-08-05 05:37:39 +02:00
Add support for DateTimeInterface
This commit is contained in:
committed by
David Grudl
parent
0071b80938
commit
176b1a8895
22
tests/dibi/DibiTranslator.DateTimeInterface.phpt
Normal file
22
tests/dibi/DibiTranslator.DateTimeInterface.phpt
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Test: DateTimeInterface of DibiTranslator
|
||||
*
|
||||
* @author Patrik Votoček
|
||||
* @phpversion 5.5
|
||||
*/
|
||||
|
||||
|
||||
require __DIR__ . '/bootstrap.php';
|
||||
|
||||
$connection = new DibiConnection(array(
|
||||
'driver' => 'sqlite3',
|
||||
'database' => ':memory:',
|
||||
));
|
||||
$translator = new DibiTranslator($connection);
|
||||
|
||||
$datetime = new DateTime('1978-01-23 00:00:00');
|
||||
|
||||
Assert::equal($datetime->format('U'), $translator->formatValue(new DateTime($datetime->format('c')), NULL));
|
||||
Assert::equal($datetime->format('U'), $translator->formatValue(new DateTimeImmutable($datetime->format('c')), NULL));
|
Reference in New Issue
Block a user