#2794 adding tests verifying the regression, `DateTimeImmutable` should STILL...

#2794 adding tests verifying the regression, `DateTimeImmutable` should STILL work, even if unintentionally
parent 5cefa4d9
...@@ -70,6 +70,35 @@ abstract class BaseDateTypeTestCase extends PHPUnit_Framework_TestCase ...@@ -70,6 +70,35 @@ abstract class BaseDateTypeTestCase extends PHPUnit_Framework_TestCase
$this->assertSame($date, $this->type->convertToPHPValue($date, $this->platform)); $this->assertSame($date, $this->type->convertToPHPValue($date, $this->platform));
} }
/**
* @group #2794
*
* Note that while DateTimeImmutable is supposed to be handled by @see \Doctrine\DBAL\Types\DateTimeImmutableType,
* previous DBAL versions handled it just fine. This test is just in place to prevent further regressions, even
* if the type is being misused
*/
public function testConvertDateTimeImmutableToPHPValue()
{
$date = new \DateTimeImmutable('now');
self::assertSame($date, $this->type->convertToPHPValue($date, $this->platform));
}
/**
* @group #2794
*
* Note that while DateTimeImmutable is supposed to be handled by @see \Doctrine\DBAL\Types\DateTimeImmutableType,
* previous DBAL versions handled it just fine. This test is just in place to prevent further regressions, even
* if the type is being misused
*/
public function testDateTimeImmutableConvertsToDatabaseValue()
{
self::assertInternalType(
'string',
$this->type->convertToDatabaseValue(new \DateTimeImmutable(), $this->platform)
);
}
/** /**
* @return mixed[][] * @return mixed[][]
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment