You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

LuDateTimeDboTest.php 757B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. use Luticate\Utils\Dbo\LuDateTimeDbo;
  3. use Luticate\Utils\Dbo\LuDboDeserializeException;
  4. /**
  5. * Created by PhpStorm.
  6. * User: robin
  7. * Date: 6/14/16
  8. * Time: 11:53 AM
  9. */
  10. class LuDateTimeDboTest extends \PHPUnit_Framework_TestCase
  11. {
  12. public function testDateTime()
  13. {
  14. $dbo = LuDateTimeDbo::jsonDeserialize('2016-12-24 14:42:24');
  15. $this->assertSame('2016-12-24 14:42:24', $dbo->getDateTime()->__toString());
  16. }
  17. public function testNull()
  18. {
  19. $dbo = LuDateTimeDbo::jsonDeserialize(null);
  20. $this->assertSame(null, $dbo->getDateTime());
  21. }
  22. public function testInvalid()
  23. {
  24. $this->expectException(LuDboDeserializeException::class);
  25. LuDateTimeDbo::jsonDeserialize('my date');
  26. }
  27. }