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 all commits
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
20 changes: 10 additions & 10 deletions tests/Doctrine/Tests/ORM/Functional/BasicFunctionalTest.php
Expand Up @@ -46,7 +46,7 @@ public function testBasicUnitsOfWorkWithOneToManyAssociation()
$this->_em->flush();
$this->assertTrue($this->_em->contains($ph));
$this->assertTrue($this->_em->contains($user));
//$this->assertTrue($user->phonenumbers instanceof \Doctrine\ORM\PersistentCollection);
//$this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $user->phonenumbers);

// Update name
$user->name = 'guilherme';
Expand Down Expand Up @@ -92,7 +92,7 @@ public function testOneToManyAssociationModification()
$this->_em->persist($user);
$this->_em->flush();

//$this->assertTrue($user->phonenumbers instanceof \Doctrine\ORM\PersistentCollection);
//$this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $user->phonenumbers);

// Remove the first element from the collection
unset($user->phonenumbers[0]);
Expand Down 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
36 changes: 18 additions & 18 deletions tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest.php
Expand Up @@ -50,8 +50,8 @@ public function testCRUD()
$entities = $query->getResult();

$this->assertEquals(2, count($entities));
$this->assertTrue($entities[0] instanceof CompanyPerson);
$this->assertTrue($entities[1] instanceof CompanyEmployee);
$this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyPerson', $entities[0]);
$this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyEmployee', $entities[1]);
$this->assertTrue(is_numeric($entities[0]->getId()));
$this->assertTrue(is_numeric($entities[1]->getId()));
$this->assertEquals('Roman S. Borschel', $entities[0]->getName());
Expand All @@ -65,15 +65,15 @@ public function testCRUD()
$entities = $query->getResult();

$this->assertEquals(1, count($entities));
$this->assertTrue($entities[0] instanceof CompanyEmployee);
$this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyEmployee', $entities[0]);
$this->assertTrue(is_numeric($entities[0]->getId()));
$this->assertEquals('Guilherme Blanco', $entities[0]->getName());
$this->assertEquals(100000, $entities[0]->getSalary());

$this->_em->clear();

$guilherme = $this->_em->getRepository(get_class($employee))->findOneBy(array('name' => 'Guilherme Blanco'));
$this->assertTrue($guilherme instanceof CompanyEmployee);
$this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyEmployee', $guilherme);
$this->assertEquals('Guilherme Blanco', $guilherme->getName());

$this->_em->clear();
Expand Down Expand Up @@ -110,7 +110,7 @@ public function testMultiLevelUpdateAndFind() {

$manager = $this->_em->find('Doctrine\Tests\Models\Company\CompanyManager', $manager->getId());

$this->assertTrue($manager instanceof CompanyManager);
$this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyManager', $manager);
$this->assertEquals('Roman B.', $manager->getName());
$this->assertEquals(119000, $manager->getSalary());
$this->assertEquals('CEO', $manager->getTitle());
Expand All @@ -130,12 +130,12 @@ public function testFindOnBaseClass() {

$person = $this->_em->find('Doctrine\Tests\Models\Company\CompanyPerson', $manager->getId());

$this->assertTrue($person instanceof CompanyManager);
$this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyManager', $person);
$this->assertEquals('Roman S. Borschel', $person->getName());
$this->assertEquals(100000, $person->getSalary());
$this->assertEquals('CTO', $person->getTitle());
$this->assertTrue(is_numeric($person->getId()));
//$this->assertTrue($person->getCar() instanceof CompanyCar);
//$this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyCar', $person->getCar());
}

public function testSelfReferencingOneToOne() {
Expand Down Expand Up @@ -167,9 +167,9 @@ public function testSelfReferencingOneToOne() {

$result = $query->getResult();
$this->assertEquals(1, count($result));
$this->assertTrue($result[0] instanceof CompanyPerson);
$this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyPerson', $result[0]);
$this->assertEquals('Mary Smith', $result[0]->getName());
$this->assertTrue($result[0]->getSpouse() instanceof CompanyEmployee);
$this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyEmployee', $result[0]->getSpouse());
$this->assertEquals('John Smith', $result[0]->getSpouse()->getName());
$this->assertSame($result[0], $result[0]->getSpouse()->getSpouse());
}
Expand Down Expand Up @@ -229,20 +229,20 @@ public function testLazyLoading1()
$result = $q->getResult();

$this->assertEquals(1, count($result));
$this->assertTrue($result[0] instanceof CompanyOrganization);
$this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyOrganization', $result[0]);
$this->assertNull($result[0]->getMainEvent());

$events = $result[0]->getEvents();

$this->assertTrue($events instanceof \Doctrine\ORM\PersistentCollection);
$this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $events);
$this->assertFalse($events->isInitialized());

$this->assertEquals(2, count($events));
if ($events[0] instanceof CompanyAuction) {
$this->assertTrue($events[1] instanceof CompanyRaffle);
$this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyRaffle', $events[1]);
} else {
$this->assertTrue($events[0] instanceof CompanyRaffle);
$this->assertTrue($events[1] instanceof CompanyAuction);
$this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyRaffle', $events[0]);
$this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyAuction', $events[1]);
}
}

