Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed deprecated assertType #91

Merged
merged 3 commits into from Jul 26, 2011
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 9 additions & 9 deletions tests/Doctrine/Tests/ORM/EntityManagerTest.php
Expand Up @@ -26,32 +26,32 @@ public function testIsOpen()

public function testGetConnection()
{
$this->assertInstanceOf('\Doctrine\DBAL\Connection', $this->_em->getConnection());
$this->assertInstanceOf('Doctrine\DBAL\Connection', $this->_em->getConnection());
}

public function testGetMetadataFactory()
{
$this->assertInstanceOf('\Doctrine\ORM\Mapping\ClassMetadataFactory', $this->_em->getMetadataFactory());
$this->assertInstanceOf('Doctrine\ORM\Mapping\ClassMetadataFactory', $this->_em->getMetadataFactory());
}

public function testGetConfiguration()
{
$this->assertInstanceOf('\Doctrine\ORM\Configuration', $this->_em->getConfiguration());
$this->assertInstanceOf('Doctrine\ORM\Configuration', $this->_em->getConfiguration());
}

public function testGetUnitOfWork()
{
$this->assertInstanceOf('\Doctrine\ORM\UnitOfWork', $this->_em->getUnitOfWork());
$this->assertInstanceOf('Doctrine\ORM\UnitOfWork', $this->_em->getUnitOfWork());
}

public function testGetProxyFactory()
{
$this->assertInstanceOf('\Doctrine\ORM\Proxy\ProxyFactory', $this->_em->getProxyFactory());
$this->assertInstanceOf('Doctrine\ORM\Proxy\ProxyFactory', $this->_em->getProxyFactory());
}

public function testGetEventManager()
{
$this->assertInstanceOf('\Doctrine\Common\EventManager', $this->_em->getEventManager());
$this->assertInstanceOf('Doctrine\Common\EventManager', $this->_em->getEventManager());
}

public function testCreateNativeQuery()
Expand All @@ -64,7 +64,7 @@ public function testCreateNativeQuery()

public function testCreateQueryBuilder()
{
$this->assertInstanceOf('\Doctrine\ORM\QueryBuilder', $this->_em->createQueryBuilder());
$this->assertInstanceOf('Doctrine\ORM\QueryBuilder', $this->_em->createQueryBuilder());
}

public function testCreateQueryBuilderAliasValid()
Expand All @@ -83,7 +83,7 @@ public function testCreateQueryBuilderAliasValid()

public function testCreateQuery_DqlIsOptional()
{
$this->assertInstanceOf('\Doctrine\ORM\Query', $this->_em->createQuery());
$this->assertInstanceOf('Doctrine\ORM\Query', $this->_em->createQuery());
}

public function testGetPartialReference()
Expand All @@ -97,7 +97,7 @@ public function testGetPartialReference()
public function testCreateQuery()
{
$q = $this->_em->createQuery('SELECT 1');
$this->assertInstanceOf('\Doctrine\ORM\Query', $q);
$this->assertInstanceOf('Doctrine\ORM\Query', $q);
$this->assertEquals('SELECT 1', $q->getDql());
}

Expand Down
16 changes: 8 additions & 8 deletions tests/Doctrine/Tests/ORM/Functional/AdvancedAssociationTest.php
Expand Up @@ -64,8 +64,8 @@ public function testIssue()
$query = $this->_em->createQuery("SELECT p,t FROM Doctrine\Tests\ORM\Functional\Phrase p JOIN p.type t");
$res = $query->getResult();
$this->assertEquals(1, count($res));
$this->assertTrue($res[0]->getType() instanceof PhraseType);
$this->assertTrue($res[0]->getType()->getPhrases() instanceof \Doctrine\ORM\PersistentCollection);
$this->assertInstanceOf('Doctrine\Tests\ORM\Functional\PhraseType', $res[0]->getType());
$this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $res[0]->getType()->getPhrases());
$this->assertFalse($res[0]->getType()->getPhrases()->isInitialized());

