1
0
mirror of synced 2024-12-13 22:56:04 +03:00

Fixed #DDC-571

This commit is contained in:
Christian Heinrich 2010-05-08 00:59:21 +02:00 committed by Roman S. Borschel
parent ee04b31da3
commit dc3844e167
2 changed files with 9 additions and 5 deletions

View File

@ -25,7 +25,7 @@ use Doctrine\DBAL\Platforms\AbstractPlatform;
/**
* Type that maps an SQL INT to a PHP integer.
*
*
* @author Roman Borschel <roman@code-factory.org>
* @since 2.0
*/
@ -43,9 +43,9 @@ class IntegerType extends Type
public function convertToPHPValue($value, AbstractPlatform $platform)
{
return (int) $value;
return (null === $value) ? null : (int) $value;
}
public function getBindingType()
{
return \PDO::PARAM_INT;

View File

@ -6,7 +6,7 @@ use Doctrine\DBAL\Types\Type;
use Doctrine\Tests\DBAL\Mocks;
require_once __DIR__ . '/../../TestInit.php';
class IntegerTest extends \Doctrine\Tests\DbalTestCase
{
protected
@ -19,10 +19,14 @@ class IntegerTest extends \Doctrine\Tests\DbalTestCase
$this->_type = Type::getType('integer');
}
public function testDecimalConvertsToPHPValue()
public function testIntegerConvertsToPHPValue()
{
$this->assertTrue(
is_integer($this->_type->convertToPHPValue('1', $this->_platform))
);
$this->assertTrue(
is_null($this->_type->convertToPHPValue(null, $this->_platform))
);
}
}