Expand All @@ -263,7 +263,7 @@ public function testLazyLoading2()

$result = $q->getResult();
$this->assertEquals(1, count($result));
$this->assertTrue($result[0] instanceof CompanyAuction, sprintf("Is of class %s",get_class($result[0])));
$this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyAuction', $result[0], sprintf("Is of class %s",get_class($result[0])));

$this->_em->clear();

Expand All @@ -273,12 +273,12 @@ public function testLazyLoading2()
$result = $q->getResult();

$this->assertEquals(1, count($result));
$this->assertTrue($result[0] instanceof CompanyOrganization);
$this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyOrganization', $result[0]);

$mainEvent = $result[0]->getMainEvent();
// mainEvent should have been loaded because it can't be lazy
$this->assertTrue($mainEvent instanceof CompanyAuction);
$this->assertFalse($mainEvent instanceof \Doctrine\ORM\Proxy\Proxy);
$this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyAuction', $mainEvent);
$this->assertNotInstanceOf('Doctrine\ORM\Proxy\Proxy', $mainEvent);
}

/**
Expand Down
Expand Up @@ -43,9 +43,9 @@ public function testOneToOneAssocToBaseTypeBidirectional()

$related2 = $this->_em->find('Doctrine\Tests\ORM\Functional\CTIRelated', $relatedId);

$this->assertTrue($related2 instanceof CTIRelated);
$this->assertTrue($related2->getCTIParent() instanceof CTIChild);
$this->assertFalse($related2->getCTIParent() instanceof \Doctrine\ORM\Proxy\Proxy);
$this->assertInstanceOf('Doctrine\Tests\ORM\Functional\CTIRelated', $related2);
$this->assertInstanceOf('Doctrine\Tests\ORM\Functional\CTIChild', $related2->getCTIParent());
$this->assertNotInstanceOf('Doctrine\ORM\Proxy\Proxy', $related2->getCTIParent());
$this->assertEquals('hello', $related2->getCTIParent()->getData());

$this->assertSame($related2, $related2->getCTIParent()->getRelated());
Expand All @@ -69,7 +69,7 @@ public function testManyToManyToCTIHierarchy()
$this->assertFalse($mmrel2->getCTIChildren()->isInitialized());
$this->assertEquals(1, count($mmrel2->getCTIChildren()));
$this->assertTrue($mmrel2->getCTIChildren()->isInitialized());
$this->assertTrue($mmrel2->getCTIChildren()->get(0) instanceof CTIChild);
$this->assertInstanceOf('Doctrine\Tests\ORM\Functional\CTIChild', $mmrel2->getCTIChildren()->get(0));
}
}

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
6 changes: 3 additions & 3 deletions tests/Doctrine/Tests/ORM/Functional/DetachedEntityTest.php
Expand Up @@ -137,14 +137,14 @@ public function testUninitializedLazyAssociationsAreIgnoredOnMerge()
$this->_em->clear();

$address2 = $this->_em->find(get_class($address), $address->id);
$this->assertTrue($address2->user instanceof \Doctrine\ORM\Proxy\Proxy);
$this->assertInstanceOf('Doctrine\ORM\Proxy\Proxy', $address2->user);
$this->assertFalse($address2->user->__isInitialized__);
$detachedAddress2 = unserialize(serialize($address2));
$this->assertTrue($detachedAddress2->user instanceof \Doctrine\ORM\Proxy\Proxy);
$this->assertInstanceOf('Doctrine\ORM\Proxy\Proxy', $detachedAddress2->user);
$this->assertFalse($detachedAddress2->user->__isInitialized__);

$managedAddress2 = $this->_em->merge($detachedAddress2);
$this->assertTrue($managedAddress2->user instanceof \Doctrine\ORM\Proxy\Proxy);
$this->assertInstanceOf('Doctrine\ORM\Proxy\Proxy', $managedAddress2->user);
$this->assertFalse($managedAddress2->user === $detachedAddress2->user);
$this->assertFalse($managedAddress2->user->__isInitialized__);
}
Expand Down