1
0
mirror of https://github.com/dg/dibi.git synced 2025-02-23 18:33:45 +01:00
php-dibi/tests/dibi/DibiTranslator.DateTimeInterface.phpt
2014-03-24 19:18:11 +01:00

24 lines
591 B
PHP

<?php
/**
* Test: DateTimeInterface of DibiTranslator
*
* @author Patrik Votoček
* @phpversion 5.5
*/
use Tester\Assert;
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));