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

Fixed some warnings from phpunit.

This commit is contained in:
Guilherme Blanco 2011-02-19 19:50:58 -02:00
parent 2b2d9e7a1d
commit dcf358f154
11 changed files with 96 additions and 93 deletions

View File

@ -192,7 +192,7 @@ class SqlWalker implements TreeWalker
* @param string $dqlAlias The DQL alias.
* @return string Generated table alias.
*/
public function getSqlTableAlias($tableName, $dqlAlias = '')
public function getSQLTableAlias($tableName, $dqlAlias = '')
{
$tableName .= $dqlAlias;
@ -212,7 +212,7 @@ class SqlWalker implements TreeWalker
* @param string $dqlAlias
* @return string
*/
public function setSqlTableAlias($tableName, $alias, $dqlAlias = '')
public function setSQLTableAlias($tableName, $alias, $dqlAlias = '')
{
$tableName .= $dqlAlias;
@ -227,7 +227,7 @@ class SqlWalker implements TreeWalker
* @param string $columnName
* @return string
*/
public function getSqlColumnAlias($columnName)
public function getSQLColumnAlias($columnName)
{
return $columnName . $this->_aliasCounter++;
}
@ -303,7 +303,7 @@ class SqlWalker implements TreeWalker
if ($sql != '') {
$sql .= ', ';
}
$sql .= $this->getSqlTableAlias($tableName, $dqlAlias) . '.' .
$sql .= $this->getSQLTableAlias($tableName, $dqlAlias) . '.' .
$qComp['metadata']->getQuotedColumnName($fieldName, $this->_platform) . " $orientation";
}
}
@ -342,7 +342,7 @@ class SqlWalker implements TreeWalker
}
$sql .= ($sql != '' ? ' AND ' : '')
. (($this->_useSqlTableAliases) ? $this->getSqlTableAlias($class->table['name'], $dqlAlias) . '.' : '')
. (($this->_useSqlTableAliases) ? $this->getSQLTableAlias($class->table['name'], $dqlAlias) . '.' : '')
. $class->discriminatorColumn['name'] . ' IN (' . implode(', ', $values) . ')';
}
}
@ -502,7 +502,7 @@ class SqlWalker implements TreeWalker
}
if ($this->_useSqlTableAliases) {
$sql .= $this->getSqlTableAlias($class->table['name'], $dqlAlias) . '.';
$sql .= $this->getSQLTableAlias($class->table['name'], $dqlAlias) . '.';
}
$sql .= reset($assoc['targetToSourceKeyColumns']);
@ -551,9 +551,9 @@ class SqlWalker implements TreeWalker
if ($class->isInheritanceTypeSingleTable() || $class->isInheritanceTypeJoined()) {
// Add discriminator columns to SQL
$rootClass = $this->_em->getClassMetadata($class->rootEntityName);
$tblAlias = $this->getSqlTableAlias($rootClass->table['name'], $dqlAlias);
$tblAlias = $this->getSQLTableAlias($rootClass->table['name'], $dqlAlias);
$discrColumn = $rootClass->discriminatorColumn;
$columnAlias = $this->getSqlColumnAlias($discrColumn['name']);
$columnAlias = $this->getSQLColumnAlias($discrColumn['name']);
$sql .= ", $tblAlias." . $discrColumn['name'] . ' AS ' . $columnAlias;
$columnAlias = $this->_platform->getSQLResultCasing($columnAlias);
@ -567,13 +567,13 @@ class SqlWalker implements TreeWalker
if ($assoc['isOwningSide'] && $assoc['type'] & ClassMetadata::TO_ONE) {
if (isset($assoc['inherited'])) {
$owningClass = $this->_em->getClassMetadata($assoc['inherited']);
$sqlTableAlias = $this->getSqlTableAlias($owningClass->table['name'], $dqlAlias);
$sqlTableAlias = $this->getSQLTableAlias($owningClass->table['name'], $dqlAlias);
} else {
$sqlTableAlias = $this->getSqlTableAlias($class->table['name'], $dqlAlias);
$sqlTableAlias = $this->getSQLTableAlias($class->table['name'], $dqlAlias);
}
foreach ($assoc['targetToSourceKeyColumns'] as $srcColumn) {
$columnAlias = $this->getSqlColumnAlias($srcColumn);
$columnAlias = $this->getSQLColumnAlias($srcColumn);
$sql .= ", $sqlTableAlias." . $srcColumn . ' AS ' . $columnAlias;
$columnAlias = $this->_platform->getSQLResultCasing($columnAlias);
$this->_rsm->addMetaResult($dqlAlias, $this->_platform->getSQLResultCasing($columnAlias), $srcColumn);
@ -584,11 +584,11 @@ class SqlWalker implements TreeWalker
} else {
// Add foreign key columns to SQL, if necessary
if ($addMetaColumns) {
$sqlTableAlias = $this->getSqlTableAlias($class->table['name'], $dqlAlias);
$sqlTableAlias = $this->getSQLTableAlias($class->table['name'], $dqlAlias);
foreach ($class->associationMappings as $assoc) {
if ($assoc['isOwningSide'] && $assoc['type'] & ClassMetadata::TO_ONE) {
foreach ($assoc['targetToSourceKeyColumns'] as $srcColumn) {
$columnAlias = $this->getSqlColumnAlias($srcColumn);
$columnAlias = $this->getSQLColumnAlias($srcColumn);
$sql .= ', ' . $sqlTableAlias . '.' . $srcColumn . ' AS ' . $columnAlias;
$columnAlias = $this->_platform->getSQLResultCasing($columnAlias);
$this->_rsm->addMetaResult($dqlAlias, $this->_platform->getSQLResultCasing($columnAlias), $srcColumn);
@ -622,7 +622,7 @@ class SqlWalker implements TreeWalker
$class = $this->_em->getClassMetadata($rangeDecl->abstractSchemaName);
$sql .= $class->getQuotedTableName($this->_platform) . ' '
. $this->getSqlTableAlias($class->table['name'], $dqlAlias);
. $this->getSQLTableAlias($class->table['name'], $dqlAlias);
if ($class->isInheritanceTypeJoined()) {
$sql .= $this->_generateClassTableInheritanceJoins($class, $dqlAlias);
@ -738,8 +738,8 @@ class SqlWalker implements TreeWalker
$targetClass = $this->_em->getClassMetadata($relation['targetEntity']);
$sourceClass = $this->_em->getClassMetadata($relation['sourceEntity']);
$targetTableName = $targetClass->getQuotedTableName($this->_platform);
$targetTableAlias = $this->getSqlTableAlias($targetClass->table['name'], $joinedDqlAlias);
$sourceTableAlias = $this->getSqlTableAlias($sourceClass->table['name'], $joinAssocPathExpr->identificationVariable);
$targetTableAlias = $this->getSQLTableAlias($targetClass->table['name'], $joinedDqlAlias);
$sourceTableAlias = $this->getSQLTableAlias($sourceClass->table['name'], $joinAssocPathExpr->identificationVariable);
// Ensure we got the owning side, since it has all mapping info
$assoc = ( ! $relation['isOwningSide']) ? $targetClass->associationMappings[$relation['mappedBy']] : $relation;
@ -790,7 +790,7 @@ class SqlWalker implements TreeWalker
} else if ($assoc['type'] == ClassMetadata::MANY_TO_MANY) {
// Join relation table
$joinTable = $assoc['joinTable'];
$joinTableAlias = $this->getSqlTableAlias($joinTable['name'], $joinedDqlAlias);
$joinTableAlias = $this->getSQLTableAlias($joinTable['name'], $joinedDqlAlias);
$sql .= $sourceClass->getQuotedJoinTableName($assoc, $this->_platform) . ' ' . $joinTableAlias . ' ON ';
$first = true;
@ -904,10 +904,10 @@ class SqlWalker implements TreeWalker
$tableName = $class->getTableName();
}
$sqlTableAlias = $this->getSqlTableAlias($tableName, $dqlAlias);
$sqlTableAlias = $this->getSQLTableAlias($tableName, $dqlAlias);
$columnName = $class->getQuotedColumnName($fieldName, $this->_platform);
$columnAlias = $this->getSqlColumnAlias($columnName);
$columnAlias = $this->getSQLColumnAlias($columnName);
$sql .= $sqlTableAlias . '.' . $columnName . ' AS ' . $columnAlias;
$columnAlias = $this->_platform->getSQLResultCasing($columnAlias);
$this->_rsm->addScalarResult($columnAlias, $resultAlias);
@ -1007,8 +1007,8 @@ class SqlWalker implements TreeWalker
if ($beginning) $beginning = false; else $sql .= ', ';
$sqlTableAlias = $this->getSqlTableAlias($tableName, $dqlAlias);
$columnAlias = $this->getSqlColumnAlias($mapping['columnName']);
$sqlTableAlias = $this->getSQLTableAlias($tableName, $dqlAlias);
$columnAlias = $this->getSQLColumnAlias($mapping['columnName']);
$sql .= $sqlTableAlias . '.' . $class->getQuotedColumnName($fieldName, $this->_platform)
. ' AS ' . $columnAlias;
@ -1029,8 +1029,8 @@ class SqlWalker implements TreeWalker
if ($beginning) $beginning = false; else $sql .= ', ';
$joinColumnName = $class->associationMappings[$idField]['joinColumns'][0]['name'];
$sqlTableAlias = $this->getSqlTableAlias($tableName, $dqlAlias);
$columnAlias = $this->getSqlColumnAlias($joinColumnName);
$sqlTableAlias = $this->getSQLTableAlias($tableName, $dqlAlias);
$columnAlias = $this->getSQLColumnAlias($joinColumnName);
$sql .= $sqlTableAlias . '.' . $joinColumnName . ' AS ' . $columnAlias;
$columnAlias = $this->_platform->getSQLResultCasing($columnAlias);
@ -1046,7 +1046,7 @@ class SqlWalker implements TreeWalker
if ($class->isInheritanceTypeSingleTable() || ! $this->_query->getHint(Query::HINT_FORCE_PARTIAL_LOAD)) {
foreach ($class->subClasses as $subClassName) {
$subClass = $this->_em->getClassMetadata($subClassName);
$sqlTableAlias = $this->getSqlTableAlias($subClass->table['name'], $dqlAlias);
$sqlTableAlias = $this->getSQLTableAlias($subClass->table['name'], $dqlAlias);
foreach ($subClass->fieldMappings as $fieldName => $mapping) {
if (isset($mapping['inherited']) || $partialFieldSet && !in_array($fieldName, $partialFieldSet)) {
continue;
@ -1054,7 +1054,7 @@ class SqlWalker implements TreeWalker
if ($beginning) $beginning = false; else $sql .= ', ';
$columnAlias = $this->getSqlColumnAlias($mapping['columnName']);
$columnAlias = $this->getSQLColumnAlias($mapping['columnName']);
$sql .= $sqlTableAlias . '.' . $subClass->getQuotedColumnName($fieldName, $this->_platform)
. ' AS ' . $columnAlias;
@ -1068,7 +1068,7 @@ class SqlWalker implements TreeWalker
if ($assoc['isOwningSide'] && $assoc['type'] & ClassMetadata::TO_ONE && ! isset($assoc['inherited'])) {
foreach ($assoc['targetToSourceKeyColumns'] as $srcColumn) {
if ($beginning) $beginning = false; else $sql .= ', ';
$columnAlias = $this->getSqlColumnAlias($srcColumn);
$columnAlias = $this->getSQLColumnAlias($srcColumn);
$sql .= $sqlTableAlias . '.' . $srcColumn . ' AS ' . $columnAlias;
$this->_rsm->addMetaResult($dqlAlias, $this->_platform->getSQLResultCasing($columnAlias), $srcColumn);
}
@ -1135,7 +1135,7 @@ class SqlWalker implements TreeWalker
$class = $this->_em->getClassMetadata($rangeDecl->abstractSchemaName);
$sql .= $class->getQuotedTableName($this->_platform) . ' '
. $this->getSqlTableAlias($class->table['name'], $dqlAlias);
. $this->getSQLTableAlias($class->table['name'], $dqlAlias);
if ($class->isInheritanceTypeJoined()) {
$sql .= $this->_generateClassTableInheritanceJoins($class, $dqlAlias);
@ -1222,7 +1222,7 @@ class SqlWalker implements TreeWalker
} else {
// IdentificationVariable
$class = $this->_queryComponents[$expr]['metadata'];
$tableAlias = $this->getSqlTableAlias($class->getTableName(), $expr);
$tableAlias = $this->getSQLTableAlias($class->getTableName(), $expr);
$first = true;
foreach ($class->identifier as $identifier) {
@ -1282,7 +1282,7 @@ class SqlWalker implements TreeWalker
$class = $this->_em->getClassMetadata($deleteClause->abstractSchemaName);
$sql .= $class->getQuotedTableName($this->_platform);
$this->setSqlTableAlias($class->getTableName(), $class->getTableName(), $deleteClause->aliasIdentificationVariable);
$this->setSQLTableAlias($class->getTableName(), $class->getTableName(), $deleteClause->aliasIdentificationVariable);
$this->_rootAliases[] = $deleteClause->aliasIdentificationVariable;
@ -1301,7 +1301,7 @@ class SqlWalker implements TreeWalker
$class = $this->_em->getClassMetadata($updateClause->abstractSchemaName);
$sql .= $class->getQuotedTableName($this->_platform);
$this->setSqlTableAlias($class->getTableName(), $class->getTableName(), $updateClause->aliasIdentificationVariable);
$this->setSQLTableAlias($class->getTableName(), $class->getTableName(), $updateClause->aliasIdentificationVariable);
$this->_rootAliases[] = $updateClause->aliasIdentificationVariable;
@ -1465,8 +1465,8 @@ class SqlWalker implements TreeWalker
if ($assoc['type'] == ClassMetadata::ONE_TO_MANY) {
$targetClass = $this->_em->getClassMetadata($assoc['targetEntity']);
$targetTableAlias = $this->getSqlTableAlias($targetClass->table['name']);
$sourceTableAlias = $this->getSqlTableAlias($class->table['name'], $dqlAlias);
$targetTableAlias = $this->getSQLTableAlias($targetClass->table['name']);
$sourceTableAlias = $this->getSQLTableAlias($class->table['name'], $dqlAlias);
$sql .= $targetClass->getQuotedTableName($this->_platform)
. ' ' . $targetTableAlias . ' WHERE ';
@ -1500,9 +1500,9 @@ class SqlWalker implements TreeWalker
$joinTable = $owningAssoc['joinTable'];
// SQL table aliases
$joinTableAlias = $this->getSqlTableAlias($joinTable['name']);
$targetTableAlias = $this->getSqlTableAlias($targetClass->table['name']);
$sourceTableAlias = $this->getSqlTableAlias($class->table['name'], $dqlAlias);
$joinTableAlias = $this->getSQLTableAlias($joinTable['name']);
$targetTableAlias = $this->getSQLTableAlias($targetClass->table['name']);
$sourceTableAlias = $this->getSQLTableAlias($class->table['name'], $dqlAlias);
// join to target table
$sql .= $targetClass->getQuotedJoinTableName($owningAssoc, $this->_platform)

View File

@ -26,32 +26,32 @@ class EntityManagerTest extends \Doctrine\Tests\OrmTestCase
public function testGetConnection()
{
$this->assertType('\Doctrine\DBAL\Connection', $this->_em->getConnection());
$this->assertInstanceOf('\Doctrine\DBAL\Connection', $this->_em->getConnection());
}
public function testGetMetadataFactory()
{
$this->assertType('\Doctrine\ORM\Mapping\ClassMetadataFactory', $this->_em->getMetadataFactory());
$this->assertInstanceOf('\Doctrine\ORM\Mapping\ClassMetadataFactory', $this->_em->getMetadataFactory());
}
public function testGetConfiguration()
{
$this->assertType('\Doctrine\ORM\Configuration', $this->_em->getConfiguration());
$this->assertInstanceOf('\Doctrine\ORM\Configuration', $this->_em->getConfiguration());
}
public function testGetUnitOfWork()
{
$this->assertType('\Doctrine\ORM\UnitOfWork', $this->_em->getUnitOfWork());
$this->assertInstanceOf('\Doctrine\ORM\UnitOfWork', $this->_em->getUnitOfWork());
}
public function testGetProxyFactory()
{
$this->assertType('\Doctrine\ORM\Proxy\ProxyFactory', $this->_em->getProxyFactory());
$this->assertInstanceOf('\Doctrine\ORM\Proxy\ProxyFactory', $this->_em->getProxyFactory());
}
public function testGetEventManager()
{
$this->assertType('\Doctrine\Common\EventManager', $this->_em->getEventManager());
$this->assertInstanceOf('\Doctrine\Common\EventManager', $this->_em->getEventManager());
}
public function testCreateNativeQuery()
@ -64,7 +64,7 @@ class EntityManagerTest extends \Doctrine\Tests\OrmTestCase
public function testCreateQueryBuilder()
{
$this->assertType('\Doctrine\ORM\QueryBuilder', $this->_em->createQueryBuilder());
$this->assertInstanceOf('\Doctrine\ORM\QueryBuilder', $this->_em->createQueryBuilder());
}
public function testCreateQueryBuilderAliasValid()
@ -83,7 +83,7 @@ class EntityManagerTest extends \Doctrine\Tests\OrmTestCase
public function testCreateQuery_DqlIsOptional()
{
$this->assertType('\Doctrine\ORM\Query', $this->_em->createQuery());
$this->assertInstanceOf('\Doctrine\ORM\Query', $this->_em->createQuery());
}
public function testGetPartialReference()
@ -97,7 +97,7 @@ class EntityManagerTest extends \Doctrine\Tests\OrmTestCase
public function testCreateQuery()
{
$q = $this->_em->createQuery('SELECT 1');
$this->assertType('\Doctrine\ORM\Query', $q);
$this->assertInstanceOf('\Doctrine\ORM\Query', $q);
$this->assertEquals('SELECT 1', $q->getDql());
}

View File

@ -402,12 +402,12 @@ class ClassTableInheritanceTest extends \Doctrine\Tests\OrmFunctionalTestCase
$this->_em->clear();
$ref = $this->_em->getReference('Doctrine\Tests\Models\Company\CompanyPerson', $manager->getId());
$this->assertNotType('Doctrine\ORM\Proxy\Proxy', $ref, "Cannot Request a proxy from a class that has subclasses.");
$this->assertType('Doctrine\Tests\Models\Company\CompanyPerson', $ref);
$this->assertType('Doctrine\Tests\Models\Company\CompanyEmployee', $ref, "Direct fetch of the reference has to load the child class Emplyoee directly.");
$this->assertNotInstanceOf('Doctrine\ORM\Proxy\Proxy', $ref, "Cannot Request a proxy from a class that has subclasses.");
$this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyPerson', $ref);
$this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyEmployee', $ref, "Direct fetch of the reference has to load the child class Emplyoee directly.");
$this->_em->clear();
$ref = $this->_em->getReference('Doctrine\Tests\Models\Company\CompanyManager', $manager->getId());
$this->assertType('Doctrine\ORM\Proxy\Proxy', $ref, "A proxy can be generated only if no subclasses exists for the requested reference.");
$this->assertInstanceOf('Doctrine\ORM\Proxy\Proxy', $ref, "A proxy can be generated only if no subclasses exists for the requested reference.");
}
}

View File

@ -82,8 +82,8 @@ class DetachedEntityTest extends \Doctrine\Tests\OrmFunctionalTestCase
// Merge back in
$user = $this->_em->merge($user); // merge cascaded to phonenumbers
$this->assertType('Doctrine\Tests\Models\CMS\CmsUser', $user->phonenumbers[0]->user);
$this->assertType('Doctrine\Tests\Models\CMS\CmsUser', $user->phonenumbers[1]->user);
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $user->phonenumbers[0]->user);
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $user->phonenumbers[1]->user);
$im = $this->_em->getUnitOfWork()->getIdentityMap();
$this->_em->flush();
@ -92,10 +92,10 @@ class DetachedEntityTest extends \Doctrine\Tests\OrmFunctionalTestCase
$this->assertNotSame($oldPhonenumbers, $phonenumbers, "Merge should replace the Detached Collection with a new PersistentCollection.");
$this->assertEquals(2, count($phonenumbers), "Failed to assert that two phonenumbers are contained in the merged users phonenumber collection.");
$this->assertType('Doctrine\Tests\Models\CMS\CmsPhonenumber', $phonenumbers[1]);
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsPhonenumber', $phonenumbers[1]);
$this->assertTrue($this->_em->contains($phonenumbers[1]), "Failed to assert that second phonenumber in collection is contained inside EntityManager persistence context.");
$this->assertType('Doctrine\Tests\Models\CMS\CmsPhonenumber', $phonenumbers[0]);
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsPhonenumber', $phonenumbers[0]);
$this->assertTrue($this->_em->getUnitOfWork()->isInIdentityMap($phonenumbers[0]));
$this->assertTrue($this->_em->contains($phonenumbers[0]), "Failed to assert that first phonenumber in collection is contained inside EntityManager persistence context.");
}
@ -170,7 +170,7 @@ class DetachedEntityTest extends \Doctrine\Tests\OrmFunctionalTestCase
$newUser = $query->getSingleResult();
$this->assertType('Doctrine\Tests\Models\CMS\CmsUser', $newUser);
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $newUser);
$this->assertEquals('gblanco', $newUser->username);
}

View File

@ -109,7 +109,7 @@ class OptimisticTest extends \Doctrine\Tests\OrmFunctionalTestCase
$this->_em->persist($test);
$this->_em->flush();
$this->assertType('int', $test->getVersion());
$this->assertInternalType('int', $test->getVersion());
$this->assertEquals($i + 1, $test->getVersion());
}
}
@ -121,7 +121,7 @@ class OptimisticTest extends \Doctrine\Tests\OrmFunctionalTestCase
$this->_em->persist($test);
$this->_em->flush();
$this->assertType('int', $test->getVersion());
$this->assertInternalType('int', $test->getVersion());
$this->assertEquals(1, $test->getVersion());
return $test;
@ -160,7 +160,7 @@ class OptimisticTest extends \Doctrine\Tests\OrmFunctionalTestCase
$this->_em->persist($test);
$this->_em->flush();
$this->assertType('DateTime', $test->version);
$this->assertInstanceOf('DateTime', $test->version);
return $test;
}
@ -174,7 +174,7 @@ class OptimisticTest extends \Doctrine\Tests\OrmFunctionalTestCase
$q->setParameter('id', $entity->id);
$test = $q->getSingleResult();
$this->assertType('DateTime', $test->version);
$this->assertInstanceOf('DateTime', $test->version);
// Manually increment the version datetime column
$format = $this->_em->getConnection()->getDatabasePlatform()->getDateTimeFormatString();

View File

@ -150,7 +150,7 @@ class ManyToManyBasicAssociationTest extends \Doctrine\Tests\OrmFunctionalTestCa
$user->groups[] = $group;
}
$this->assertType('Doctrine\ORM\PersistentCollection', $user->groups);
$this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $user->groups);
$this->assertTrue($user->groups->isDirty());
$this->assertEquals($groupCount, count($user->groups), "There should be 10 groups in the collection.");
@ -265,7 +265,7 @@ class ManyToManyBasicAssociationTest extends \Doctrine\Tests\OrmFunctionalTestCa
->setParameter(1, $user->getId())
->getSingleResult();
$this->assertEquals(0, count($newUser->groups));
$this->assertType('array', $newUser->groups->getMapping());
$this->assertInternalType('array', $newUser->groups->getMapping());
$newUser->addGroup($group);

View File

@ -105,7 +105,7 @@ class SingleTableInheritanceTest extends \Doctrine\Tests\OrmFunctionalTestCase
$contract = $this->_em->find('Doctrine\Tests\Models\Company\CompanyFixContract', $fixContract->getId());
$this->assertType('Doctrine\Tests\Models\Company\CompanyFixContract', $contract);
$this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyFixContract', $contract);
$this->assertEquals(1000, $contract->getFixPrice());
$this->assertEquals($this->salesPerson->getId(), $contract->getSalesPerson()->getId());
}
@ -126,7 +126,7 @@ class SingleTableInheritanceTest extends \Doctrine\Tests\OrmFunctionalTestCase
$contract = $this->_em->find('Doctrine\Tests\Models\Company\CompanyFlexUltraContract', $ultraContract->getId());
$this->assertType('Doctrine\Tests\Models\Company\CompanyFlexUltraContract', $contract);
$this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyFlexUltraContract', $contract);
$this->assertEquals(7000, $contract->getMaxPrice());
$this->assertEquals(100, $contract->getHoursWorked());
$this->assertEquals(50, $contract->getPricePerHour());
@ -181,7 +181,7 @@ class SingleTableInheritanceTest extends \Doctrine\Tests\OrmFunctionalTestCase
$contract = $this->_em->find('Doctrine\Tests\Models\Company\CompanyContract', $this->fix->getId());
$this->assertType('Doctrine\Tests\Models\Company\CompanyFixContract', $contract);
$this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyFixContract', $contract);
$this->assertEquals(1000, $contract->getFixPrice());
}
@ -235,7 +235,7 @@ class SingleTableInheritanceTest extends \Doctrine\Tests\OrmFunctionalTestCase
$dql = 'SELECT c FROM Doctrine\Tests\Models\Company\CompanyFixContract c WHERE c.fixPrice = ?1';
$contract = $this->_em->createQuery($dql)->setParameter(1, 1000)->getSingleResult();
$this->assertType('Doctrine\Tests\Models\Company\CompanyFixContract', $contract);
$this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyFixContract', $contract);
$this->assertEquals(1000, $contract->getFixPrice());
}
@ -341,12 +341,12 @@ class SingleTableInheritanceTest extends \Doctrine\Tests\OrmFunctionalTestCase
$this->loadFullFixture();
$ref = $this->_em->getReference('Doctrine\Tests\Models\Company\CompanyContract', $this->fix->getId());
$this->assertNotType('Doctrine\ORM\Proxy\Proxy', $ref, "Cannot Request a proxy from a class that has subclasses.");
$this->assertType('Doctrine\Tests\Models\Company\CompanyContract', $ref);
$this->assertType('Doctrine\Tests\Models\Company\CompanyFixContract', $ref, "Direct fetch of the reference has to load the child class Emplyoee directly.");
$this->assertNotInstanceOf('Doctrine\ORM\Proxy\Proxy', $ref, "Cannot Request a proxy from a class that has subclasses.");
$this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyContract', $ref);
$this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyFixContract', $ref, "Direct fetch of the reference has to load the child class Emplyoee directly.");
$this->_em->clear();
$ref = $this->_em->getReference('Doctrine\Tests\Models\Company\CompanyFixContract', $this->fix->getId());
$this->assertType('Doctrine\ORM\Proxy\Proxy', $ref, "A proxy can be generated only if no subclasses exists for the requested reference.");
$this->assertInstanceOf('Doctrine\ORM\Proxy\Proxy', $ref, "A proxy can be generated only if no subclasses exists for the requested reference.");
}
}