$this->_em->clear();
Expand All @@ -74,17 +74,17 @@ public function testIssue()
$query = $this->_em->createQuery("SELECT p,t,pp FROM Doctrine\Tests\ORM\Functional\Phrase p JOIN p.type t JOIN t.phrases pp");
$res = $query->getResult();
$this->assertEquals(1, count($res));
$this->assertTrue($res[0]->getType() instanceof PhraseType);
$this->assertTrue($res[0]->getType()->getPhrases() instanceof \Doctrine\ORM\PersistentCollection);
$this->assertInstanceOf('Doctrine\Tests\ORM\Functional\PhraseType', $res[0]->getType());
$this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $res[0]->getType()->getPhrases());
$this->assertTrue($res[0]->getType()->getPhrases()->isInitialized());

$this->_em->clear();

// test3 - lazy-loading one-to-many after find()
$phrase3 = $this->_em->find('Doctrine\Tests\ORM\Functional\Phrase', $phrase->getId());
$definitions = $phrase3->getDefinitions();
$this->assertTrue($definitions instanceof \Doctrine\ORM\PersistentCollection);
$this->assertTrue($definitions[0] instanceof Definition);
$this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $definitions);
$this->assertInstanceOf('Doctrine\Tests\ORM\Functional\Definition', $definitions[0]);

$this->_em->clear();

Expand All @@ -95,7 +95,7 @@ public function testIssue()

$this->assertEquals(1, count($res));

$this->assertTrue($definitions[0] instanceof Definition);
$this->assertInstanceOf('Doctrine\Tests\ORM\Functional\Definition', $definitions[0]);
$this->assertEquals(2, $definitions->count());
}

Expand All @@ -119,7 +119,7 @@ public function testManyToMany()
$res = $query->getResult();
$types = $res[0]->getTypes();

$this->assertTrue($types[0] instanceof Type);
$this->assertInstanceOf('Doctrine\Tests\ORM\Functional\Type', $types[0]);
}
}

Expand Down
16 changes: 8 additions & 8 deletions tests/Doctrine/Tests/ORM/Functional/BasicFunctionalTest.php
Expand Up @@ -136,8 +136,8 @@ public function testBasicOneToOne()
->getSingleResult();

// Address has been eager-loaded because it cant be lazy
$this->assertTrue($user2->address instanceof CmsAddress);
$this->assertFalse($user2->address instanceof \Doctrine\ORM\Proxy\Proxy);
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddress', $user2->address);
$this->assertNotInstanceOf('Doctrine\ORM\Proxy\Proxy', $user2->address);
}

