Commit 2161ffff authored by Bill Schaller's avatar Bill Schaller

Merge pull request #902 from Ocramius/hotfix/#869-fixes-for-type-conversion-excessive-smartness

Hotfix - #869 - fixes for type conversion logic
parents bd142a58 155f5d75
......@@ -41,7 +41,7 @@ class ConversionException extends \Doctrine\DBAL\DBALException
*/
static public function conversionFailed($value, $toType)
{
$value = (strlen($value) > 32) ? substr($value, 0, 20) . "..." : $value;
$value = (strlen($value) > 32) ? substr($value, 0, 20) . '...' : $value;
return new self('Could not convert database value "' . $value . '" to Doctrine Type ' . $toType);
}
......@@ -53,16 +53,19 @@ class ConversionException extends \Doctrine\DBAL\DBALException
* @param string $value
* @param string $toType
* @param string $expectedFormat
* @param \Exception|null $previous
*
* @return \Doctrine\DBAL\Types\ConversionException
*/
static public function conversionFailedFormat($value, $toType, $expectedFormat)
static public function conversionFailedFormat($value, $toType, $expectedFormat, \Exception $previous = null)
{
$value = (strlen($value) > 32) ? substr($value, 0, 20) . "..." : $value;
$value = (strlen($value) > 32) ? substr($value, 0, 20) . '...' : $value;
return new self(
'Could not convert database value "' . $value . '" to Doctrine Type ' .
$toType . '. Expected format: ' . $expectedFormat
$toType . '. Expected format: ' . $expectedFormat,
0,
$previous
);
}
......@@ -70,24 +73,30 @@ class ConversionException extends \Doctrine\DBAL\DBALException
* Thrown when the PHP value passed to the converter was not of the expected type.
*
* @param mixed $value
* @param string $fromType
* @param string $toType
* @param string[] $possibleTypes
*
* @return \Doctrine\DBAL\Types\ConversionException
*/
static public function conversionFailedInvalidType($value, $toType, $fromType)
static public function conversionFailedInvalidType($value, $toType, array $possibleTypes)
{
$actualType = gettype($value);
if ($actualType === 'object') {
$actualType .= " (" . get_class($value) . ")";
if (!method_exists($value, '__toString')) {
$value = 'object';
}
$actualType = is_object($value) ? get_class($value) : gettype($value);
if (is_scalar($value)) {
return new self(sprintf(
"Could not convert PHP value '%s' of type '%s' to type '%s'. Expected one of the following types: %s",
$value,
$actualType,
$toType,
implode(', ', $possibleTypes)
));
}
$value = (string)$value;
$value = (strlen($value) > 32) ? substr($value, 0, 20) . "..." : $value;
return new self(
"Could not convert PHP value '$value' of type '$actualType' to type $toType. Expected type: $fromType"
);
return new self(sprintf(
"Could not convert PHP value of type '%s' to type '%s'. Expected one of the following types: %s",
$actualType,
$toType,
implode(', ', $possibleTypes)
));
}
}
......@@ -33,20 +33,17 @@ class DateIntervalType extends Type
*/
public function convertToDatabaseValue($value, AbstractPlatform $platform)
{
$spec = null;
if ($value !== null) {
/** @var \DateInterval $value */
$spec = 'P'
if (null === $value) {
return null;
}
if ($value instanceof \DateInterval) {
return 'P'
. str_pad($value->y, 4, '0', STR_PAD_LEFT) . '-'
. $value->format('%M') . '-'
. $value->format('%D') . 'T'
. $value->format('%H') . ':'
. $value->format('%I') . ':'
. $value->format('%S')
;
. $value->format('%M-%DT%H:%I:%S');
}
return $spec;
throw ConversionException::conversionFailedInvalidType($value, $this->getName(), ['null', 'DateInterval']);
}
/**
......@@ -59,13 +56,10 @@ class DateIntervalType extends Type
}
try {
$interval = new \DateInterval($value);
} catch (\Exception $e) {
throw ConversionException::conversionFailedFormat($value, $this->getName(), 'PY-m-dTH:i:s');
return new \DateInterval($value);
} catch (\Exception $exception) {
throw ConversionException::conversionFailedFormat($value, $this->getName(), 'PY-m-dTH:i:s', $exception);
}
return $interval;
}
/**
......
......@@ -49,12 +49,15 @@ class DateTimeType extends Type
*/
public function convertToDatabaseValue($value, AbstractPlatform $platform)
{
if ($value !== null && !$value instanceof \DateTime) {
throw ConversionException::conversionFailedInvalidType($value, $this->getName(), "DateTime");
if (null === $value) {
return $value;
}
if ($value instanceof \DateTime) {
return $value->format($platform->getDateTimeFormatString());
}
return ($value !== null)
? $value->format($platform->getDateTimeFormatString()) : null;
throw ConversionException::conversionFailedInvalidType($value, $this->getName(), ['null', 'DateTime']);
}
/**
......
......@@ -67,12 +67,15 @@ class DateTimeTzType extends Type
*/
public function convertToDatabaseValue($value, AbstractPlatform $platform)
{
if ($value !== null && !$value instanceof \DateTime) {
throw ConversionException::conversionFailedInvalidType($value, $this->getName(), "DateTime");
if (null === $value) {
return $value;
}
if ($value instanceof \DateTime) {
return $value->format($platform->getDateTimeTzFormatString());
}
return ($value !== null)
? $value->format($platform->getDateTimeTzFormatString()) : null;
throw ConversionException::conversionFailedInvalidType($value, $this->getName(), ['null', 'DateTime']);
}
/**
......
......@@ -49,12 +49,15 @@ class DateType extends Type
*/
public function convertToDatabaseValue($value, AbstractPlatform $platform)
{
if ($value !== null && !$value instanceof \DateTime) {
throw ConversionException::conversionFailedInvalidType($value, $this->getName(), "DateTime");
if (null === $value) {
return $value;
}
if ($value instanceof \DateTime) {
return $value->format($platform->getDateFormatString());
}
return ($value !== null)
? $value->format($platform->getDateFormatString()) : null;
throw ConversionException::conversionFailedInvalidType($value, $this->getName(), ['null', 'DateTime']);
}
/**
......
......@@ -49,12 +49,15 @@ class TimeType extends Type
*/
public function convertToDatabaseValue($value, AbstractPlatform $platform)
{
if ($value !== null && !$value instanceof \DateTime) {
throw ConversionException::conversionFailedInvalidType($value, $this->getName(), "DateTime");
if (null === $value) {
return $value;
}
if ($value instanceof \DateTime) {
return $value->format($platform->getTimeFormatString());
}
return ($value !== null)
? $value->format($platform->getTimeFormatString()) : null;
throw ConversionException::conversionFailedInvalidType($value, $this->getName(), ['null', 'DateTime']);
}
/**
......
<?php
namespace Doctrine\Tests\DBAL\Types;
use Doctrine\Tests\DBAL\Mocks\MockPlatform;
use PHPUnit_Framework_TestCase;
abstract class BaseDateTypeTestCase extends PHPUnit_Framework_TestCase
{
/**
* @var MockPlatform
*/
protected $platform;
/**
* @var \Doctrine\DBAL\Types\Type
*/
protected $type;
/**
* @var string
*/
private $currentTimezone;
/**
* {@inheritDoc}
*/
protected function setUp()
{
$this->platform = new MockPlatform();
$this->currentTimezone = date_default_timezone_get();
$this->assertInstanceOf('Doctrine\DBAL\Types\Type', $this->type);
}
/**
* {@inheritDoc}
*/
protected function tearDown()
{
date_default_timezone_set($this->currentTimezone);
}
public function testDateConvertsToDatabaseValue()
{
$this->assertInternalType('string', $this->type->convertToDatabaseValue(new \DateTime(), $this->platform));
}
/**
* @dataProvider invalidPHPValuesProvider
*
* @param mixed $value
*/
public function testInvalidTypeConversionToDatabaseValue($value)
{
$this->setExpectedException('Doctrine\DBAL\Types\ConversionException');
$this->type->convertToDatabaseValue($value, $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));
}
/**
* @return mixed[][]
*/
public function invalidPHPValuesProvider()
{
return [
[0],
[''],
['foo'],
['10:11:12'],
['2015-01-31'],
['2015-01-31 10:11:12'],
[new \stdClass()],
[$this],
[27],
[-1],
[1.2],
[[]],
[['an array']],
];
}
}
<?php
namespace Doctrine\Tests\DBAL\Types;
use Doctrine\DBAL\Types\ConversionException;
use PHPUnit_Framework_TestCase;
class ConversionExceptionTest extends PHPUnit_Framework_TestCase
{
/**
* @dataProvider scalarsProvider
*
* @param mixed $scalarValue
*/
public function testConversionFailedInvalidTypeWithScalar($scalarValue)
{
$exception = ConversionException::conversionFailedInvalidType($scalarValue, 'foo', ['bar', 'baz']);
$this->assertInstanceOf('Doctrine\DBAL\Types\ConversionException', $exception);
$this->assertRegExp(
'/^Could not convert PHP value \'.*\' of type \'(string|boolean|float|double|integer)\' to type \'foo\'. '
. 'Expected one of the following types: bar, baz$/',
$exception->getMessage()
);
}
/**
* @dataProvider nonScalarsProvider
*
* @param mixed $nonScalar
*/
public function testConversionFailedInvalidTypeWithNonScalar($nonScalar)
{
$exception = ConversionException::conversionFailedInvalidType($nonScalar, 'foo', ['bar', 'baz']);
$this->assertInstanceOf('Doctrine\DBAL\Types\ConversionException', $exception);
$this->assertRegExp(
'/^Could not convert PHP value of type \'(.*)\' to type \'foo\'. '
. 'Expected one of the following types: bar, baz$/',
$exception->getMessage()
);
}
public function testConversionFailedFormatPreservesPreviousException()
{
$previous = new \Exception();
$exception = ConversionException::conversionFailedFormat('foo', 'bar', 'baz', $previous);
$this->assertInstanceOf('Doctrine\DBAL\Types\ConversionException', $exception);
$this->assertSame($previous, $exception->getPrevious());
}
/**
* @return mixed[][]
*/
public function nonScalarsProvider()
{
return [
[[]],
[['foo']],
[null],
[$this],
[new \stdClass()],
[tmpfile()],
];
}
/**
* @return mixed[][]
*/
public function scalarsProvider()
{
return [
[''],
['foo'],
[123],
[-123],
[12.34],
[true],
[false],
];
}
}
......@@ -7,14 +7,25 @@ use Doctrine\Tests\DBAL\Mocks\MockPlatform;
class DateIntervalTest extends \Doctrine\Tests\DbalTestCase
{
protected
$_platform,
$_type;
/**
* @var MockPlatform
*/
private $platform;
/**
* @var \Doctrine\DBAL\Types\DateIntervalType
*/
private $type;
/**
* {@inheritDoc}
*/
protected function setUp()
{
$this->_platform = new MockPlatform();
$this->_type = Type::getType('dateinterval');
$this->platform = new MockPlatform();
$this->type = Type::getType('dateinterval');
$this->assertInstanceOf('Doctrine\DBAL\Types\DateIntervalType', $this->type);
}
public function testDateIntervalConvertsToDatabaseValue()
......@@ -22,14 +33,14 @@ class DateIntervalTest extends \Doctrine\Tests\DbalTestCase
$interval = new \DateInterval('P2Y1DT1H2M3S');
$expected = 'P0002-00-01T01:02:03';
$actual = $this->_type->convertToDatabaseValue($interval, $this->_platform);
$actual = $this->type->convertToDatabaseValue($interval, $this->platform);
$this->assertEquals($expected, $actual);
}
public function testDateIntervalConvertsToPHPValue()
{
$date = $this->_type->convertToPHPValue('P0002-00-01T01:02:03', $this->_platform);
$date = $this->type->convertToPHPValue('P0002-00-01T01:02:03', $this->platform);
$this->assertInstanceOf('DateInterval', $date);
$this->assertEquals('P2Y0M1DT1H2M3S', $date->format('P%yY%mM%dDT%hH%iM%sS'));
}
......@@ -37,12 +48,12 @@ class DateIntervalTest extends \Doctrine\Tests\DbalTestCase
public function testInvalidDateIntervalFormatConversion()
{
$this->setExpectedException('Doctrine\DBAL\Types\ConversionException');
$this->_type->convertToPHPValue('abcdefg', $this->_platform);
$this->type->convertToPHPValue('abcdefg', $this->platform);
}
public function testDateIntervalNullConversion()
{
$this->assertNull($this->_type->convertToPHPValue(null, $this->_platform));
$this->assertNull($this->type->convertToPHPValue(null, $this->platform));
}
/**
......@@ -50,6 +61,41 @@ class DateIntervalTest extends \Doctrine\Tests\DbalTestCase
*/
public function testRequiresSQLCommentHint()
{
$this->assertTrue($this->_type->requiresSQLCommentHint($this->_platform));
$this->assertTrue($this->type->requiresSQLCommentHint($this->platform));
}
/**
* @dataProvider invalidPHPValuesProvider
*
* @param mixed $value
*/
public function testInvalidTypeConversionToDatabaseValue($value)
{
$this->setExpectedException('Doctrine\DBAL\Types\ConversionException');
$this->type->convertToDatabaseValue($value, $this->platform);
}
/**
* @return mixed[][]
*/
public function invalidPHPValuesProvider()
{
return [
[0],
[''],
['foo'],
['10:11:12'],
['2015-01-31'],
['2015-01-31 10:11:12'],
[new \stdClass()],
[$this],
[27],
[-1],
[1.2],
[[]],
[['an array']],
[new \DateTime()],
];
}
}
......@@ -3,64 +3,31 @@
namespace Doctrine\Tests\DBAL\Types;
use Doctrine\DBAL\Types\Type;
use Doctrine\Tests\DBAL\Mocks\MockPlatform;
class DateTest extends \Doctrine\Tests\DbalTestCase
class DateTest extends BaseDateTypeTestCase
{
protected
$_platform,
$_type,
$_tz;
protected function setUp()
{
$this->_platform = new MockPlatform();
$this->_type = Type::getType('date');
$this->_tz = date_default_timezone_get();
}
public function tearDown()
{
date_default_timezone_set($this->_tz);
}
public function testDateConvertsToDatabaseValue()
{
$this->assertTrue(
is_string($this->_type->convertToDatabaseValue(new \DateTime(), $this->_platform))
);
}
/**
* @expectedException \Doctrine\DBAL\Types\ConversionException
* {@inheritDoc}
*/
public function testInvalidDateTimeValueInteger()
protected function setUp()
{
$date = 27;
$this->_type->convertToDatabaseValue($date, $this->_platform);
}
$this->type = Type::getType('date');
/**
* @expectedException \Doctrine\DBAL\Types\ConversionException
*/
public function testInvalidDateTimeValueStdClass()
{
$date = new \stdClass();
$this->_type->convertToDatabaseValue($date, $this->_platform);
parent::setUp();
}
public function testDateConvertsToPHPValue()
{
// Birthday of jwage and also birthday of Doctrine. Send him a present ;)
$this->assertTrue(
$this->_type->convertToPHPValue('1985-09-01', $this->_platform)
$this->type->convertToPHPValue('1985-09-01', $this->platform)
instanceof \DateTime
);
}
public function testDateResetsNonDatePartsToZeroUnixTimeValues()
{
$date = $this->_type->convertToPHPValue('1985-09-01', $this->_platform);
$date = $this->type->convertToPHPValue('1985-09-01', $this->platform);
$this->assertEquals('00:00:00', $date->format('H:i:s'));
}
......@@ -69,11 +36,11 @@ class DateTest extends \Doctrine\Tests\DbalTestCase
{
date_default_timezone_set('Europe/Berlin');
$date = $this->_type->convertToPHPValue('2009-08-01', $this->_platform);
$date = $this->type->convertToPHPValue('2009-08-01', $this->platform);
$this->assertEquals('00:00:00', $date->format('H:i:s'));
$this->assertEquals('2009-08-01', $date->format('Y-m-d'));
$date = $this->_type->convertToPHPValue('2009-11-01', $this->_platform);
$date = $this->type->convertToPHPValue('2009-11-01', $this->platform);
$this->assertEquals('00:00:00', $date->format('H:i:s'));
$this->assertEquals('2009-11-01', $date->format('Y-m-d'));
}
......@@ -81,17 +48,6 @@ class DateTest extends \Doctrine\Tests\DbalTestCase
public function testInvalidDateFormatConversion()
{
$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));
$this->type->convertToPHPValue('abcdefg', $this->platform);
}
}
......@@ -2,54 +2,34 @@
namespace Doctrine\Tests\DBAL\Types;
use Doctrine\DBAL\Types\ConversionException;
use Doctrine\DBAL\Types\Type;
use Doctrine\Tests\DBAL\Mocks\MockPlatform;
class DateTimeTest extends \Doctrine\Tests\DbalTestCase
class DateTimeTest extends BaseDateTypeTestCase
{
protected
$_platform,
$_type;
/**
* {@inheritDoc}
*/
protected function setUp()
{
$this->_platform = new MockPlatform();
$this->_type = Type::getType('datetime');
$this->type = Type::getType('datetime');
parent::setUp();
}
public function testDateTimeConvertsToDatabaseValue()
{
$date = new \DateTime('1985-09-01 10:10:10');
$expected = $date->format($this->_platform->getDateTimeTzFormatString());
$actual = $this->_type->convertToDatabaseValue($date, $this->_platform);
$expected = $date->format($this->platform->getDateTimeTzFormatString());
$actual = $this->type->convertToDatabaseValue($date, $this->platform);
$this->assertEquals($expected, $actual);
}
/**
* @expectedException \Doctrine\DBAL\Types\ConversionException
*/
public function testInvalidDateTimeValueInteger()
{
$date = 27;
$this->_type->convertToDatabaseValue($date, $this->_platform);
}
/**
* @expectedException \Doctrine\DBAL\Types\ConversionException
*/
public function testInvalidDateTimeValueStdClass()
{
$date = new \stdClass();
$this->_type->convertToDatabaseValue($date, $this->_platform);
}
public function testDateTimeConvertsToPHPValue()
{
// Birthday of jwage and also birthday of Doctrine. Send him a present ;)
$date = $this->_type->convertToPHPValue('1985-09-01 00:00:00', $this->_platform);
$date = $this->type->convertToPHPValue('1985-09-01 00:00:00', $this->platform);
$this->assertInstanceOf('DateTime', $date);
$this->assertEquals('1985-09-01 00:00:00', $date->format('Y-m-d H:i:s'));
}
......@@ -57,25 +37,14 @@ class DateTimeTest extends \Doctrine\Tests\DbalTestCase
public function testInvalidDateTimeFormatConversion()
{
$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));
$this->type->convertToPHPValue('abcdefg', $this->platform);
}
public function testConvertsNonMatchingFormatToPhpValueWithParser()
{
$date = '1985/09/01 10:10:10.12345';
$actual = $this->_type->convertToPHPValue($date, $this->_platform);
$actual = $this->type->convertToPHPValue($date, $this->platform);
$this->assertEquals('1985-09-01 10:10:10', $actual->format('Y-m-d H:i:s'));
}
......
......@@ -3,53 +3,33 @@
namespace Doctrine\Tests\DBAL\Types;
use Doctrine\DBAL\Types\Type;
use Doctrine\Tests\DBAL\Mocks\MockPlatform;
class DateTimeTzTest extends \Doctrine\Tests\DbalTestCase
class DateTimeTzTest extends BaseDateTypeTestCase
{
protected
$_platform,
$_type;
/**
* {@inheritDoc}
*/
protected function setUp()
{
$this->_platform = new MockPlatform();
$this->_type = Type::getType('datetimetz');
$this->type = Type::getType('datetimetz');
parent::setUp();
}
public function testDateTimeConvertsToDatabaseValue()
{
$date = new \DateTime('1985-09-01 10:10:10');
$expected = $date->format($this->_platform->getDateTimeTzFormatString());
$actual = $this->_type->convertToDatabaseValue($date, $this->_platform);
$expected = $date->format($this->platform->getDateTimeTzFormatString());
$actual = $this->type->convertToDatabaseValue($date, $this->platform);
$this->assertEquals($expected, $actual);
}
/**
* @expectedException \Doctrine\DBAL\Types\ConversionException
*/
public function testInvalidDateTimeValueInteger()
{
$date = 27;
$this->_type->convertToDatabaseValue($date, $this->_platform);
}
/**
* @expectedException \Doctrine\DBAL\Types\ConversionException
*/
public function testInvalidDateTimeValueStdClass()
{
$date = new \stdClass();
$this->_type->convertToDatabaseValue($date, $this->_platform);
}
public function testDateTimeConvertsToPHPValue()
{
// Birthday of jwage and also birthday of Doctrine. Send him a present ;)
$date = $this->_type->convertToPHPValue('1985-09-01 00:00:00', $this->_platform);
$date = $this->type->convertToPHPValue('1985-09-01 00:00:00', $this->platform);
$this->assertInstanceOf('DateTime', $date);
$this->assertEquals('1985-09-01 00:00:00', $date->format('Y-m-d H:i:s'));
}
......@@ -57,17 +37,6 @@ class DateTimeTzTest extends \Doctrine\Tests\DbalTestCase
public function testInvalidDateFormatConversion()
{
$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));
$this->type->convertToPHPValue('abcdefg', $this->platform);
}
}
......@@ -3,56 +3,28 @@
namespace Doctrine\Tests\DBAL\Types;
use Doctrine\DBAL\Types\Type;
use Doctrine\Tests\DBAL\Mocks\MockPlatform;
class TimeTest extends \Doctrine\Tests\DbalTestCase
class TimeTest extends BaseDateTypeTestCase
{
protected
$_platform,
$_type;
protected function setUp()
{
$this->_platform = new MockPlatform();
$this->_type = Type::getType('time');
}
public function testTimeConvertsToDatabaseValue()
{
$this->assertTrue(
is_string($this->_type->convertToDatabaseValue(new \DateTime(), $this->_platform))
);
}
/**
* @expectedException \Doctrine\DBAL\Types\ConversionException
* {@inheritDoc}
*/
public function testInvalidDateTimeValueInteger()
protected function setUp()
{
$date = 27;
$this->_type->convertToDatabaseValue($date, $this->_platform);
}
$this->type = Type::getType('time');
/**
* @expectedException \Doctrine\DBAL\Types\ConversionException
*/
public function testInvalidDateTimeValueStdClass()
{
$date = new \stdClass();
$this->_type->convertToDatabaseValue($date, $this->_platform);
parent::setUp();
}
public function testTimeConvertsToPHPValue()
{
$this->assertTrue(
$this->_type->convertToPHPValue('5:30:55', $this->_platform)
instanceof \DateTime
);
$this->assertInstanceOf('DateTime', $this->type->convertToPHPValue('5:30:55', $this->platform));
}
public function testDateFieldResetInPHPValue()
{
$time = $this->_type->convertToPHPValue('01:23:34', $this->_platform);
$time = $this->type->convertToPHPValue('01:23:34', $this->platform);
$this->assertEquals('01:23:34', $time->format('H:i:s'));
$this->assertEquals('1970-01-01', $time->format('Y-m-d'));
}
......@@ -60,17 +32,6 @@ class TimeTest extends \Doctrine\Tests\DbalTestCase
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));
$this->type->convertToPHPValue('abcdefg', $this->platform);
}
}
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