View File

@ -51,9 +51,9 @@ class DDC117Test extends \Doctrine\Tests\OrmFunctionalTestCase
$idCriteria = array('source' => $this->article1->id(), 'target' => $this->article2->id());
$mapRef = $this->_em->find("Doctrine\Tests\Models\DDC117\DDC117Reference", $idCriteria);
$this->assertType("Doctrine\Tests\Models\DDC117\DDC117Reference", $mapRef);
$this->assertType("Doctrine\Tests\Models\DDC117\DDC117Article", $mapRef->target());
$this->assertType("Doctrine\Tests\Models\DDC117\DDC117Article", $mapRef->source());
$this->assertInstanceOf("Doctrine\Tests\Models\DDC117\DDC117Reference", $mapRef);
$this->assertInstanceOf("Doctrine\Tests\Models\DDC117\DDC117Article", $mapRef->target());
$this->assertInstanceOf("Doctrine\Tests\Models\DDC117\DDC117Article", $mapRef->source());
$this->assertSame($mapRef, $this->_em->find("Doctrine\Tests\Models\DDC117\DDC117Reference", $idCriteria));
$this->_em->clear();
@ -61,9 +61,9 @@ class DDC117Test extends \Doctrine\Tests\OrmFunctionalTestCase
$dql = "SELECT r, s FROM "."Doctrine\Tests\Models\DDC117\DDC117Reference r JOIN r.source s WHERE r.source = ?1";
$dqlRef = $this->_em->createQuery($dql)->setParameter(1, 1)->getSingleResult();
$this->assertType("Doctrine\Tests\Models\DDC117\DDC117Reference", $mapRef);
$this->assertType("Doctrine\Tests\Models\DDC117\DDC117Article", $mapRef->target());
$this->assertType("Doctrine\Tests\Models\DDC117\DDC117Article", $mapRef->source());
$this->assertInstanceOf("Doctrine\Tests\Models\DDC117\DDC117Reference", $mapRef);
$this->assertInstanceOf("Doctrine\Tests\Models\DDC117\DDC117Article", $mapRef->target());
$this->assertInstanceOf("Doctrine\Tests\Models\DDC117\DDC117Article", $mapRef->source());
$this->assertSame($dqlRef, $this->_em->find("Doctrine\Tests\Models\DDC117\DDC117Reference", $idCriteria));
$this->_em->clear();
@ -71,9 +71,9 @@ class DDC117Test extends \Doctrine\Tests\OrmFunctionalTestCase
$dql = "SELECT r, s FROM "."Doctrine\Tests\Models\DDC117\DDC117Reference r JOIN r.source s WHERE s.title = ?1";
$dqlRef = $this->_em->createQuery($dql)->setParameter(1, 'Foo')->getSingleResult();
$this->assertType("Doctrine\Tests\Models\DDC117\DDC117Reference", $dqlRef);
$this->assertType("Doctrine\Tests\Models\DDC117\DDC117Article", $dqlRef->target());
$this->assertType("Doctrine\Tests\Models\DDC117\DDC117Article", $dqlRef->source());
$this->assertInstanceOf("Doctrine\Tests\Models\DDC117\DDC117Reference", $dqlRef);
$this->assertInstanceOf("Doctrine\Tests\Models\DDC117\DDC117Article", $dqlRef->target());
$this->assertInstanceOf("Doctrine\Tests\Models\DDC117\DDC117Article", $dqlRef->source());
$this->assertSame($dqlRef, $this->_em->find("Doctrine\Tests\Models\DDC117\DDC117Reference", $idCriteria));
$dql = "SELECT r, s FROM "."Doctrine\Tests\Models\DDC117\DDC117Reference r JOIN r.source s WHERE s.title = ?1";
@ -109,8 +109,9 @@ class DDC117Test extends \Doctrine\Tests\OrmFunctionalTestCase
$refs = $this->_em->createQuery($dql)->setParameter(1, 'Foo')->getResult();
$this->assertTrue(count($refs) > 0, "Has to contain at least one Reference.");
foreach ($refs AS $ref) {
$this->assertType("Doctrine\Tests\Models\DDC117\DDC117Reference", $ref, "Contains only Reference instances.");
$this->assertInstanceOf("Doctrine\Tests\Models\DDC117\DDC117Reference", $ref, "Contains only Reference instances.");
$this->assertTrue($this->_em->contains($ref), "Contains Reference in the IdentityMap.");
}
}
@ -155,8 +156,9 @@ class DDC117Test extends \Doctrine\Tests\OrmFunctionalTestCase
$this->article1 = $this->_em->find("Doctrine\Tests\Models\DDC117\DDC117Article", $this->article1->id());
$this->assertEquals(1, count($this->article1->references()));
foreach ($this->article1->references() AS $this->reference) {
$this->assertType("Doctrine\Tests\Models\DDC117\DDC117Reference", $this->reference);
$this->assertInstanceOf("Doctrine\Tests\Models\DDC117\DDC117Reference", $this->reference);
$this->assertSame($this->article1, $this->reference->source());
}
@ -168,8 +170,9 @@ class DDC117Test extends \Doctrine\Tests\OrmFunctionalTestCase
->getSingleResult();
$this->assertEquals(1, count($this->article1->references()));
foreach ($this->article1->references() AS $this->reference) {
$this->assertType("Doctrine\Tests\Models\DDC117\DDC117Reference", $this->reference);
$this->assertInstanceOf("Doctrine\Tests\Models\DDC117\DDC117Reference", $this->reference);
$this->assertSame($this->article1, $this->reference->source());
}
}
@ -182,7 +185,7 @@ class DDC117Test extends \Doctrine\Tests\OrmFunctionalTestCase
$idCriteria = array('article' => $this->article1->id(), 'language' => 'en');
$this->translation = $this->_em->find('Doctrine\Tests\Models\DDC117\DDC117Translation', $idCriteria);
$this->assertType('Doctrine\Tests\Models\DDC117\DDC117Translation', $this->translation);
$this->assertInstanceOf('Doctrine\Tests\Models\DDC117\DDC117Translation', $this->translation);
$this->assertSame($this->translation, $this->_em->find('Doctrine\Tests\Models\DDC117\DDC117Translation', $idCriteria));
@ -194,7 +197,7 @@ class DDC117Test extends \Doctrine\Tests\OrmFunctionalTestCase
->setParameter(2, 'en')
->getSingleResult();
$this->assertType('Doctrine\Tests\Models\DDC117\DDC117Translation', $this->translation);
$this->assertInstanceOf('Doctrine\Tests\Models\DDC117\DDC117Translation', $this->translation);
}
/**
@ -279,9 +282,9 @@ class DDC117Test extends \Doctrine\Tests\OrmFunctionalTestCase
$approveChanges = $this->_em->find("Doctrine\Tests\Models\DDC117\DDC117ApproveChanges", $approveChanges->getId());
$this->assertType('Doctrine\Tests\Models\DDC117\DDC117ArticleDetails', $approveChanges->getArticleDetails());
$this->assertType('Doctrine\Tests\Models\DDC117\DDC117Reference', $approveChanges->getReference());
$this->assertType('Doctrine\Tests\Models\DDC117\DDC117Translation', $approveChanges->getTranslation());
$this->assertInstanceOf('Doctrine\Tests\Models\DDC117\DDC117ArticleDetails', $approveChanges->getArticleDetails());
$this->assertInstanceOf('Doctrine\Tests\Models\DDC117\DDC117Reference', $approveChanges->getReference());
$this->assertInstanceOf('Doctrine\Tests\Models\DDC117\DDC117Translation', $approveChanges->getTranslation());
}
/**
@ -340,7 +343,7 @@ class DDC117Test extends \Doctrine\Tests\OrmFunctionalTestCase
{
$editor = $this->loadEditorFixture();
$this->assertType('Doctrine\Tests\Models\DDC117\DDC117Translation', $editor->reviewingTranslations[0]);
$this->assertInstanceOf('Doctrine\Tests\Models\DDC117\DDC117Translation', $editor->reviewingTranslations[0]);
$reviewedBy = $editor->reviewingTranslations[0]->getReviewedByEditors();
$this->assertEquals(1, count($reviewedBy));
@ -355,7 +358,7 @@ class DDC117Test extends \Doctrine\Tests\OrmFunctionalTestCase
->setParameter(2, $this->translation->getLanguage())
->getSingleResult();
$this->assertType('Doctrine\Tests\Models\DDC117\DDC117Translation', $trans);
$this->assertInstanceOf('Doctrine\Tests\Models\DDC117\DDC117Translation', $trans);
$this->assertContainsOnly('Doctrine\Tests\Models\DDC117\DDC117Editor', $trans->reviewedByEditors);
$this->assertEquals(1, count($trans->reviewedByEditors));
}

View File

@ -90,7 +90,7 @@ class TypeTest extends \Doctrine\Tests\OrmFunctionalTestCase
$dql = "SELECT s FROM Doctrine\Tests\Models\Generic\SerializationModel s";
$serialize = $this->_em->createQuery($dql)->getSingleResult();
$this->assertType('stdClass', $serialize->object);
$this->assertInstanceOf('stdClass', $serialize->object);
}
public function testDate()
@ -104,7 +104,7 @@ class TypeTest extends \Doctrine\Tests\OrmFunctionalTestCase
$dateTimeDb = $this->_em->find('Doctrine\Tests\Models\Generic\DateTimeModel', $dateTime->id);
$this->assertType('DateTime', $dateTimeDb->date);
$this->assertInstanceOf('DateTime', $dateTimeDb->date);
$this->assertEquals('2009-10-01', $dateTimeDb->date->format('Y-m-d'));
}
@ -119,7 +119,7 @@ class TypeTest extends \Doctrine\Tests\OrmFunctionalTestCase
$dateTimeDb = $this->_em->find('Doctrine\Tests\Models\Generic\DateTimeModel', $dateTime->id);
$this->assertType('DateTime', $dateTime->datetime);
$this->assertInstanceOf('DateTime', $dateTime->datetime);
$this->assertEquals('2009-10-02 20:10:52', $dateTimeDb->datetime->format('Y-m-d H:i:s'));
}
@ -169,7 +169,7 @@ class TypeTest extends \Doctrine\Tests\OrmFunctionalTestCase
$dateTimeDb = $this->_em->find('Doctrine\Tests\Models\Generic\DateTimeModel', $dateTime->id);
$this->assertType('DateTime', $dateTime->time);
$this->assertInstanceOf('DateTime', $dateTime->time);
$this->assertEquals('19:27:20', $dateTime->time->format('H:i:s'));
}
}

View File

@ -78,7 +78,7 @@ abstract class AbstractMappingDriverTest extends \Doctrine\Tests\OrmTestCase
*/
public function testEntitySequence($class)
{
$this->assertType('array', $class->sequenceGeneratorDefinition, 'No Sequence Definition set on this driver.');
$this->assertInternalType('array', $class->sequenceGeneratorDefinition, 'No Sequence Definition set on this driver.');
$this->assertEquals(
array(
'sequenceName' => 'tablename_seq',

View File

@ -15,7 +15,7 @@ class ParserResultTest extends \PHPUnit_Framework_TestCase
public function testGetRsm()
{
$this->assertType(
$this->assertInstanceOf(
'Doctrine\ORM\Query\ResultSetMapping',
$this->parserResult->getResultSetMapping()
);
@ -39,7 +39,7 @@ class ParserResultTest extends \PHPUnit_Framework_TestCase
public function testGetParameterMappings()
{
$this->assertType('array', $this->parserResult->getParameterMappings());
$this->assertInternalType('array', $this->parserResult->getParameterMappings());
$this->parserResult->addParameterMapping(1, 1);
$this->parserResult->addParameterMapping(1, 2);