diff --git a/tests/Doctrine/Tests/ORM/Functional/BasicFunctionalTest.php b/tests/Doctrine/Tests/ORM/Functional/BasicFunctionalTest.php index f69b3f862ae..d94aa253df2 100644 --- a/tests/Doctrine/Tests/ORM/Functional/BasicFunctionalTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/BasicFunctionalTest.php @@ -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'; @@ -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]); diff --git a/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest.php b/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest.php index 0fbff503e70..3456d4ba07b 100644 --- a/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest.php @@ -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()); @@ -65,7 +65,7 @@ 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()); @@ -73,7 +73,7 @@ public function testCRUD() $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(); @@ -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()); @@ -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() { @@ -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()); } @@ -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]); } } @@ -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(); @@ -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); } /** diff --git a/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest2.php b/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest2.php index d720f5d92ab..e558f2abb49 100644 --- a/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest2.php +++ b/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest2.php @@ -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()); @@ -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)); } } diff --git a/tests/Doctrine/Tests/ORM/Functional/DetachedEntityTest.php b/tests/Doctrine/Tests/ORM/Functional/DetachedEntityTest.php index c6509f938ba..5d7e889aeff 100644 --- a/tests/Doctrine/Tests/ORM/Functional/DetachedEntityTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/DetachedEntityTest.php @@ -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__); } diff --git a/tests/Doctrine/Tests/ORM/Functional/ManyToManyBasicAssociationTest.php b/tests/Doctrine/Tests/ORM/Functional/ManyToManyBasicAssociationTest.php index 5f97717d46c..cbdb4410497 100644 --- a/tests/Doctrine/Tests/ORM/Functional/ManyToManyBasicAssociationTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/ManyToManyBasicAssociationTest.php @@ -47,7 +47,7 @@ public function testBasicManyToManyJoin() $result = $query->getResult(); $this->assertEquals(2, $this->_em->getUnitOfWork()->size()); - $this->assertTrue($result[0] instanceof CmsUser); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $result[0]); $this->assertEquals('Guilherme', $result[0]->name); $this->assertEquals(1, $result[0]->getGroups()->count()); $groups = $result[0]->getGroups(); @@ -56,8 +56,8 @@ public function testBasicManyToManyJoin() $this->assertEquals(\Doctrine\ORM\UnitOfWork::STATE_MANAGED, $this->_em->getUnitOfWork()->getEntityState($result[0])); $this->assertEquals(\Doctrine\ORM\UnitOfWork::STATE_MANAGED, $this->_em->getUnitOfWork()->getEntityState($groups[0])); - $this->assertTrue($groups instanceof \Doctrine\ORM\PersistentCollection); - $this->assertTrue($groups[0]->getUsers() instanceof \Doctrine\ORM\PersistentCollection); + $this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $groups); + $this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $groups[0]->getUsers()); $groups[0]->getUsers()->clear(); $groups->clear(); diff --git a/tests/Doctrine/Tests/ORM/Functional/ManyToManyBidirectionalAssociationTest.php b/tests/Doctrine/Tests/ORM/Functional/ManyToManyBidirectionalAssociationTest.php index 5a6a2dd50f7..f8228d7adce 100644 --- a/tests/Doctrine/Tests/ORM/Functional/ManyToManyBidirectionalAssociationTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/ManyToManyBidirectionalAssociationTest.php @@ -117,8 +117,8 @@ protected function _findCategories() //$query->setHint(Query::HINT_FORCE_PARTIAL_LOAD, true); $result = $query->getResult(); $this->assertEquals(2, count($result)); - $this->assertTrue($result[0] instanceof ECommerceCategory); - $this->assertTrue($result[1] instanceof ECommerceCategory); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCategory', $result[0]); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCategory', $result[1]); $prods1 = $result[0]->getProducts(); $prods2 = $result[1]->getProducts(); $this->assertTrue($prods1->isInitialized()); @@ -157,10 +157,10 @@ public function assertLazyLoadFromInverseSide($products) $this->assertEquals(2, count($secondCategoryProducts)); // lazy-load $this->assertTrue($secondCategoryProducts->isInitialized()); - $this->assertTrue($firstCategoryProducts[0] instanceof ECommerceProduct); - $this->assertTrue($firstCategoryProducts[1] instanceof ECommerceProduct); - $this->assertTrue($secondCategoryProducts[0] instanceof ECommerceProduct); - $this->assertTrue($secondCategoryProducts[1] instanceof ECommerceProduct); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $firstCategoryProducts[0]); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $firstCategoryProducts[1]); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $secondCategoryProducts[0]); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $secondCategoryProducts[1]); $this->assertCollectionEquals($firstCategoryProducts, $secondCategoryProducts); } @@ -192,10 +192,10 @@ public function assertLazyLoadFromOwningSide($categories) $this->assertEquals(2, count($secondProductCategories)); // lazy-load $this->assertTrue($secondProductCategories->isInitialized()); - $this->assertTrue($firstProductCategories[0] instanceof ECommerceCategory); - $this->assertTrue($firstProductCategories[1] instanceof ECommerceCategory); - $this->assertTrue($secondProductCategories[0] instanceof ECommerceCategory); - $this->assertTrue($secondProductCategories[1] instanceof ECommerceCategory); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCategory', $firstProductCategories[0]); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCategory', $firstProductCategories[1]); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCategory', $secondProductCategories[0]); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCategory', $secondProductCategories[1]); $this->assertCollectionEquals($firstProductCategories, $secondProductCategories); } diff --git a/tests/Doctrine/Tests/ORM/Functional/ManyToManySelfReferentialAssociationTest.php b/tests/Doctrine/Tests/ORM/Functional/ManyToManySelfReferentialAssociationTest.php index 020e77aecc8..2993825fa21 100644 --- a/tests/Doctrine/Tests/ORM/Functional/ManyToManySelfReferentialAssociationTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/ManyToManySelfReferentialAssociationTest.php @@ -95,10 +95,10 @@ public function assertLoadingOfOwningSide($products) $this->assertEquals(2, count($firstRelatedBy)); $this->assertEquals(2, count($secondRelatedBy)); - $this->assertTrue($firstRelatedBy[0] instanceof ECommerceProduct); - $this->assertTrue($firstRelatedBy[1] instanceof ECommerceProduct); - $this->assertTrue($secondRelatedBy[0] instanceof ECommerceProduct); - $this->assertTrue($secondRelatedBy[1] instanceof ECommerceProduct); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $firstRelatedBy[0]); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $firstRelatedBy[1]); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $secondRelatedBy[0]); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $secondRelatedBy[1]); $this->assertCollectionEquals($firstRelatedBy, $secondRelatedBy); } diff --git a/tests/Doctrine/Tests/ORM/Functional/ManyToManyUnidirectionalAssociationTest.php b/tests/Doctrine/Tests/ORM/Functional/ManyToManyUnidirectionalAssociationTest.php index d6c38fc54cc..7de55e4f0f1 100644 --- a/tests/Doctrine/Tests/ORM/Functional/ManyToManyUnidirectionalAssociationTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/ManyToManyUnidirectionalAssociationTest.php @@ -69,8 +69,8 @@ public function testEagerLoad() $products = $firstCart->getProducts(); $secondCart = $result[1]; - $this->assertTrue($products[0] instanceof ECommerceProduct); - $this->assertTrue($products[1] instanceof ECommerceProduct); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $products[0]); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $products[1]); $this->assertCollectionEquals($products, $secondCart->getProducts()); //$this->assertEquals("Doctrine 1.x Manual", $products[0]->getName()); //$this->assertEquals("Doctrine 2.x Manual", $products[1]->getName()); @@ -88,8 +88,8 @@ public function testLazyLoadsCollection() $products = $firstCart->getProducts(); $secondCart = $result[1]; - $this->assertTrue($products[0] instanceof ECommerceProduct); - $this->assertTrue($products[1] instanceof ECommerceProduct); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $products[0]); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $products[1]); $this->assertCollectionEquals($products, $secondCart->getProducts()); } diff --git a/tests/Doctrine/Tests/ORM/Functional/NativeQueryTest.php b/tests/Doctrine/Tests/ORM/Functional/NativeQueryTest.php index f997c6c014f..d9bda728cfc 100644 --- a/tests/Doctrine/Tests/ORM/Functional/NativeQueryTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/NativeQueryTest.php @@ -49,7 +49,7 @@ public function testBasicNativeQuery() $users = $query->getResult(); $this->assertEquals(1, count($users)); - $this->assertTrue($users[0] instanceof CmsUser); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $users[0]); $this->assertEquals('Roman', $users[0]->name); } @@ -83,9 +83,9 @@ public function testJoinedOneToManyNativeQuery() $users = $query->getResult(); $this->assertEquals(1, count($users)); - $this->assertTrue($users[0] instanceof CmsUser); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $users[0]); $this->assertEquals('Roman', $users[0]->name); - $this->assertTrue($users[0]->getPhonenumbers() instanceof \Doctrine\ORM\PersistentCollection); + $this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $users[0]->getPhonenumbers()); $this->assertTrue($users[0]->getPhonenumbers()->isInitialized()); $this->assertEquals(1, count($users[0]->getPhonenumbers())); $phones = $users[0]->getPhonenumbers(); @@ -132,11 +132,11 @@ public function testJoinedOneToOneNativeQuery() $users = $query->getResult(); $this->assertEquals(1, count($users)); - $this->assertTrue($users[0] instanceof CmsUser); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $users[0]); $this->assertEquals('Roman', $users[0]->name); - $this->assertTrue($users[0]->getPhonenumbers() instanceof \Doctrine\ORM\PersistentCollection); + $this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $users[0]->getPhonenumbers()); $this->assertFalse($users[0]->getPhonenumbers()->isInitialized()); - $this->assertTrue($users[0]->getAddress() instanceof CmsAddress); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddress', $users[0]->getAddress()); $this->assertTrue($users[0]->getAddress()->getUser() == $users[0]); $this->assertEquals('germany', $users[0]->getAddress()->getCountry()); $this->assertEquals(10827, $users[0]->getAddress()->getZipCode()); @@ -185,9 +185,9 @@ public function testJoinedOneToManyNativeQueryWithRSMBuilder() $users = $query->getResult(); $this->assertEquals(1, count($users)); - $this->assertTrue($users[0] instanceof CmsUser); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $users[0]); $this->assertEquals('Roman', $users[0]->name); - $this->assertTrue($users[0]->getPhonenumbers() instanceof \Doctrine\ORM\PersistentCollection); + $this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $users[0]->getPhonenumbers()); $this->assertTrue($users[0]->getPhonenumbers()->isInitialized()); $this->assertEquals(1, count($users[0]->getPhonenumbers())); $phones = $users[0]->getPhonenumbers(); @@ -226,11 +226,11 @@ public function testJoinedOneToOneNativeQueryWithRSMBuilder() $users = $query->getResult(); $this->assertEquals(1, count($users)); - $this->assertTrue($users[0] instanceof CmsUser); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $users[0]); $this->assertEquals('Roman', $users[0]->name); - $this->assertTrue($users[0]->getPhonenumbers() instanceof \Doctrine\ORM\PersistentCollection); + $this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $users[0]->getPhonenumbers()); $this->assertFalse($users[0]->getPhonenumbers()->isInitialized()); - $this->assertTrue($users[0]->getAddress() instanceof CmsAddress); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddress', $users[0]->getAddress()); $this->assertTrue($users[0]->getAddress()->getUser() == $users[0]); $this->assertEquals('germany', $users[0]->getAddress()->getCountry()); $this->assertEquals(10827, $users[0]->getAddress()->getZipCode()); diff --git a/tests/Doctrine/Tests/ORM/Functional/OneToManyBidirectionalAssociationTest.php b/tests/Doctrine/Tests/ORM/Functional/OneToManyBidirectionalAssociationTest.php index 16a633dde89..e39e10b3e27 100644 --- a/tests/Doctrine/Tests/ORM/Functional/OneToManyBidirectionalAssociationTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/OneToManyBidirectionalAssociationTest.php @@ -77,13 +77,13 @@ public function testEagerLoadsOneToManyAssociation() $features = $product->getFeatures(); - $this->assertTrue($features[0] instanceof ECommerceFeature); - $this->assertFalse($features[0]->getProduct() instanceof \Doctrine\ORM\Proxy\Proxy); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceFeature', $features[0]); + $this->assertNotInstanceOf('Doctrine\ORM\Proxy\Proxy', $features[0]->getProduct()); $this->assertSame($product, $features[0]->getProduct()); $this->assertEquals('Model writing tutorial', $features[0]->getDescription()); - $this->assertTrue($features[1] instanceof ECommerceFeature); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceFeature', $features[1]); $this->assertSame($product, $features[1]->getProduct()); - $this->assertFalse($features[1]->getProduct() instanceof \Doctrine\ORM\Proxy\Proxy); + $this->assertNotInstanceOf('Doctrine\ORM\Proxy\Proxy', $features[1]->getProduct()); $this->assertEquals('Annotations examples', $features[1]->getDescription()); } @@ -97,11 +97,11 @@ public function testLazyLoadsObjectsOnTheOwningSide() $features = $product->getFeatures(); $this->assertFalse($features->isInitialized()); - $this->assertTrue($features[0] instanceof ECommerceFeature); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceFeature', $features[0]); $this->assertTrue($features->isInitialized()); $this->assertSame($product, $features[0]->getProduct()); $this->assertEquals('Model writing tutorial', $features[0]->getDescription()); - $this->assertTrue($features[1] instanceof ECommerceFeature); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceFeature', $features[1]); $this->assertSame($product, $features[1]->getProduct()); $this->assertEquals('Annotations examples', $features[1]->getDescription()); } @@ -114,8 +114,8 @@ public function testLazyLoadsObjectsOnTheInverseSide() $features = $query->getResult(); $product = $features[0]->getProduct(); - $this->assertTrue($product instanceof \Doctrine\ORM\Proxy\Proxy); - $this->assertTrue($product instanceof ECommerceProduct); + $this->assertInstanceOf('Doctrine\ORM\Proxy\Proxy', $product); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $product); $this->assertFalse($product->__isInitialized__); $this->assertSame('Doctrine Cookbook', $product->getName()); $this->assertTrue($product->__isInitialized__); @@ -130,8 +130,8 @@ public function testLazyLoadsObjectsOnTheInverseSide2() $features = $query->getResult(); $product = $features[0]->getProduct(); - $this->assertFalse($product instanceof \Doctrine\ORM\Proxy\Proxy); - $this->assertTrue($product instanceof ECommerceProduct); + $this->assertNotInstanceOf('Doctrine\ORM\Proxy\Proxy', $product); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $product); $this->assertSame('Doctrine Cookbook', $product->getName()); $this->assertFalse($product->getFeatures()->isInitialized()); diff --git a/tests/Doctrine/Tests/ORM/Functional/OneToManySelfReferentialAssociationTest.php b/tests/Doctrine/Tests/ORM/Functional/OneToManySelfReferentialAssociationTest.php index 5d6c182ab88..e3749765850 100644 --- a/tests/Doctrine/Tests/ORM/Functional/OneToManySelfReferentialAssociationTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/OneToManySelfReferentialAssociationTest.php @@ -79,10 +79,10 @@ public function testEagerLoadsOneToManyAssociation() $parent = $result[0]; $children = $parent->getChildren(); - $this->assertTrue($children[0] instanceof ECommerceCategory); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCategory', $children[0]); $this->assertSame($parent, $children[0]->getParent()); $this->assertEquals(' books', strstr($children[0]->getName(), ' books')); - $this->assertTrue($children[1] instanceof ECommerceCategory); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCategory', $children[1]); $this->assertSame($parent, $children[1]->getParent()); $this->assertEquals(' books', strstr($children[1]->getName(), ' books')); } @@ -98,10 +98,10 @@ public function testLazyLoadsOneToManyAssociation() $parent = $result[0]; $children = $parent->getChildren(); - $this->assertTrue($children[0] instanceof ECommerceCategory); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCategory', $children[0]); $this->assertSame($parent, $children[0]->getParent()); $this->assertEquals(' books', strstr($children[0]->getName(), ' books')); - $this->assertTrue($children[1] instanceof ECommerceCategory); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCategory', $children[1]); $this->assertSame($parent, $children[1]->getParent()); $this->assertEquals(' books', strstr($children[1]->getName(), ' books')); } diff --git a/tests/Doctrine/Tests/ORM/Functional/OneToOneBidirectionalAssociationTest.php b/tests/Doctrine/Tests/ORM/Functional/OneToOneBidirectionalAssociationTest.php index 93e30cbc0af..75be67e7765 100644 --- a/tests/Doctrine/Tests/ORM/Functional/OneToOneBidirectionalAssociationTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/OneToOneBidirectionalAssociationTest.php @@ -62,7 +62,7 @@ public function testEagerLoad() $result = $query->getResult(); $customer = $result[0]; - $this->assertTrue($customer->getCart() instanceof ECommerceCart); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCart', $customer->getCart()); $this->assertEquals('paypal', $customer->getCart()->getPayment()); } @@ -75,7 +75,7 @@ public function testLazyLoadsObjectsOnTheOwningSide() { $result = $query->getResult(); $cart = $result[0]; - $this->assertTrue($cart->getCustomer() instanceof ECommerceCustomer); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCustomer', $cart->getCustomer()); $this->assertEquals('Giorgio', $cart->getCustomer()->getName()); } @@ -90,8 +90,8 @@ public function testInverseSideIsNeverLazy() $customer = $result[0]; $this->assertNull($customer->getMentor()); - $this->assertTrue($customer->getCart() instanceof ECommerceCart); - $this->assertFalse($customer->getCart() instanceof \Doctrine\ORM\Proxy\Proxy); + $this->assertInstanceOF('Doctrine\Tests\Models\ECommerce\ECommerceCart', $customer->getCart()); + $this->assertNotInstanceOf('Doctrine\ORM\Proxy\Proxy', $customer->getCart()); $this->assertEquals('paypal', $customer->getCart()->getPayment()); } @@ -107,7 +107,7 @@ public function testUpdateWithProxyObject() $this->_em->flush(); $this->_em->clear(); - $this->assertTrue($cust->getCart() instanceof ECommerceCart); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCart', $cust->getCart()); $this->assertEquals('Roman', $cust->getName()); $this->assertSame($cust, $cart->getCustomer()); @@ -126,7 +126,7 @@ public function testUpdateWithProxyObject() $cart3 = $query2->getSingleResult(); - $this->assertTrue($cart3->getCustomer() instanceof ECommerceCustomer); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCustomer', $cart3->getCustomer()); $this->assertEquals('Roman', $cart3->getCustomer()->getName()); } diff --git a/tests/Doctrine/Tests/ORM/Functional/OneToOneSelfReferentialAssociationTest.php b/tests/Doctrine/Tests/ORM/Functional/OneToOneSelfReferentialAssociationTest.php index d7132ed60b4..bcd41dcaf34 100644 --- a/tests/Doctrine/Tests/ORM/Functional/OneToOneSelfReferentialAssociationTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/OneToOneSelfReferentialAssociationTest.php @@ -104,8 +104,8 @@ public function testMultiSelfReference() $entity2 = $this->_em->find(get_class($entity1), $entity1->getId()); - $this->assertTrue($entity2->getOther1() instanceof MultiSelfReference); - $this->assertTrue($entity2->getOther2() instanceof MultiSelfReference); + $this->assertInstanceOf('Doctrine\Tests\ORM\Functional\MultiSelfReference', $entity2->getOther1()); + $this->assertInstanceOf('Doctrine\Tests\ORM\Functional\MultiSelfReference', $entity2->getOther2()); $this->assertNull($entity2->getOther1()->getOther1()); $this->assertNull($entity2->getOther1()->getOther2()); $this->assertNull($entity2->getOther2()->getOther1()); @@ -114,7 +114,7 @@ public function testMultiSelfReference() public function assertLoadingOfAssociation($customer) { - $this->assertTrue($customer->getMentor() instanceof ECommerceCustomer); + $this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCustomer', $customer->getMentor()); $this->assertEquals('Obi-wan Kenobi', $customer->getMentor()->getName()); } diff --git a/tests/Doctrine/Tests/ORM/Functional/QueryTest.php b/tests/Doctrine/Tests/ORM/Functional/QueryTest.php index d8937289ad8..82180a4ed30 100644 --- a/tests/Doctrine/Tests/ORM/Functional/QueryTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/QueryTest.php @@ -38,7 +38,7 @@ public function testSimpleQueries() $result = $query->getResult(); $this->assertEquals(1, count($result)); - $this->assertTrue($result[0][0] instanceof CmsUser); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $result[0][0]); $this->assertEquals('Guilherme', $result[0][0]->name); $this->assertEquals('gblanco', $result[0][0]->username); $this->assertEquals('developer', $result[0][0]->status); @@ -90,7 +90,7 @@ public function testJoinQueries() $query = $this->_em->createQuery("select u, a from Doctrine\Tests\Models\CMS\CmsUser u join u.articles a"); $users = $query->getResult(); $this->assertEquals(1, count($users)); - $this->assertTrue($users[0] instanceof CmsUser); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $users[0]); $this->assertEquals(2, count($users[0]->articles)); $this->assertEquals('Doctrine 2', $users[0]->articles[0]->topic); $this->assertEquals('Symfony 2', $users[0]->articles[1]->topic); @@ -361,9 +361,9 @@ public function testEntityParameters() $result = $q->getResult(); $this->assertEquals(1, count($result)); - $this->assertTrue($result[0] instanceof CmsArticle); + $this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsArticle', $result[0]); $this->assertEquals("dr. dolittle", $result[0]->topic); - $this->assertTrue($result[0]->user instanceof \Doctrine\ORM\Proxy\Proxy); + $this->assertInstanceOf('Doctrine\ORM\Proxy\Proxy', $result[0]->user); $this->assertFalse($result[0]->user->__isInitialized__); } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC168Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC168Test.php index 41c41df4522..004acfa8c26 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC168Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC168Test.php @@ -58,7 +58,7 @@ public function testJoinedSubclassPersisterRequiresSpecificOrderOfMetadataReflFi $this->assertEquals("bar", $theEmployee->getDepartment()); $this->assertEquals("Foo", $theEmployee->getName()); $this->assertEquals(1000, $theEmployee->getSalary()); - $this->assertTrue($theEmployee instanceof CompanyEmployee); - $this->assertTrue($theEmployee->getSpouse() instanceof CompanyEmployee); + $this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyEmployee', $theEmployee); + $this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyEmployee', $theEmployee->getSpouse()); } } \ No newline at end of file diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC199Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC199Test.php index e912c389f21..8b5eddbf861 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC199Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC199Test.php @@ -40,11 +40,11 @@ public function testPolymorphicLoading() $result = $query->getResult(); $this->assertEquals(1, count($result)); - $this->assertTrue($result[0] instanceof DDC199ChildClass); + $this->assertInstanceOf('Doctrine\Tests\ORM\Functional\Ticket\DDC199ParentClass', $result[0]); $this->assertTrue($result[0]->relatedEntities->isInitialized()); $this->assertEquals(2, $result[0]->relatedEntities->count()); - $this->assertTrue($result[0]->relatedEntities[0] instanceof DDC199RelatedClass); - $this->assertTrue($result[0]->relatedEntities[1] instanceof DDC199RelatedClass); + $this->assertInstanceOf('Doctrine\Tests\ORM\Functional\Ticket\DDC199RelatedClass', $result[0]->relatedEntities[0]); + $this->assertInstanceOf('Doctrine\Tests\ORM\Functional\Ticket\DDC199RelatedClass', $result[0]->relatedEntities[1]); } } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC512Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC512Test.php index 72b11aaabf0..b9c74d399e4 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC512Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC512Test.php @@ -32,14 +32,14 @@ public function testIssue() $result = $q->getResult(); $this->assertEquals(2, count($result)); - $this->assertTrue($result[0] instanceof DDC512Customer); - $this->assertTrue($result[1] instanceof DDC512Customer); + $this->assertInstanceOf(__NAMESPACE__ . '\DDC512Customer', $result[0]); + $this->assertInstanceOf(__NAMESPACE__ . '\DDC512Customer', $result[1]); if ($result[0]->id == $customer1->id) { - $this->assertTrue($result[0]->item instanceof DDC512OfferItem); + $this->assertInstanceOf(__NAMESPACE__ . '\DDC512OfferItem', $result[0]->item); $this->assertEquals($item->id, $result[0]->item->id); $this->assertNull($result[1]->item); } else { - $this->assertTrue($result[1]->item instanceof DDC512OfferItem); + $this->assertInstanceOf(__NAMESPACE__ . '\DDC512OfferItem', $result[1]->item); $this->assertNull($result[0]->item); } } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC522Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC522Test.php index d0e8f4c7d9a..c517d461efc 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC522Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC522Test.php @@ -48,9 +48,9 @@ public function testJoinColumnWithSameNameAsAssociationField() $r = $this->_em->createQuery("select ca,c from ".get_class($cart)." ca join ca.customer c") ->getResult(); - $this->assertTrue($r[0] instanceof DDC522Cart); - $this->assertTrue($r[0]->customer instanceof DDC522Customer); - $this->assertFalse($r[0]->customer instanceof \Doctrine\ORM\Proxy\Proxy); + $this->assertInstanceOf(__NAMESPACE__ . '\DDC522Cart', $r[0]); + $this->assertInstanceOf(__NAMESPACE__ . '\DDC522Customer', $r[0]->customer); + $this->assertNotInstanceOf('Doctrine\ORM\Proxy\Proxy', $r[0]->customer); $this->assertEquals('name', $r[0]->customer->name); $fkt = new DDC522ForeignKeyTest(); @@ -62,7 +62,7 @@ public function testJoinColumnWithSameNameAsAssociationField() $fkt2 = $this->_em->find(get_class($fkt), $fkt->id); $this->assertEquals($fkt->cart->id, $fkt2->cartId); - $this->assertTrue($fkt2->cart instanceof \Doctrine\ORM\Proxy\Proxy); + $this->assertInstanceOf('Doctrine\ORM\Proxy\Proxy', $fkt2->cart); $this->assertFalse($fkt2->cart->__isInitialized__); } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC531Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC531Test.php index 0ac3b9b8ddd..7ce19cfab62 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC531Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC531Test.php @@ -29,8 +29,8 @@ public function testIssue() $item3 = $this->_em->find(__NAMESPACE__ . '\DDC531Item', $item2->id); // Load child item first (id 2) // parent will already be loaded, cannot be lazy because it has mapped subclasses and we would not // know which proxy type to put in. - $this->assertTrue($item3->parent instanceof DDC531Item); - $this->assertFalse($item3->parent instanceof \Doctrine\ORM\Proxy\Proxy); + $this->assertInstanceOf(__NAMESPACE__ . '\DDC531Item', $item3->parent); + $this->assertNotInstanceOf('Doctrine\ORM\Proxy\Proxy', $item3->parent); $item4 = $this->_em->find(__NAMESPACE__ . '\DDC531Item', $item1->id); // Load parent item (id 1) $this->assertNull($item4->parent); $this->assertNotNull($item4->getChildren()); diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/Ticket69.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/Ticket69.php index f6ef6c3bfbc..759a593fd58 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/Ticket69.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/Ticket69.php @@ -85,11 +85,11 @@ public function testIssue() $lemma = $res[0]; $this->assertEquals('foo', $lemma->getLemma()); - $this->assertTrue($lemma instanceof Lemma); + $this->assertInstanceOf('Doctrine\Tests\ORM\Functional\Ticket\Lemma', $lemma); $relations = $lemma->getRelations(); foreach($relations as $relation) { - $this->assertTrue($relation instanceof Relation); + $this->assertInstanceOf('Doctrine\Tests\ORM\Functional\Ticket\Relation', $relation); $this->assertTrue($relation->getType()->getType() != ''); } diff --git a/tests/Doctrine/Tests/ORM/Hydration/CustomHydratorTest.php b/tests/Doctrine/Tests/ORM/Hydration/CustomHydratorTest.php index 6b5e4514912..8daf961b5a0 100644 --- a/tests/Doctrine/Tests/ORM/Hydration/CustomHydratorTest.php +++ b/tests/Doctrine/Tests/ORM/Hydration/CustomHydratorTest.php @@ -15,7 +15,7 @@ public function testCustomHydrator() $config->addCustomHydrationMode('CustomHydrator', 'Doctrine\Tests\ORM\Hydration\CustomHydrator'); $hydrator = $em->newHydrator('CustomHydrator'); - $this->assertTrue($hydrator instanceof \Doctrine\Tests\ORM\Hydration\CustomHydrator); + $this->assertInstanceOf('Doctrine\Tests\ORM\Hydration\CustomHydrator', $hydrator); $this->assertNull($config->getCustomHydrationMode('does not exist')); } }