Commit bcef6bfd authored by Benjamin Eberlei's avatar Benjamin Eberlei

Fix PHPUnit Deprecation warnings by introducing assertInternalType() and assertInstanceOf().

parent b94e0091
......@@ -66,7 +66,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
{
$config = $this->_conn->getConfiguration();
$this->assertType('Doctrine\DBAL\Configuration', $config);
$this->assertInstanceOf('Doctrine\DBAL\Configuration', $config);
}
public function testGetHost()
......@@ -91,12 +91,12 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
public function testGetDriver()
{
$this->assertType('Doctrine\DBAL\Driver\PDOMySql\Driver', $this->_conn->getDriver());
$this->assertInstanceOf('Doctrine\DBAL\Driver\PDOMySql\Driver', $this->_conn->getDriver());
}
public function testGetEventManager()
{
$this->assertType('Doctrine\Common\EventManager', $this->_conn->getEventManager());
$this->assertInstanceOf('Doctrine\Common\EventManager', $this->_conn->getEventManager());
}
public function testConnectDispatchEvent()
......
......@@ -79,7 +79,7 @@ class DriverManagerTest extends \Doctrine\Tests\DbalTestCase
);
$conn = \Doctrine\DBAL\DriverManager::getConnection($options);
$this->assertType($wrapperClass, $conn);
$this->assertInstanceOf($wrapperClass, $conn);
}
public function testInvalidWrapperClass()
......@@ -112,6 +112,6 @@ class DriverManagerTest extends \Doctrine\Tests\DbalTestCase
);
$conn = \Doctrine\DBAL\DriverManager::getConnection($options);
$this->assertType('Doctrine\DBAL\Driver\PDOMySql\Driver', $conn->getDriver());
$this->assertInstanceOf('Doctrine\DBAL\Driver\PDOMySql\Driver', $conn->getDriver());
}
}
\ No newline at end of file
......@@ -22,7 +22,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalFunctionalTestCase
public function testGetWrappedConnection()
{
$this->assertType('Doctrine\DBAL\Driver\Connection', $this->_conn->getWrappedConnection());
$this->assertInstanceOf('Doctrine\DBAL\Driver\Connection', $this->_conn->getWrappedConnection());
}
public function testCommitWithRollbackOnlyThrowsException()
......
......@@ -33,7 +33,7 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
{
$sql = "SELECT test_int, test_string FROM fetch_table WHERE test_int = ? AND test_string = ?";
$stmt = $this->_conn->prepare($sql);
$this->assertType('Doctrine\DBAL\Statement', $stmt);
$this->assertInstanceOf('Doctrine\DBAL\Statement', $stmt);
$stmt->bindValue(1, 1);
$stmt->bindValue(2, 'foo');
......@@ -51,7 +51,7 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
$sql = "SELECT test_int, test_string FROM fetch_table WHERE test_int = ? AND test_string = ?";
$stmt = $this->_conn->prepare($sql);
$this->assertType('Doctrine\DBAL\Statement', $stmt);
$this->assertInstanceOf('Doctrine\DBAL\Statement', $stmt);
$stmt->bindParam(1, $paramInt);
$stmt->bindParam(2, $paramStr);
......@@ -69,7 +69,7 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
$sql = "SELECT test_int, test_string FROM fetch_table WHERE test_int = ? AND test_string = ?";
$stmt = $this->_conn->prepare($sql);
$this->assertType('Doctrine\DBAL\Statement', $stmt);
$this->assertInstanceOf('Doctrine\DBAL\Statement', $stmt);
$stmt->bindParam(1, $paramInt);
$stmt->bindParam(2, $paramStr);
......@@ -87,7 +87,7 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
$sql = "SELECT test_int FROM fetch_table WHERE test_int = ? AND test_string = ?";
$stmt = $this->_conn->prepare($sql);
$this->assertType('Doctrine\DBAL\Statement', $stmt);
$this->assertInstanceOf('Doctrine\DBAL\Statement', $stmt);
$stmt->bindParam(1, $paramInt);
$stmt->bindParam(2, $paramStr);
......@@ -106,7 +106,7 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
$sql = "SELECT test_int, test_string FROM " . $this->_conn->quoteIdentifier($table) . " ".
"WHERE test_int = " . $this->_conn->quote($paramInt) . " AND test_string = " . $this->_conn->quote($paramStr);
$stmt = $this->_conn->prepare($sql);
$this->assertType('Doctrine\DBAL\Statement', $stmt);
$this->assertInstanceOf('Doctrine\DBAL\Statement', $stmt);
}
public function testPrepareWithExecuteParams()
......@@ -116,7 +116,7 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
$sql = "SELECT test_int, test_string FROM fetch_table WHERE test_int = ? AND test_string = ?";
$stmt = $this->_conn->prepare($sql);
$this->assertType('Doctrine\DBAL\Statement', $stmt);
$this->assertInstanceOf('Doctrine\DBAL\Statement', $stmt);
$stmt->execute(array($paramInt, $paramStr));
$row = $stmt->fetch(\PDO::FETCH_ASSOC);
......
......@@ -22,13 +22,13 @@ class PostgreSqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
$this->_conn->exec($createTableSQL);
$table = $this->_conn->getSchemaManager()->listTableDetails('domain_type_test');
$this->assertType('Doctrine\DBAL\Types\DecimalType', $table->getColumn('value')->getType());
$this->assertInstanceOf('Doctrine\DBAL\Types\DecimalType', $table->getColumn('value')->getType());
Type::addType('MyMoney', 'Doctrine\Tests\DBAL\Functional\Schema\MoneyType');
$this->_conn->getDatabasePlatform()->registerDoctrineTypeMapping('MyMoney', 'MyMoney');
$table = $this->_conn->getSchemaManager()->listTableDetails('domain_type_test');
$this->assertType('Doctrine\Tests\DBAL\Functional\Schema\MoneyType', $table->getColumn('value')->getType());
$this->assertInstanceOf('Doctrine\Tests\DBAL\Functional\Schema\MoneyType', $table->getColumn('value')->getType());
}
/**
......@@ -91,7 +91,7 @@ class PostgreSqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
$c = new \Doctrine\DBAL\Schema\Comparator();
$diff = $c->diffTable($tableFrom, $tableTo);
$this->assertType('Doctrine\DBAL\Schema\TableDiff', $diff, "There should be a difference and not false being returned from the table comparison");
$this->assertInstanceOf('Doctrine\DBAL\Schema\TableDiff', $diff, "There should be a difference and not false being returned from the table comparison");
$this->assertEquals(array("ALTER TABLE autoinc_table_drop ALTER id DROP DEFAULT"), $this->_conn->getDatabasePlatform()->getAlterTableSQL($diff));
$this->_sm->alterTable($diff);
......
......@@ -41,11 +41,11 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest
$sequences = $this->_sm->listSequences();
$this->assertType('array', $sequences, 'listSequences() should return an array.');
$this->assertInternalType('array', $sequences, 'listSequences() should return an array.');
$foundSequence = null;
foreach($sequences AS $sequence) {
$this->assertType('Doctrine\DBAL\Schema\Sequence', $sequence, 'Array elements of listSequences() should be Sequence instances.');
$this->assertInstanceOf('Doctrine\DBAL\Schema\Sequence', $sequence, 'Array elements of listSequences() should be Sequence instances.');
if(strtolower($sequence->getName()) == 'list_sequences_test_seq') {
$foundSequence = $sequence;
}
......@@ -75,12 +75,12 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest
$this->createTestTable('list_tables_test');
$tables = $this->_sm->listTables();
$this->assertType('array', $tables);
$this->assertInternalType('array', $tables);
$this->assertTrue(count($tables) > 0, "List Tables has to find at least one table named 'list_tables_test'.");
$foundTable = false;
foreach ($tables AS $table) {
$this->assertType('Doctrine\DBAL\Schema\Table', $table);
$this->assertInstanceOf('Doctrine\DBAL\Schema\Table', $table);
if (strtolower($table->getName()) == 'list_tables_test') {
$foundTable = true;
......@@ -117,31 +117,31 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest
$this->assertArrayHasKey('id', $columns);
$this->assertEquals('id', strtolower($columns['id']->getname()));
$this->assertType('Doctrine\DBAL\Types\IntegerType', $columns['id']->gettype());
$this->assertInstanceOf('Doctrine\DBAL\Types\IntegerType', $columns['id']->gettype());
$this->assertEquals(false, $columns['id']->getunsigned());
$this->assertEquals(true, $columns['id']->getnotnull());
$this->assertEquals(null, $columns['id']->getdefault());
$this->assertType('array', $columns['id']->getPlatformOptions());
$this->assertInternalType('array', $columns['id']->getPlatformOptions());
$this->assertArrayHasKey('test', $columns);
$this->assertEquals('test', strtolower($columns['test']->getname()));
$this->assertType('Doctrine\DBAL\Types\StringType', $columns['test']->gettype());
$this->assertInstanceOf('Doctrine\DBAL\Types\StringType', $columns['test']->gettype());
$this->assertEquals(255, $columns['test']->getlength());
$this->assertEquals(false, $columns['test']->getfixed());
$this->assertEquals(false, $columns['test']->getnotnull());
$this->assertEquals(null, $columns['test']->getdefault());
$this->assertType('array', $columns['test']->getPlatformOptions());
$this->assertInternalType('array', $columns['test']->getPlatformOptions());
$this->assertEquals('foo', strtolower($columns['foo']->getname()));
$this->assertType('Doctrine\DBAL\Types\TextType', $columns['foo']->gettype());
$this->assertInstanceOf('Doctrine\DBAL\Types\TextType', $columns['foo']->gettype());
$this->assertEquals(false, $columns['foo']->getunsigned());
$this->assertEquals(false, $columns['foo']->getfixed());
$this->assertEquals(true, $columns['foo']->getnotnull());
$this->assertEquals(null, $columns['foo']->getdefault());
$this->assertType('array', $columns['foo']->getPlatformOptions());
$this->assertInternalType('array', $columns['foo']->getPlatformOptions());
$this->assertEquals('bar', strtolower($columns['bar']->getname()));
$this->assertType('Doctrine\DBAL\Types\DecimalType', $columns['bar']->gettype());
$this->assertInstanceOf('Doctrine\DBAL\Types\DecimalType', $columns['bar']->gettype());
$this->assertEquals(null, $columns['bar']->getlength());
$this->assertEquals(10, $columns['bar']->getprecision());
$this->assertEquals(4, $columns['bar']->getscale());
......@@ -149,25 +149,25 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest
$this->assertEquals(false, $columns['bar']->getfixed());
$this->assertEquals(false, $columns['bar']->getnotnull());
$this->assertEquals(null, $columns['bar']->getdefault());
$this->assertType('array', $columns['bar']->getPlatformOptions());
$this->assertInternalType('array', $columns['bar']->getPlatformOptions());
$this->assertEquals('baz1', strtolower($columns['baz1']->getname()));
$this->assertType('Doctrine\DBAL\Types\DateTimeType', $columns['baz1']->gettype());
$this->assertInstanceOf('Doctrine\DBAL\Types\DateTimeType', $columns['baz1']->gettype());
$this->assertEquals(true, $columns['baz1']->getnotnull());
$this->assertEquals(null, $columns['baz1']->getdefault());
$this->assertType('array', $columns['baz1']->getPlatformOptions());
$this->assertInternalType('array', $columns['baz1']->getPlatformOptions());
$this->assertEquals('baz2', strtolower($columns['baz2']->getname()));
$this->assertContains($columns['baz2']->gettype()->getName(), array('time', 'date', 'datetime'));
$this->assertEquals(true, $columns['baz2']->getnotnull());
$this->assertEquals(null, $columns['baz2']->getdefault());
$this->assertType('array', $columns['baz2']->getPlatformOptions());
$this->assertInternalType('array', $columns['baz2']->getPlatformOptions());
$this->assertEquals('baz3', strtolower($columns['baz3']->getname()));
$this->assertContains($columns['baz2']->gettype()->getName(), array('time', 'date', 'datetime'));
$this->assertEquals(true, $columns['baz3']->getnotnull());
$this->assertEquals(null, $columns['baz3']->getdefault());
$this->assertType('array', $columns['baz3']->getPlatformOptions());
$this->assertInternalType('array', $columns['baz3']->getPlatformOptions());
}
public function testDiffListTableColumns()
......@@ -221,7 +221,7 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest
$this->_sm->dropAndCreateIndex($table->getIndex('test'), $table);
$tableIndexes = $this->_sm->listTableIndexes('test_create_index');
$this->assertType('array', $tableIndexes);
$this->assertInternalType('array', $tableIndexes);
$this->assertEquals('test', strtolower($tableIndexes['test']->getName()));
$this->assertEquals(array('test'), array_map('strtolower', $tableIndexes['test']->getColumns()));
......@@ -276,7 +276,7 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest
$this->assertEquals(1, count($fkeys), "Table 'test_create_fk1' has to have one foreign key.");
$this->assertType('Doctrine\DBAL\Schema\ForeignKeyConstraint', $fkeys[0]);
$this->assertInstanceOf('Doctrine\DBAL\Schema\ForeignKeyConstraint', $fkeys[0]);
$this->assertEquals(array('foreign_key_test'), array_map('strtolower', $fkeys[0]->getLocalColumns()));
$this->assertEquals(array('id'), array_map('strtolower', $fkeys[0]->getForeignColumns()));
$this->assertEquals('test_create_fk2', strtolower($fkeys[0]->getForeignTableName()));
......@@ -428,7 +428,7 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest
{
$foundTable = false;
foreach ($tables AS $table) {
$this->assertType('Doctrine\DBAL\Schema\Table', $table, 'No Table instance was found in tables array.');
$this->assertInstanceOf('Doctrine\DBAL\Schema\Table', $table, 'No Table instance was found in tables array.');
if (strtolower($table->getName()) == 'list_tables_test_new_name') {
$foundTable = true;
}
......
......@@ -426,7 +426,7 @@ class ComparatorTest extends \PHPUnit_Framework_TestCase
$c = new Comparator();
$tableDiff = $c->diffTable($table1, $table2);
$this->assertType('Doctrine\DBAL\Schema\TableDiff', $tableDiff);
$this->assertInstanceOf('Doctrine\DBAL\Schema\TableDiff', $tableDiff);
$this->assertEquals(1, count($tableDiff->addedForeignKeys));
}
......@@ -445,7 +445,7 @@ class ComparatorTest extends \PHPUnit_Framework_TestCase
$c = new Comparator();
$tableDiff = $c->diffTable($table2, $table1);
$this->assertType('Doctrine\DBAL\Schema\TableDiff', $tableDiff);
$this->assertInstanceOf('Doctrine\DBAL\Schema\TableDiff', $tableDiff);
$this->assertEquals(1, count($tableDiff->removedForeignKeys));
}
......@@ -465,7 +465,7 @@ class ComparatorTest extends \PHPUnit_Framework_TestCase
$c = new Comparator();
$tableDiff = $c->diffTable($table1, $table2);
$this->assertType('Doctrine\DBAL\Schema\TableDiff', $tableDiff);
$this->assertInstanceOf('Doctrine\DBAL\Schema\TableDiff', $tableDiff);
$this->assertEquals(1, count($tableDiff->changedForeignKeys));
}
......@@ -621,7 +621,7 @@ class ComparatorTest extends \PHPUnit_Framework_TestCase
$c = new Comparator();
$tableDiff = $c->diffTable($tableA, $tableB);
$this->assertType('Doctrine\DBAL\Schema\TableDiff', $tableDiff);
$this->assertInstanceOf('Doctrine\DBAL\Schema\TableDiff', $tableDiff);
$this->assertArrayHasKey('id', $tableDiff->changedColumns);
}
......
......@@ -92,7 +92,7 @@ class SchemaTest extends \PHPUnit_Framework_TestCase
$table = $schema->createTable("foo");
$this->assertType('Doctrine\DBAL\Schema\Table', $table);
$this->assertInstanceOf('Doctrine\DBAL\Schema\Table', $table);
$this->assertEquals("foo", $table->getName());
$this->assertTrue($schema->hasTable("foo"));
}
......@@ -104,7 +104,7 @@ class SchemaTest extends \PHPUnit_Framework_TestCase
$schema = new Schema(array(), array($sequence));
$this->assertTrue($schema->hasSequence("a_seq"));
$this->assertType('Doctrine\DBAL\Schema\Sequence', $schema->getSequence("a_seq"));
$this->assertInstanceOf('Doctrine\DBAL\Schema\Sequence', $schema->getSequence("a_seq"));
$sequences = $schema->getSequences();
$this->assertArrayHasKey('a_seq', $sequences);
......@@ -142,7 +142,7 @@ class SchemaTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(20, $sequence->getInitialValue());
$this->assertTrue($schema->hasSequence("a_seq"));
$this->assertType('Doctrine\DBAL\Schema\Sequence', $schema->getSequence("a_seq"));
$this->assertInstanceOf('Doctrine\DBAL\Schema\Sequence', $schema->getSequence("a_seq"));
$sequences = $schema->getSequences();
$this->assertArrayHasKey('a_seq', $sequences);
......
......@@ -38,8 +38,8 @@ class TableTest extends \PHPUnit_Framework_TestCase
$this->assertTrue($table->hasColumn("bar"));
$this->assertFalse($table->hasColumn("baz"));
$this->assertType('Doctrine\DBAL\Schema\Column', $table->getColumn("foo"));
$this->assertType('Doctrine\DBAL\Schema\Column', $table->getColumn("bar"));
$this->assertInstanceOf('Doctrine\DBAL\Schema\Column', $table->getColumn("foo"));
$this->assertInstanceOf('Doctrine\DBAL\Schema\Column', $table->getColumn("bar"));
$this->assertEquals(2, count($table->getColumns()));
}
......@@ -153,9 +153,9 @@ class TableTest extends \PHPUnit_Framework_TestCase
$this->assertTrue($table->hasIndex("bar_idx"));
$this->assertFalse($table->hasIndex("some_idx"));
$this->assertType('Doctrine\DBAL\Schema\Index', $table->getPrimaryKey());
$this->assertType('Doctrine\DBAL\Schema\Index', $table->getIndex('the_primary'));
$this->assertType('Doctrine\DBAL\Schema\Index', $table->getIndex('bar_idx'));
$this->assertInstanceOf('Doctrine\DBAL\Schema\Index', $table->getPrimaryKey());
$this->assertInstanceOf('Doctrine\DBAL\Schema\Index', $table->getIndex('the_primary'));
$this->assertInstanceOf('Doctrine\DBAL\Schema\Index', $table->getIndex('bar_idx'));
}
public function testGetUnknownIndexThrowsException()
......@@ -219,7 +219,7 @@ class TableTest extends \PHPUnit_Framework_TestCase
$table->setPrimaryKey(array("bar"));
$this->assertTrue($table->hasIndex("primary"));
$this->assertType('Doctrine\DBAL\Schema\Index', $table->getPrimaryKey());
$this->assertInstanceOf('Doctrine\DBAL\Schema\Index', $table->getPrimaryKey());
$this->assertTrue($table->getIndex("primary")->isUnique());
$this->assertTrue($table->getIndex("primary")->isPrimary());
}
......
......@@ -21,12 +21,12 @@ class BooleanTest extends \Doctrine\Tests\DbalTestCase
public function testBooleanConvertsToDatabaseValue()
{
$this->assertType('integer', $this->_type->convertToDatabaseValue(1, $this->_platform));
$this->assertInternalType('integer', $this->_type->convertToDatabaseValue(1, $this->_platform));
}
public function testBooleanConvertsToPHPValue()
{
$this->assertType('bool', $this->_type->convertToPHPValue(0, $this->_platform));
$this->assertInternalType('bool', $this->_type->convertToPHPValue(0, $this->_platform));
}
public function testBooleanNullConvertsToPHPValue()
......
......@@ -33,7 +33,7 @@ class DateTimeTest extends \Doctrine\Tests\DbalTestCase
{
// Birthday of jwage and also birthday of Doctrine. Send him a present ;)
$date = $this->_type->convertToPHPValue('1985-09-01 00:00:00', $this->_platform);
$this->assertType('DateTime', $date);
$this->assertInstanceOf('DateTime', $date);
$this->assertEquals('1985-09-01 00:00:00', $date->format('Y-m-d H:i:s'));
}
......
......@@ -33,7 +33,7 @@ class DateTimeTzTest extends \Doctrine\Tests\DbalTestCase
{
// Birthday of jwage and also birthday of Doctrine. Send him a present ;)
$date = $this->_type->convertToPHPValue('1985-09-01 00:00:00', $this->_platform);
$this->assertType('DateTime', $date);
$this->assertInstanceOf('DateTime', $date);
$this->assertEquals('1985-09-01 00:00:00', $date->format('Y-m-d H:i:s'));
}
......
......@@ -21,7 +21,7 @@ class DecimalTest extends \Doctrine\Tests\DbalTestCase
public function testDecimalConvertsToPHPValue()
{
$this->assertType('float', $this->_type->convertToPHPValue('5.5', $this->_platform));
$this->assertInternalType('float', $this->_type->convertToPHPValue('5.5', $this->_platform));
}
public function testDecimalNullConvertsToPHPValue()
......
......@@ -19,7 +19,7 @@ class FloatTest extends \Doctrine\Tests\DbalTestCase
public function testFloatConvertsToPHPValue()
{
$this->assertType('float', $this->_type->convertToPHPValue('5.5', $this->_platform));
$this->assertInternalType('float', $this->_type->convertToPHPValue('5.5', $this->_platform));
}
public function testFloatNullConvertsToPHPValue()
......@@ -29,7 +29,7 @@ class FloatTest extends \Doctrine\Tests\DbalTestCase
public function testFloatConvertToDatabaseValue()
{
$this->assertType('float', $this->_type->convertToDatabaseValue(5.5, $this->_platform));
$this->assertInternalType('float', $this->_type->convertToDatabaseValue(5.5, $this->_platform));
}
public function testFloatNullConvertToDatabaseValue()
......
......@@ -21,8 +21,8 @@ class IntegerTest extends \Doctrine\Tests\DbalTestCase
public function testIntegerConvertsToPHPValue()
{
$this->assertType('integer', $this->_type->convertToPHPValue('1', $this->_platform));
$this->assertType('integer', $this->_type->convertToPHPValue('0', $this->_platform));
$this->assertInternalType('integer', $this->_type->convertToPHPValue('1', $this->_platform));
$this->assertInternalType('integer', $this->_type->convertToPHPValue('0', $this->_platform));
}
public function testIntegerNullConvertsToPHPValue()
......
......@@ -26,12 +26,12 @@ class ObjectTest extends \Doctrine\Tests\DbalTestCase
public function testObjectConvertsToDatabaseValue()
{
$this->assertType('string', $this->_type->convertToDatabaseValue(new \stdClass(), $this->_platform));
$this->assertInternalType('string', $this->_type->convertToDatabaseValue(new \stdClass(), $this->_platform));
}
public function testObjectConvertsToPHPValue()
{
$this->assertType('object', $this->_type->convertToPHPValue(serialize(new \stdClass), $this->_platform));
$this->assertInternalType('object', $this->_type->convertToPHPValue(serialize(new \stdClass), $this->_platform));
}
public function testConversionFailure()
......
......@@ -21,8 +21,8 @@ class SmallIntTest extends \Doctrine\Tests\DbalTestCase
public function testSmallIntConvertsToPHPValue()
{
$this->assertType('integer', $this->_type->convertToPHPValue('1', $this->_platform));
$this->assertType('integer', $this->_type->convertToPHPValue('0', $this->_platform));
$this->assertInternalType('integer', $this->_type->convertToPHPValue('1', $this->_platform));
$this->assertInternalType('integer', $this->_type->convertToPHPValue('0', $this->_platform));
}
public function testSmallIntNullConvertsToPHPValue()
......
......@@ -31,8 +31,8 @@ class StringTest extends \Doctrine\Tests\DbalTestCase
public function testConvertToPHPValue()
{
$this->assertType("string", $this->_type->convertToPHPValue("foo", $this->_platform));
$this->assertType("string", $this->_type->convertToPHPValue("", $this->_platform));
$this->assertInternalType("string", $this->_type->convertToPHPValue("foo", $this->_platform));
$this->assertInternalType("string", $this->_type->convertToPHPValue("", $this->_platform));
}
public function testNullConversion()
......
......@@ -36,7 +36,7 @@ class VarDateTimeTest extends \Doctrine\Tests\DbalTestCase
{
// Birthday of jwage and also birthday of Doctrine. Send him a present ;)
$date = $this->_type->convertToPHPValue('1985-09-01 00:00:00', $this->_platform);
$this->assertType('DateTime', $date);
$this->assertInstanceOf('DateTime', $date);
$this->assertEquals('1985-09-01 00:00:00', $date->format('Y-m-d H:i:s'));
$this->assertEquals('000000', $date->format('u'));
}
......@@ -50,7 +50,7 @@ class VarDateTimeTest extends \Doctrine\Tests\DbalTestCase
public function testConversionWithMicroseconds()
{
$date = $this->_type->convertToPHPValue('1985-09-01 00:00:00.123456', $this->_platform);
$this->assertType('DateTime', $date);
$this->assertInstanceOf('DateTime', $date);
$this->assertEquals('1985-09-01 00:00:00', $date->format('Y-m-d H:i:s'));
$this->assertEquals('123456', $date->format('u'));
}
......
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