X-Git-Url: http://git.inspyration.org/?a=blobdiff_plain;f=vendor%2Fdoctrine%2Fdbal%2Ftests%2FDoctrine%2FTests%2FDBAL%2FTypes%2FTimeTest.php;fp=vendor%2Fdoctrine%2Fdbal%2Ftests%2FDoctrine%2FTests%2FDBAL%2FTypes%2FTimeTest.php;h=8a07b9b922c6e08fcdb9592a81fec7d818f61c01;hb=8b04b2d11798dee4f3e1358e4f43e97a6df851f6;hp=0000000000000000000000000000000000000000;hpb=73568cf05a785a45f94ca3f2351d9e07bf917958;p=zf2.biz%2Fapplication_blanche.git diff --git a/vendor/doctrine/dbal/tests/Doctrine/Tests/DBAL/Types/TimeTest.php b/vendor/doctrine/dbal/tests/Doctrine/Tests/DBAL/Types/TimeTest.php new file mode 100644 index 0000000..8a07b9b --- /dev/null +++ b/vendor/doctrine/dbal/tests/Doctrine/Tests/DBAL/Types/TimeTest.php @@ -0,0 +1,53 @@ +_platform = new \Doctrine\Tests\DBAL\Mocks\MockPlatform(); + $this->_type = Type::getType('time'); + } + + public function testTimeConvertsToDatabaseValue() + { + $this->assertTrue( + is_string($this->_type->convertToDatabaseValue(new \DateTime(), $this->_platform)) + ); + } + + public function testTimeConvertsToPHPValue() + { + $this->assertTrue( + $this->_type->convertToPHPValue('5:30:55', $this->_platform) + instanceof \DateTime + ); + } + + public function testInvalidTimeFormatConversion() + { + $this->setExpectedException('Doctrine\DBAL\Types\ConversionException'); + $this->_type->convertToPHPValue('abcdefg', $this->_platform); + } + + public function testNullConversion() + { + $this->assertNull($this->_type->convertToPHPValue(null, $this->_platform)); + } + + public function testConvertDateTimeToPHPValue() + { + $date = new \DateTime("now"); + $this->assertSame($date, $this->_type->convertToPHPValue($date, $this->_platform)); + } +}