/**
Expand Down Expand Up @@ -276,7 +276,7 @@ public function testBasicOneToManyLeftJoin()
$this->assertEquals('Guilherme', $users[0]->name);
$this->assertEquals('gblanco', $users[0]->username);
$this->assertEquals('developer', $users[0]->status);
$this->assertTrue($users[0]->phonenumbers instanceof \Doctrine\ORM\PersistentCollection);
$this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $users[0]->phonenumbers);
$this->assertTrue($users[0]->phonenumbers->isInitialized());
$this->assertEquals(0, $users[0]->phonenumbers->count());
//$this->assertNull($users[0]->articles);
Expand Down Expand Up @@ -520,8 +520,8 @@ public function testSetSetAssociationWithGetReference()
$query = $this->_em->createQuery("select u, a from Doctrine\Tests\Models\CMS\CmsUser u join u.address a where u.username='gblanco'");
$gblanco = $query->getSingleResult();

$this->assertTrue($gblanco instanceof CmsUser);
$this->assertTrue($gblanco->getAddress() instanceof CmsAddress);
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $gblanco);
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddress', $gblanco->getAddress());
$this->assertEquals('Berlin', $gblanco->getAddress()->getCity());

}
Expand Down Expand Up @@ -629,7 +629,7 @@ public function testFlushDoesNotIssueUnnecessaryUpdates()
$user2 = $query->getSingleResult();

$this->assertEquals(1, count($user2->articles));
$this->assertTrue($user2->address instanceof CmsAddress);
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddress', $user2->address);

$oldLogger = $this->_em->getConnection()->getConfiguration()->getSQLLogger();
$debugStack = new \Doctrine\DBAL\Logging\DebugStack;
Expand Down Expand Up @@ -690,7 +690,7 @@ public function testQueryEntityByReference()
->setParameter('user', $userRef)
->getSingleResult();

$this->assertTrue($address2->getUser() instanceof \Doctrine\ORM\Proxy\Proxy);
$this->assertInstanceOf('Doctrine\ORM\Proxy\Proxy', $address2->getUser());
$this->assertTrue($userRef === $address2->getUser());
$this->assertFalse($userRef->__isInitialized__);
$this->assertEquals('Germany', $address2->country);
Expand Down Expand Up @@ -905,7 +905,7 @@ public function testMergePersistsNewEntities()
$this->_em->clear();

$user2 = $this->_em->find(get_class($managedUser), $userId);
$this->assertTrue($user2 instanceof CmsUser);
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $user2);
}

public function testMergeThrowsExceptionIfEntityWithGeneratedIdentifierDoesNotExist()
Expand Down
Expand Up @@ -45,7 +45,7 @@ public function testPersistCompositePkEntity()

$poi = $this->_em->find('Doctrine\Tests\Models\Navigation\NavPointOfInterest', array('lat' => 100, 'long' => 200));

$this->assertType('Doctrine\Tests\Models\Navigation\NavPointOfInterest', $poi);
$this->assertInstanceOf('Doctrine\Tests\Models\Navigation\NavPointOfInterest', $poi);
$this->assertEquals(100, $poi->getLat());
$this->assertEquals(200, $poi->getLong());
$this->assertEquals('Brandenburger Tor', $poi->getName());
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/ORM/Functional/DefaultValuesTest.php
Expand Up @@ -50,7 +50,7 @@ public function testSimpleDetachMerge() {
$this->_em->clear();

$a2 = $this->_em->find(get_class($a), $a->id);
$this->assertTrue($a2->getUser() instanceof DefaultValueUser);
$this->assertInstanceOf('Doctrine\Tests\ORM\Functional\DefaultValueUser', $a2->getUser());
$this->assertEquals($userId, $a2->getUser()->getId());
$this->assertEquals('Poweruser', $a2->getUser()->type);
}
Expand Down
12 changes: 6 additions & 6 deletions tests/Doctrine/Tests/ORM/Functional/EntityRepositoryTest.php
Expand Up @@ -47,7 +47,7 @@ public function testBasicFind()
$repos = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser');

$user = $repos->find($user1Id);
$this->assertTrue($user instanceof CmsUser);
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser',$user);
$this->assertEquals('Roman', $user->name);
$this->assertEquals('freak', $user->status);
}
Expand All @@ -59,7 +59,7 @@ public function testFindByField()

$users = $repos->findBy(array('status' => 'dev'));
$this->assertEquals(1, count($users));
$this->assertTrue($users[0] instanceof CmsUser);
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser',$users[0]);
$this->assertEquals('Guilherme', $users[0]->name);
$this->assertEquals('dev', $users[0]->status);
}
Expand All @@ -72,7 +72,7 @@ public function testFindFieldByMagicCall()

$users = $repos->findByStatus('dev');
$this->assertEquals(1, count($users));
$this->assertTrue($users[0] instanceof CmsUser);
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser',$users[0]);
$this->assertEquals('Guilherme', $users[0]->name);
$this->assertEquals('dev', $users[0]->status);
}
Expand Down Expand Up @@ -244,7 +244,7 @@ public function testFindOneByAssociationKey()
$repos = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsAddress');
$address = $repos->findOneBy(array('user' => $userId));

$this->assertType('Doctrine\Tests\Models\CMS\CmsAddress', $address);
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddress', $address);
$this->assertEquals($addressId, $address->id);
}

Expand Down Expand Up @@ -285,7 +285,7 @@ public function testFindOneAssociationByMagicCall()
$repos = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsAddress');
$address = $repos->findOneByUser($userId);

$this->assertType('Doctrine\Tests\Models\CMS\CmsAddress', $address);
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddress', $address);
$this->assertEquals($addressId, $address->id);
}

Expand All @@ -295,7 +295,7 @@ public function testValidNamedQueryRetrieval()

$query = $repos->createNamedQuery('all');

$this->assertType('Doctrine\ORM\Query', $query);
$this->assertInstanceOf('Doctrine\ORM\Query', $query);
$this->assertEquals('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u', $query->getDQL());
}

Expand Down
4 changes: 2 additions & 2 deletions tests/Doctrine/Tests/ORM/Functional/MappedSuperclassTest.php
Expand Up @@ -38,9 +38,9 @@ public function testCRUD()

$cleanFile = $this->_em->find(get_class($file), $file->getId());

$this->assertType('Doctrine\Tests\Models\DirectoryTree\Directory', $cleanFile->getParent());
$this->assertInstanceOf('Doctrine\Tests\Models\DirectoryTree\Directory', $cleanFile->getParent());
$this->assertEquals($directory->getId(), $cleanFile->getParent()->getId());
$this->assertType('Doctrine\Tests\Models\DirectoryTree\Directory', $cleanFile->getParent()->getParent());
$this->assertInstanceOf('Doctrine\Tests\Models\DirectoryTree\Directory', $cleanFile->getParent()->getParent());
$this->assertEquals($root->getId(), $cleanFile->getParent()->getParent()->getId());
}
}
Expand Up @@ -56,7 +56,7 @@ public function _testEagerLoad()
$result = $query->getResult();
$product = $result[0];

$this->assertTrue($product->getShipping() instanceof ECommerceShipping);
$this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceShipping', $product->getShipping());
$this->assertEquals(1, $product->getShipping()->getDays());
}

Expand All @@ -69,7 +69,7 @@ public function testLazyLoadsObjects() {
$result = $query->getResult();
$product = $result[0];

$this->assertTrue($product->getShipping() instanceof ECommerceShipping);
$this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceShipping', $product->getShipping());
$this->assertEquals(1, $product->getShipping()->getDays());
}

Expand Down
Expand Up @@ -64,7 +64,7 @@ public function testAddPersistRetrieve()
$this->_em->flush();

$this->assertEquals(2, count($p->getFeatures()));
$this->assertTrue($p->getFeatures() instanceof \Doctrine\ORM\PersistentCollection);
$this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $p->getFeatures());

$q = $this->_em->createQuery(
'SELECT p, f
Expand All @@ -75,7 +75,7 @@ public function testAddPersistRetrieve()
$res = $q->getResult();

$this->assertEquals(2, count($p->getFeatures()));
$this->assertTrue($p->getFeatures() instanceof \Doctrine\ORM\PersistentCollection);
$this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $p->getFeatures());

// Check that the features are the same instances still
foreach ($p->getFeatures() as $feature) {
Expand Down
6 changes: 3 additions & 3 deletions tests/Doctrine/Tests/ORM/Functional/Ticket/DDC237Test.php
Expand Up @@ -37,15 +37,15 @@ public function testUninitializedProxyIsInitializedOnFetchJoin()
$this->_em->clear();

$x2 = $this->_em->find(get_class($x), $x->id); // proxy injected for Y
$this->assertTrue($x2->y instanceof \Doctrine\ORM\Proxy\Proxy);
$this->assertInstanceOf('Doctrine\ORM\Proxy\Proxy', $x2->y);
$this->assertFalse($x2->y->__isInitialized__);

// proxy for Y is in identity map

$z2 = $this->_em->createQuery('select z,y from ' . get_class($z) . ' z join z.y y where z.id = ?1')
->setParameter(1, $z->id)
->getSingleResult();
$this->assertTrue($z2->y instanceof \Doctrine\ORM\Proxy\Proxy);
$this->assertInstanceOf('Doctrine\ORM\Proxy\Proxy', $x2->y);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the indentation is wrong here

$this->assertTrue($z2->y->__isInitialized__);
$this->assertEquals('Y', $z2->y->data);
$this->assertEquals($y->id, $z2->y->id);
Expand All @@ -56,7 +56,7 @@ public function testUninitializedProxyIsInitializedOnFetchJoin()
$this->assertNotSame($x, $x2);
$this->assertNotSame($z, $z2);
$this->assertSame($z2->y, $x2->y);
$this->assertTrue($z2->y instanceof \Doctrine\ORM\Proxy\Proxy);
$this->assertInstanceOf('Doctrine\ORM\Proxy\Proxy', $x2->y);

}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/ORM/Functional/Ticket/DDC258Test.php
Expand Up @@ -44,7 +44,7 @@ public function testIssue()

$e2 = $this->_em->find('Doctrine\Tests\ORM\Functional\Ticket\DDC258Super', $c2->id);

$this->assertType('Doctrine\Tests\ORM\Functional\Ticket\DDC258Class2', $e2);
$this->assertInstanceOf('Doctrine\Tests\ORM\Functional\Ticket\DDC258Class2', $e2);
$this->assertEquals('Bar', $e2->title);
$this->assertEquals('Bar', $e2->description);
$this->assertEquals('Bar', $e2->text);
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/ORM/Functional/Ticket/DDC345Test.php
Expand Up @@ -48,7 +48,7 @@ public function testTwoIterateHydrations()

$this->assertEquals(1, $membership->prePersistCallCount);
$this->assertEquals(0, $membership->preUpdateCallCount);
$this->assertTrue($membership->updated instanceof \DateTime);
$this->assertInstanceOf('DateTime', $membership->updated);
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/ORM/Functional/Ticket/DDC371Test.php
Expand Up @@ -41,7 +41,7 @@ public function testIssue()
->getResult();

$this->assertEquals(1, count($children));
$this->assertFalse($children[0]->parent instanceof \Doctrine\ORM\Proxy\Proxy);
$this->assertNotInstanceOf('Doctrine\ORM\Proxy\Proxy', $children[0]->parent);
$this->assertFalse($children[0]->parent->children->isInitialized());
$this->assertEquals(0, $children[0]->parent->children->unwrap()->count());
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/ORM/Functional/Ticket/DDC422Test.php
Expand Up @@ -28,7 +28,7 @@ public function testIssue()

$customer = $this->_em->find(get_class($customer), $customer->id);

$this->assertTrue($customer->contacts instanceof \Doctrine\ORM\PersistentCollection);
$this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $customer->contacts);
$this->assertFalse($customer->contacts->isInitialized());
$contact = new DDC422Contact;
$customer->contacts->add($contact);
Expand Down
4 changes: 2 additions & 2 deletions tests/Doctrine/Tests/ORM/Functional/Ticket/DDC440Test.php
Expand Up @@ -64,13 +64,13 @@ public function testOriginalEntityDataEmptyWhenProxyLoadedFromTwoAssociations()
// Test the first phone. The assertion actually failed because original entity data is not set properly.
// This was because it is also set as MainPhone and that one is created as a proxy, not the
// original object when the find on Client is called. However loading proxies did not work correctly.
$this->assertType('Doctrine\Tests\ORM\Functional\Ticket\DDC440Phone', $p1);
$this->assertInstanceOf('Doctrine\Tests\ORM\Functional\Ticket\DDC440Phone', $p1);
$originalData = $uw->getOriginalEntityData($p1);
$this->assertEquals($phone->getNumber(), $originalData['number']);


//If you comment out previous test, this one should pass
$this->assertType('Doctrine\Tests\ORM\Functional\Ticket\DDC440Phone', $p2);
$this->assertInstanceOf('Doctrine\Tests\ORM\Functional\Ticket\DDC440Phone', $p2);
$originalData = $uw->getOriginalEntityData($p2);
$this->assertEquals($phone2->getNumber(), $originalData['number']);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/ORM/Functional/Ticket/DDC501Test.php
Expand Up @@ -50,7 +50,7 @@ public function testMergeUnitializedManyToManyAndOneToManyCollections()

// freeze and unfreeze
$userClone = unserialize(serialize($userReloaded));
$this->assertType('Doctrine\Tests\Models\CMS\CmsUser', $userClone);
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $userClone);

// detached user can't know about his phonenumbers
$this->assertEquals(0, count($userClone->getPhonenumbers()));
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/ORM/Functional/Ticket/DDC633Test.php
Expand Up @@ -66,7 +66,7 @@ public function testDQLDeferredEagerLoad()
$appointments = $this->_em->createQuery("SELECT a FROM " . __NAMESPACE__ . "\DDC633Appointment a")->getResult();

foreach ($appointments AS $eagerAppointment) {
$this->assertType('Doctrine\ORM\Proxy\Proxy', $eagerAppointment->patient);
$this->assertInstanceOf('Doctrine\ORM\Proxy\Proxy', $eagerAppointment->patient);
$this->assertTrue($eagerAppointment->patient->__isInitialized__, "Proxy should already be initialized due to eager loading!");
}
}
Expand Down