From 043ca69f0b7bba77f541617de9e47b1fdaa58251 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lu=C3=ADs=20Cobucci?= <lcobucci@gmail.com>
Date: Wed, 31 May 2017 07:59:04 +0200
Subject: [PATCH] Fix some code style issues in tests

---
 .../DbalTypes/NegativeToPositiveType.php      |  4 +-
 .../Tests/DbalTypes/UpperCaseStringType.php   |  4 +-
 .../ORM/Functional/BasicFunctionalTest.php    |  1 -
 .../ORM/Functional/CascadeRemoveOrderTest.php |  8 +-
 .../Functional/ClassTableInheritanceTest.php  | 73 ++++++++---------
 .../ORM/Functional/DetachedEntityTest.php     | 11 +--
 .../Tests/ORM/Functional/Locking/LockTest.php | 35 +++++---
 .../ORM/Functional/Locking/OptimisticTest.php | 10 +--
 .../Tests/ORM/Functional/NativeQueryTest.php  | 20 +++--
 .../ORM/Functional/PersistentObjectTest.php   |  5 +-
 .../Tests/ORM/Functional/QueryTest.php        | 66 +++++++++-------
 .../ORM/Functional/SequenceGeneratorTest.php  |  8 +-
 .../ORM/Functional/Ticket/DDC1113Test.php     | 11 ++-
 .../ORM/Functional/Ticket/DDC117Test.php      | 12 +--
 .../ORM/Functional/Ticket/DDC1181Test.php     |  6 +-
 .../ORM/Functional/Ticket/DDC1209Test.php     |  6 +-
 .../ORM/Functional/Ticket/DDC1306Test.php     |  4 +-
 .../ORM/Functional/Ticket/DDC1400Test.php     | 13 ++-
 .../ORM/Functional/Ticket/DDC144Test.php      | 24 +++---
 .../ORM/Functional/Ticket/DDC1454Test.php     | 12 +--
 .../ORM/Functional/Ticket/DDC1925Test.php     | 20 ++---
 .../ORM/Functional/Ticket/DDC192Test.php      | 35 +++++---
 .../ORM/Functional/Ticket/DDC2106Test.php     |  3 +-
 .../ORM/Functional/Ticket/DDC2256Test.php     |  8 +-
 .../ORM/Functional/Ticket/DDC2775Test.php     | 11 ++-
 .../ORM/Functional/Ticket/DDC3170Test.php     |  3 +-
 .../ORM/Functional/Ticket/DDC3711Test.php     |  1 -
 .../ORM/Functional/Ticket/DDC3785Test.php     | 57 ++++++-------
 .../ORM/Functional/Ticket/DDC522Test.php      | 29 ++++---
 .../ORM/Functional/Ticket/DDC588Test.php      |  3 +-
 .../ORM/Functional/Ticket/DDC742Test.php      | 15 ++--
 .../ORM/Functional/Ticket/DDC832Test.php      | 32 ++++----
 .../ORM/Functional/Ticket/DDC933Test.php      |  9 ++-
 .../Tests/ORM/Functional/TypeTest.php         | 25 +++---
 .../Tests/ORM/Functional/TypeValueSqlTest.php | 14 ++--
 .../ORM/Hydration/ScalarHydratorTest.php      |  7 +-
 .../Hydration/SingleScalarHydratorTest.php    | 79 ++++++++++---------
 .../ORM/Mapping/AbstractMappingDriverTest.php | 19 ++---
 .../Mapping/StaticPHPMappingDriverTest.php    |  1 -
 39 files changed, 373 insertions(+), 331 deletions(-)

diff --git a/tests/Doctrine/Tests/DbalTypes/NegativeToPositiveType.php b/tests/Doctrine/Tests/DbalTypes/NegativeToPositiveType.php
index 8395b6acd..f5e50fa07 100644
--- a/tests/Doctrine/Tests/DbalTypes/NegativeToPositiveType.php
+++ b/tests/Doctrine/Tests/DbalTypes/NegativeToPositiveType.php
@@ -7,12 +7,14 @@ use Doctrine\DBAL\Platforms\AbstractPlatform;
 
 class NegativeToPositiveType extends Type
 {
+    const NAME = 'negative_to_positive';
+
     /**
      * {@inheritdoc}
      */
     public function getName()
     {
-        return 'negative_to_positive';
+        return self::NAME;
     }
 
     /**
diff --git a/tests/Doctrine/Tests/DbalTypes/UpperCaseStringType.php b/tests/Doctrine/Tests/DbalTypes/UpperCaseStringType.php
index 3811aa00d..866a62475 100644
--- a/tests/Doctrine/Tests/DbalTypes/UpperCaseStringType.php
+++ b/tests/Doctrine/Tests/DbalTypes/UpperCaseStringType.php
@@ -7,12 +7,14 @@ use Doctrine\DBAL\Platforms\AbstractPlatform;
 
 class UpperCaseStringType extends StringType
 {
+    const NAME = 'upper_case_string';
+
     /**
      * {@inheritdoc}
      */
     public function getName()
     {
-        return 'upper_case_string';
+        return self::NAME;
     }
 
     /**
diff --git a/tests/Doctrine/Tests/ORM/Functional/BasicFunctionalTest.php b/tests/Doctrine/Tests/ORM/Functional/BasicFunctionalTest.php
index eec4844d1..016a7949f 100644
--- a/tests/Doctrine/Tests/ORM/Functional/BasicFunctionalTest.php
+++ b/tests/Doctrine/Tests/ORM/Functional/BasicFunctionalTest.php
@@ -727,7 +727,6 @@ class BasicFunctionalTest extends OrmFunctionalTestCase
      */
     public function testNewAssociatedEntityDuringFlushThrowsException()
     {
-        //$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
         $user = new CmsUser();
         $user->username = "beberlei";
         $user->name = "Benjamin E.";
diff --git a/tests/Doctrine/Tests/ORM/Functional/CascadeRemoveOrderTest.php b/tests/Doctrine/Tests/ORM/Functional/CascadeRemoveOrderTest.php
index cb19c2bcf..a6de137d1 100644
--- a/tests/Doctrine/Tests/ORM/Functional/CascadeRemoveOrderTest.php
+++ b/tests/Doctrine/Tests/ORM/Functional/CascadeRemoveOrderTest.php
@@ -16,8 +16,8 @@ class CascadeRemoveOrderTest extends OrmFunctionalTestCase
 
         $this->_schemaTool->createSchema(
             [
-            $this->_em->getClassMetadata(CascadeRemoveOrderEntityO::class),
-            $this->_em->getClassMetadata(CascadeRemoveOrderEntityG::class),
+                $this->_em->getClassMetadata(CascadeRemoveOrderEntityO::class),
+                $this->_em->getClassMetadata(CascadeRemoveOrderEntityG::class),
             ]
         );
     }
@@ -28,8 +28,8 @@ class CascadeRemoveOrderTest extends OrmFunctionalTestCase
 
         $this->_schemaTool->dropSchema(
             [
-            $this->_em->getClassMetadata(CascadeRemoveOrderEntityO::class),
-            $this->_em->getClassMetadata(CascadeRemoveOrderEntityG::class),
+                $this->_em->getClassMetadata(CascadeRemoveOrderEntityO::class),
+                $this->_em->getClassMetadata(CascadeRemoveOrderEntityG::class),
             ]
         );
     }
diff --git a/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest.php b/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest.php
index 2698c3252..02ed0a356 100644
--- a/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest.php
+++ b/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest.php
@@ -2,16 +2,16 @@
 
 namespace Doctrine\Tests\ORM\Functional;
 
+use Doctrine\Common\Collections\Criteria;
 use Doctrine\ORM\PersistentCollection;
 use Doctrine\ORM\Proxy\Proxy;
-use Doctrine\Tests\Models\Company\CompanyPerson,
-    Doctrine\Tests\Models\Company\CompanyEmployee,
-    Doctrine\Tests\Models\Company\CompanyManager,
-    Doctrine\Tests\Models\Company\CompanyOrganization,
-    Doctrine\Tests\Models\Company\CompanyAuction,
-    Doctrine\Tests\Models\Company\CompanyRaffle;
-
-use Doctrine\Common\Collections\Criteria;
+use Doctrine\Tests\Models\Company\CompanyAuction;
+use Doctrine\Tests\Models\Company\CompanyEmployee;
+use Doctrine\Tests\Models\Company\CompanyEvent;
+use Doctrine\Tests\Models\Company\CompanyManager;
+use Doctrine\Tests\Models\Company\CompanyOrganization;
+use Doctrine\Tests\Models\Company\CompanyPerson;
+use Doctrine\Tests\Models\Company\CompanyRaffle;
 use Doctrine\Tests\OrmFunctionalTestCase;
 
 /**
@@ -24,8 +24,8 @@ class ClassTableInheritanceTest extends OrmFunctionalTestCase
     protected function setUp()
     {
         $this->useModelSet('company');
+
         parent::setUp();
-        //$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
     }
 
     public function testCRUD()
@@ -47,7 +47,7 @@ class ClassTableInheritanceTest extends OrmFunctionalTestCase
 
         $this->_em->clear();
 
-        $query = $this->_em->createQuery("select p from Doctrine\Tests\Models\Company\CompanyPerson p order by p.name desc");
+        $query = $this->_em->createQuery('select p from ' . CompanyPerson::class . ' p order by p.name desc');
 
         $entities = $query->getResult();
 
@@ -62,7 +62,7 @@ class ClassTableInheritanceTest extends OrmFunctionalTestCase
 
         $this->_em->clear();
 
-        $query = $this->_em->createQuery("select p from Doctrine\Tests\Models\Company\CompanyEmployee p");
+        $query = $this->_em->createQuery('select p from ' . CompanyEmployee::class . ' p');
 
         $entities = $query->getResult();
 
@@ -80,7 +80,7 @@ class ClassTableInheritanceTest extends OrmFunctionalTestCase
 
         $this->_em->clear();
 
-        $query = $this->_em->createQuery("update Doctrine\Tests\Models\Company\CompanyEmployee p set p.name = ?1, p.department = ?2 where p.name='Guilherme Blanco' and p.salary = ?3");
+        $query = $this->_em->createQuery("update " . CompanyEmployee::class . " p set p.name = ?1, p.department = ?2 where p.name='Guilherme Blanco' and p.salary = ?3");
         $query->setParameter(1, 'NewName', 'string');
         $query->setParameter(2, 'NewDepartment');
         $query->setParameter(3, 100000);
@@ -88,12 +88,13 @@ class ClassTableInheritanceTest extends OrmFunctionalTestCase
         $numUpdated = $query->execute();
         $this->assertEquals(1, $numUpdated);
 
-        $query = $this->_em->createQuery("delete from Doctrine\Tests\Models\Company\CompanyPerson p");
+        $query = $this->_em->createQuery('delete from ' . CompanyPerson::class . ' p');
         $numDeleted = $query->execute();
         $this->assertEquals(2, $numDeleted);
     }
 
-    public function testMultiLevelUpdateAndFind() {
+    public function testMultiLevelUpdateAndFind()
+    {
     	$manager = new CompanyManager;
         $manager->setName('Roman S. Borschel');
         $manager->setSalary(100000);
@@ -119,7 +120,8 @@ class ClassTableInheritanceTest extends OrmFunctionalTestCase
         $this->assertTrue(is_numeric($manager->getId()));
     }
 
-    public function testFindOnBaseClass() {
+    public function testFindOnBaseClass()
+    {
         $manager = new CompanyManager;
         $manager->setName('Roman S. Borschel');
         $manager->setSalary(100000);
@@ -139,7 +141,8 @@ class ClassTableInheritanceTest extends OrmFunctionalTestCase
         $this->assertTrue(is_numeric($person->getId()));
     }
 
-    public function testSelfReferencingOneToOne() {
+    public function testSelfReferencingOneToOne()
+    {
     	$manager = new CompanyManager;
         $manager->setName('John Smith');
         $manager->setSalary(100000);
@@ -155,16 +158,10 @@ class ClassTableInheritanceTest extends OrmFunctionalTestCase
 
         $this->_em->persist($manager);
         $this->_em->persist($wife);
-
         $this->_em->flush();
-
-        //var_dump($this->_em->getConnection()->fetchAll('select * from company_persons'));
-        //var_dump($this->_em->getConnection()->fetchAll('select * from company_employees'));
-        //var_dump($this->_em->getConnection()->fetchAll('select * from company_managers'));
-
         $this->_em->clear();
 
-        $query = $this->_em->createQuery('select p, s from Doctrine\Tests\Models\Company\CompanyPerson p join p.spouse s where p.name=\'Mary Smith\'');
+        $query = $this->_em->createQuery('select p, s from ' . CompanyPerson::class . ' p join p.spouse s where p.name=\'Mary Smith\'');
 
         $result = $query->getResult();
         $this->assertEquals(1, count($result));
@@ -196,7 +193,7 @@ class ClassTableInheritanceTest extends OrmFunctionalTestCase
 
         $this->_em->clear();
 
-        $query = $this->_em->createQuery('select p, f from Doctrine\Tests\Models\Company\CompanyPerson p join p.friends f where p.name=?1');
+        $query = $this->_em->createQuery('select p, f from ' . CompanyPerson::class . ' p join p.friends f where p.name=?1');
         $query->setParameter(1, 'Roman');
 
         $result = $query->getResult();
@@ -247,7 +244,6 @@ class ClassTableInheritanceTest extends OrmFunctionalTestCase
         }
     }
 
-
     public function testLazyLoading2()
     {
         $org = new CompanyOrganization;
@@ -259,16 +255,16 @@ class ClassTableInheritanceTest extends OrmFunctionalTestCase
         $this->_em->flush();
         $this->_em->clear();
 
-        $q = $this->_em->createQuery('select a from Doctrine\Tests\Models\Company\CompanyEvent a where a.id = ?1');
+        $q = $this->_em->createQuery('select a from ' . CompanyEvent::class . ' a where a.id = ?1');
         $q->setParameter(1, $event1->getId());
 
         $result = $q->getResult();
         $this->assertEquals(1, count($result));
-        $this->assertInstanceOf(CompanyAuction::class, $result[0], sprintf("Is of class %s",get_class($result[0])));
+        $this->assertInstanceOf(CompanyAuction::class, $result[0], sprintf("Is of class %s", get_class($result[0])));
 
         $this->_em->clear();
 
-        $q = $this->_em->createQuery('select a from Doctrine\Tests\Models\Company\CompanyOrganization a where a.id = ?1');
+        $q = $this->_em->createQuery('select a from ' . CompanyOrganization::class . ' a where a.id = ?1');
         $q->setParameter(1, $org->getId());
 
         $result = $q->getResult();
@@ -287,8 +283,8 @@ class ClassTableInheritanceTest extends OrmFunctionalTestCase
      */
     public function testBulkUpdateIssueDDC368()
     {
-        $dql = 'UPDATE Doctrine\Tests\Models\Company\CompanyEmployee AS p SET p.salary = 1';
-        $this->_em->createQuery($dql)->execute();
+        $this->_em->createQuery('UPDATE ' . CompanyEmployee::class . ' AS p SET p.salary = 1')
+                  ->execute();
 
         $this->assertTrue(count($this->_em->createQuery(
             'SELECT count(p.id) FROM Doctrine\Tests\Models\Company\CompanyEmployee p WHERE p.salary = 1')
@@ -300,12 +296,10 @@ class ClassTableInheritanceTest extends OrmFunctionalTestCase
      */
     public function testBulkUpdateNonScalarParameterDDC1341()
     {
-        $dql   = 'UPDATE Doctrine\Tests\Models\Company\CompanyEmployee AS p SET p.startDate = ?0 WHERE p.department = ?1';
-        $query = $this->_em->createQuery($dql)
-            ->setParameter(0, new \DateTime())
-            ->setParameter(1, 'IT');
-
-        $result = $query->execute();
+        $this->_em->createQuery('UPDATE ' . CompanyEmployee::class . ' AS p SET p.startDate = ?0 WHERE p.department = ?1')
+                  ->setParameter(0, new \DateTime())
+                  ->setParameter(1, 'IT')
+                  ->execute();
 
     }
 
@@ -314,8 +308,6 @@ class ClassTableInheritanceTest extends OrmFunctionalTestCase
      */
     public function testDeleteJoinTableRecords()
     {
-        #$this->markTestSkipped('Nightmare! friends adds both ID 6-7 and 7-6 into two rows of the join table. How to detect this?');
-
         $employee1 = new CompanyEmployee();
         $employee1->setName('gblanco');
         $employee1->setSalary(0);
@@ -361,8 +353,9 @@ class ClassTableInheritanceTest extends OrmFunctionalTestCase
         $this->_em->flush();
         $this->_em->clear();
 
-        $dql = "SELECT m FROM Doctrine\Tests\Models\Company\CompanyManager m WHERE m.spouse = ?1";
-        $dqlManager = $this->_em->createQuery($dql)->setParameter(1, $person->getId())->getSingleResult();
+        $dqlManager = $this->_em->createQuery('SELECT m FROM ' . CompanyManager::class . ' m WHERE m.spouse = ?1')
+                                ->setParameter(1, $person->getId())
+                                ->getSingleResult();
 
         $this->assertEquals($manager->getId(), $dqlManager->getId());
         $this->assertEquals($person->getId(), $dqlManager->getSpouse()->getId());
diff --git a/tests/Doctrine/Tests/ORM/Functional/DetachedEntityTest.php b/tests/Doctrine/Tests/ORM/Functional/DetachedEntityTest.php
index b0326e542..5060f07a1 100644
--- a/tests/Doctrine/Tests/ORM/Functional/DetachedEntityTest.php
+++ b/tests/Doctrine/Tests/ORM/Functional/DetachedEntityTest.php
@@ -23,7 +23,8 @@ class DetachedEntityTest extends OrmFunctionalTestCase
         parent::setUp();
     }
 
-    public function testSimpleDetachMerge() {
+    public function testSimpleDetachMerge()
+    {
         $user = new CmsUser;
         $user->name = 'Roman';
         $user->username = 'romanb';
@@ -33,13 +34,10 @@ class DetachedEntityTest extends OrmFunctionalTestCase
         $this->_em->clear();
 
         // $user is now detached
-
         $this->assertFalse($this->_em->contains($user));
 
         $user->name = 'Roman B.';
 
-        //$this->assertEquals(UnitOfWork::STATE_DETACHED, $this->_em->getUnitOfWork()->getEntityState($user));
-
         $user2 = $this->_em->merge($user);
 
         $this->assertFalse($user === $user2);
@@ -49,7 +47,6 @@ class DetachedEntityTest extends OrmFunctionalTestCase
 
     public function testSerializeUnserializeModifyMerge()
     {
-        //$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
         $user = new CmsUser;
         $user->name = 'Guilherme';
         $user->username = 'gblanco';
@@ -173,7 +170,7 @@ class DetachedEntityTest extends OrmFunctionalTestCase
         $this->_em->flush();
         $this->_em->detach($user);
 
-        $dql = "SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id = ?1";
+        $dql = 'SELECT u FROM ' . CmsUser::class . ' u WHERE u.id = ?1';
         $query = $this->_em->createQuery($dql);
         $query->setParameter(1, $user);
 
@@ -216,7 +213,7 @@ class DetachedEntityTest extends OrmFunctionalTestCase
 
         $this->_em->detach($article);
 
-        $sql = "UPDATE cms_articles SET version = version+1 WHERE id = " . $article->id;
+        $sql = 'UPDATE cms_articles SET version = version + 1 WHERE id = ' . $article->id;
         $this->_em->getConnection()->executeUpdate($sql);
 
         $this->expectException(OptimisticLockException::class);
diff --git a/tests/Doctrine/Tests/ORM/Functional/Locking/LockTest.php b/tests/Doctrine/Tests/ORM/Functional/Locking/LockTest.php
index e92b9476b..dc27d45be 100644
--- a/tests/Doctrine/Tests/ORM/Functional/Locking/LockTest.php
+++ b/tests/Doctrine/Tests/ORM/Functional/Locking/LockTest.php
@@ -19,6 +19,7 @@ class LockTest extends OrmFunctionalTestCase
     {
         $this->useModelSet('cms');
         parent::setUp();
+
         $this->handles = [];
     }
 
@@ -26,7 +27,8 @@ class LockTest extends OrmFunctionalTestCase
      * @group DDC-178
      * @group locking
      */
-    public function testLockVersionedEntity() {
+    public function testLockVersionedEntity()
+    {
         $article = new CmsArticle();
         $article->text = "my article";
         $article->topic = "Hello";
@@ -41,7 +43,8 @@ class LockTest extends OrmFunctionalTestCase
      * @group DDC-178
      * @group locking
      */
-    public function testLockVersionedEntity_MismatchThrowsException() {
+    public function testLockVersionedEntity_MismatchThrowsException()
+    {
         $article = new CmsArticle();
         $article->text = "my article";
         $article->topic = "Hello";
@@ -58,7 +61,8 @@ class LockTest extends OrmFunctionalTestCase
      * @group DDC-178
      * @group locking
      */
-    public function testLockUnversionedEntity_ThrowsException() {
+    public function testLockUnversionedEntity_ThrowsException()
+    {
         $user = new CmsUser();
         $user->name = "foo";
         $user->status = "active";
@@ -76,11 +80,12 @@ class LockTest extends OrmFunctionalTestCase
      * @group DDC-178
      * @group locking
      */
-    public function testLockUnmanagedEntity_ThrowsException() {
+    public function testLockUnmanagedEntity_ThrowsException()
+    {
         $article = new CmsArticle();
 
         $this->expectException(\InvalidArgumentException::class);
-        $this->expectExceptionMessage('Entity Doctrine\Tests\Models\CMS\CmsArticle');
+        $this->expectExceptionMessage('Entity ' . CmsArticle::class);
 
         $this->_em->lock($article, LockMode::OPTIMISTIC, $article->version + 1);
     }
@@ -89,7 +94,8 @@ class LockTest extends OrmFunctionalTestCase
      * @group DDC-178
      * @group locking
      */
-    public function testLockPessimisticRead_NoTransaction_ThrowsException() {
+    public function testLockPessimisticRead_NoTransaction_ThrowsException()
+    {
         $article = new CmsArticle();
         $article->text = "my article";
         $article->topic = "Hello";
@@ -106,7 +112,8 @@ class LockTest extends OrmFunctionalTestCase
      * @group DDC-178
      * @group locking
      */
-    public function testLockPessimisticWrite_NoTransaction_ThrowsException() {
+    public function testLockPessimisticWrite_NoTransaction_ThrowsException()
+    {
         $article = new CmsArticle();
         $article->text = "my article";
         $article->topic = "Hello";
@@ -171,6 +178,7 @@ class LockTest extends OrmFunctionalTestCase
         $this->_em->flush();
 
         $this->_em->beginTransaction();
+
         try {
             $this->_em->lock($article, LockMode::PESSIMISTIC_READ);
             $this->_em->commit();
@@ -179,8 +187,9 @@ class LockTest extends OrmFunctionalTestCase
             throw $e;
         }
 
-        $query = array_pop( $this->_sqlLoggerStack->queries );
-        $query = array_pop( $this->_sqlLoggerStack->queries );
+        array_pop($this->_sqlLoggerStack->queries);
+        $query = array_pop($this->_sqlLoggerStack->queries);
+
         $this->assertContains($readLockSql, $query['sql']);
     }
 
@@ -189,13 +198,13 @@ class LockTest extends OrmFunctionalTestCase
      */
     public function testLockOptimisticNonVersionedThrowsExceptionInDQL()
     {
-        $dql = "SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.username = 'gblanco'";
+        $dql = "SELECT u FROM " . CmsUser::class . " u WHERE u.username = 'gblanco'";
 
         $this->expectException(OptimisticLockException::class);
         $this->expectExceptionMessage('The optimistic lock on an entity failed.');
 
-        $sql = $this->_em->createQuery($dql)->setHint(
-            Query::HINT_LOCK_MODE, LockMode::OPTIMISTIC
-        )->getSQL();
+        $this->_em->createQuery($dql)
+                  ->setHint(Query::HINT_LOCK_MODE, LockMode::OPTIMISTIC)
+                  ->getSQL();
     }
 }
diff --git a/tests/Doctrine/Tests/ORM/Functional/Locking/OptimisticTest.php b/tests/Doctrine/Tests/ORM/Functional/Locking/OptimisticTest.php
index b5aa9c0ec..3681ed95e 100644
--- a/tests/Doctrine/Tests/ORM/Functional/Locking/OptimisticTest.php
+++ b/tests/Doctrine/Tests/ORM/Functional/Locking/OptimisticTest.php
@@ -16,15 +16,16 @@ class OptimisticTest extends OrmFunctionalTestCase
         try {
             $this->_schemaTool->createSchema(
                 [
-                $this->_em->getClassMetadata(OptimisticJoinedParent::class),
-                $this->_em->getClassMetadata(OptimisticJoinedChild::class),
-                $this->_em->getClassMetadata(OptimisticStandard::class),
-                $this->_em->getClassMetadata(OptimisticTimestamp::class)
+                    $this->_em->getClassMetadata(OptimisticJoinedParent::class),
+                    $this->_em->getClassMetadata(OptimisticJoinedChild::class),
+                    $this->_em->getClassMetadata(OptimisticStandard::class),
+                    $this->_em->getClassMetadata(OptimisticTimestamp::class)
                 ]
             );
         } catch (\Exception $e) {
             // Swallow all exceptions. We do not test the schema tool here.
         }
+
         $this->_conn = $this->_em->getConnection();
     }
 
@@ -168,7 +169,6 @@ class OptimisticTest extends OrmFunctionalTestCase
     public function testLockWorksWithProxy()
     {
         $test = new OptimisticStandard();
-
         $test->name = 'test';
 
         $this->_em->persist($test);
diff --git a/tests/Doctrine/Tests/ORM/Functional/NativeQueryTest.php b/tests/Doctrine/Tests/ORM/Functional/NativeQueryTest.php
index 93eab2667..4e8e6c96e 100644
--- a/tests/Doctrine/Tests/ORM/Functional/NativeQueryTest.php
+++ b/tests/Doctrine/Tests/ORM/Functional/NativeQueryTest.php
@@ -35,6 +35,7 @@ class NativeQueryTest extends OrmFunctionalTestCase
         $this->useModelSet('cms');
         $this->useModelSet('company');
         parent::setUp();
+
         $this->platform = $this->_em->getConnection()->getDatabasePlatform();
     }
 
@@ -426,9 +427,9 @@ class NativeQueryTest extends OrmFunctionalTestCase
 
         $repository = $this->_em->getRepository(CmsUser::class);
 
-
         $result = $repository->createNativeNamedQuery('fetchIdAndUsernameWithResultClass')
-                        ->setParameter(1, 'FabioBatSilva')->getResult();
+                            ->setParameter(1, 'FabioBatSilva')
+                            ->getResult();
 
         $this->assertEquals(1, count($result));
         $this->assertInstanceOf(CmsUser::class, $result[0]);
@@ -439,9 +440,9 @@ class NativeQueryTest extends OrmFunctionalTestCase
 
         $this->_em->clear();
 
-
         $result = $repository->createNativeNamedQuery('fetchAllColumns')
-                        ->setParameter(1, 'FabioBatSilva')->getResult();
+                            ->setParameter(1, 'FabioBatSilva')
+                            ->getResult();
 
         $this->assertEquals(1, count($result));
         $this->assertInstanceOf(CmsUser::class, $result[0]);
@@ -468,19 +469,16 @@ class NativeQueryTest extends OrmFunctionalTestCase
         $addr->zip      = 10827;
         $addr->city     = 'São Paulo';
 
-
         $user->setAddress($addr);
 
         $this->_em->persist($user);
         $this->_em->flush();
-
         $this->_em->clear();
 
-        $repository = $this->_em->getRepository(CmsUser::class);
-
-
-        $result = $repository->createNativeNamedQuery('fetchJoinedAddress')
-                        ->setParameter(1, 'FabioBatSilva')->getResult();
+        $result = $this->_em->getRepository(CmsUser::class)
+                            ->createNativeNamedQuery('fetchJoinedAddress')
+                            ->setParameter(1, 'FabioBatSilva')
+                            ->getResult();
 
         $this->assertEquals(1, count($result));
         $this->assertInstanceOf(CmsUser::class, $result[0]);
diff --git a/tests/Doctrine/Tests/ORM/Functional/PersistentObjectTest.php b/tests/Doctrine/Tests/ORM/Functional/PersistentObjectTest.php
index 9f73bf5e8..b611c7125 100644
--- a/tests/Doctrine/Tests/ORM/Functional/PersistentObjectTest.php
+++ b/tests/Doctrine/Tests/ORM/Functional/PersistentObjectTest.php
@@ -16,15 +16,16 @@ class PersistentObjectTest extends OrmFunctionalTestCase
     protected function setUp()
     {
         parent::setUp();
+
         try {
             $this->_schemaTool->createSchema(
                 [
-                $this->_em->getClassMetadata(PersistentEntity::class),
+                    $this->_em->getClassMetadata(PersistentEntity::class),
                 ]
             );
         } catch (\Exception $e) {
-
         }
+
         PersistentObject::setObjectManager($this->_em);
     }
 
diff --git a/tests/Doctrine/Tests/ORM/Functional/QueryTest.php b/tests/Doctrine/Tests/ORM/Functional/QueryTest.php
index 805478bdf..127f06d18 100644
--- a/tests/Doctrine/Tests/ORM/Functional/QueryTest.php
+++ b/tests/Doctrine/Tests/ORM/Functional/QueryTest.php
@@ -26,6 +26,7 @@ class QueryTest extends OrmFunctionalTestCase
     protected function setUp()
     {
         $this->useModelSet('cms');
+
         parent::setUp();
     }
 
@@ -93,7 +94,7 @@ class QueryTest extends OrmFunctionalTestCase
         $this->_em->flush();
         $this->_em->clear();
 
-        $query = $this->_em->createQuery("select u, a from Doctrine\Tests\Models\CMS\CmsUser u join u.articles a ORDER BY a.topic");
+        $query = $this->_em->createQuery('select u, a from ' . CmsUser::class . ' u join u.articles a ORDER BY a.topic');
         $users = $query->getResult();
         $this->assertEquals(1, count($users));
         $this->assertInstanceOf(CmsUser::class, $users[0]);
@@ -112,7 +113,7 @@ class QueryTest extends OrmFunctionalTestCase
         $this->_em->flush();
         $this->_em->clear();
 
-        $q = $this->_em->createQuery('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.username = ?0');
+        $q = $this->_em->createQuery('SELECT u FROM ' . CmsUser::class . ' u WHERE u.username = ?0');
         $q->setParameter(0, 'jwage');
         $user = $q->getSingleResult();
 
@@ -124,7 +125,7 @@ class QueryTest extends OrmFunctionalTestCase
         $this->expectException(QueryException::class);
         $this->expectExceptionMessage('Invalid parameter: token 2 is not defined in the query.');
 
-        $q = $this->_em->createQuery('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.name = ?1');
+        $q = $this->_em->createQuery('SELECT u FROM ' . CmsUser::class . ' u WHERE u.name = ?1');
         $q->setParameter(2, 'jwage');
         $user = $q->getSingleResult();
     }
@@ -134,7 +135,7 @@ class QueryTest extends OrmFunctionalTestCase
         $this->expectException(QueryException::class);
         $this->expectExceptionMessage('Too many parameters: the query defines 1 parameters and you bound 2');
 
-        $q = $this->_em->createQuery('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.name = ?1');
+        $q = $this->_em->createQuery('SELECT u FROM ' . CmsUser::class . ' u WHERE u.name = ?1');
         $q->setParameter(1, 'jwage');
         $q->setParameter(2, 'jwage');
 
@@ -146,38 +147,35 @@ class QueryTest extends OrmFunctionalTestCase
         $this->expectException(QueryException::class);
         $this->expectExceptionMessage('Too few parameters: the query defines 1 parameters but you only bound 0');
 
-        $q = $this->_em->createQuery('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.name = ?1');
-
-        $user = $q->getSingleResult();
+        $this->_em->createQuery('SELECT u FROM ' . CmsUser::class . ' u WHERE u.name = ?1')
+                  ->getSingleResult();
     }
 
     public function testInvalidInputParameterThrowsException()
     {
         $this->expectException(QueryException::class);
 
-        $q = $this->_em->createQuery('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.name = ?');
-        $q->setParameter(1, 'jwage');
-        $user = $q->getSingleResult();
+        $this->_em->createQuery('SELECT u FROM ' . CmsUser::class . ' u WHERE u.name = ?')
+                  ->setParameter(1, 'jwage')
+                  ->getSingleResult();
     }
 
     public function testSetParameters()
     {
-        $q = $this->_em->createQuery('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.name = ?1 AND u.status = ?2');
-
         $parameters = new ArrayCollection();
         $parameters->add(new Parameter(1, 'jwage'));
         $parameters->add(new Parameter(2, 'active'));
 
-        $q->setParameters($parameters);
-        $users = $q->getResult();
+        $this->_em->createQuery('SELECT u FROM ' . CmsUser::class . ' u WHERE u.name = ?1 AND u.status = ?2')
+                  ->setParameters($parameters)
+                  ->getResult();
     }
 
     public function testSetParametersBackwardsCompatible()
     {
-        $q = $this->_em->createQuery('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.name = ?1 AND u.status = ?2');
-        $q->setParameters([1 => 'jwage', 2 => 'active']);
-
-        $users = $q->getResult();
+        $this->_em->createQuery('SELECT u FROM ' . CmsUser::class . ' u WHERE u.name = ?1 AND u.status = ?2')
+                  ->setParameters([1 => 'jwage', 2 => 'active'])
+                  ->getResult();
     }
 
     /**
@@ -200,18 +198,29 @@ class QueryTest extends OrmFunctionalTestCase
         $this->_em->clear();
         $articleId = $article1->id;
 
-        $query = $this->_em->createQuery("select a from Doctrine\Tests\Models\CMS\CmsArticle a WHERE a.topic = ?1");
+        $query = $this->_em->createQuery('select a from ' . CmsArticle::class . ' a WHERE a.topic = ?1');
         $articles = $query->iterate(new ArrayCollection([new Parameter(1, 'Doctrine 2')]), Query::HYDRATE_ARRAY);
 
         $found = [];
+
         foreach ($articles AS $article) {
             $found[] = $article;
         }
+
         $this->assertEquals(1, count($found));
         $this->assertEquals(
             [
-            [['id' => $articleId, 'topic' => 'Doctrine 2', 'text' => 'This is an introduction to Doctrine 2.', 'version' => 1]]
-            ], $found);
+                [
+                    [
+                        'id'      => $articleId,
+                        'topic'   => 'Doctrine 2',
+                        'text'    => 'This is an introduction to Doctrine 2.',
+                        'version' => 1,
+                    ],
+                ],
+            ],
+            $found
+        );
     }
 
     public function testIterateResult_IterativelyBuildUpUnitOfWork()
@@ -230,11 +239,12 @@ class QueryTest extends OrmFunctionalTestCase
         $this->_em->flush();
         $this->_em->clear();
 
-        $query = $this->_em->createQuery("select a from Doctrine\Tests\Models\CMS\CmsArticle a");
+        $query = $this->_em->createQuery('select a from ' . CmsArticle::class . ' a');
         $articles = $query->iterate();
 
         $iteratedCount = 0;
         $topics = [];
+
         foreach($articles AS $row) {
             $article = $row[0];
             $topics[] = $article->topic;
@@ -294,7 +304,7 @@ class QueryTest extends OrmFunctionalTestCase
      */
     public function testIterateResult_FetchJoinedCollection_ThrowsException()
     {
-        $query = $this->_em->createQuery("SELECT u, a FROM Doctrine\Tests\Models\CMS\CmsUser u JOIN u.articles a");
+        $query = $this->_em->createQuery("SELECT u, a FROM ' . CmsUser::class . ' u JOIN u.articles a");
         $articles = $query->iterate();
     }
 
@@ -360,7 +370,7 @@ class QueryTest extends OrmFunctionalTestCase
         $this->_em->flush();
         $this->_em->clear();
 
-        $data = $this->_em->createQuery('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u')
+        $data = $this->_em->createQuery('SELECT u FROM ' . CmsUser::class . ' u')
                   ->setFirstResult(1)
                   ->setMaxResults(2)
                   ->getResult();
@@ -369,7 +379,7 @@ class QueryTest extends OrmFunctionalTestCase
         $this->assertEquals('gblanco1', $data[0]->username);
         $this->assertEquals('gblanco2', $data[1]->username);
 
-        $data = $this->_em->createQuery('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u')
+        $data = $this->_em->createQuery('SELECT u FROM ' . CmsUser::class . ' u')
                   ->setFirstResult(3)
                   ->setMaxResults(2)
                   ->getResult();
@@ -378,7 +388,7 @@ class QueryTest extends OrmFunctionalTestCase
         $this->assertEquals('gblanco3', $data[0]->username);
         $this->assertEquals('gblanco4', $data[1]->username);
 
-        $data = $this->_em->createQuery('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u')
+        $data = $this->_em->createQuery('SELECT u FROM ' . CmsUser::class . ' u')
                   ->setFirstResult(3)
                   ->setMaxResults(2)
                   ->getScalarResult();
@@ -472,13 +482,13 @@ class QueryTest extends OrmFunctionalTestCase
         $this->_em->flush();
         $this->_em->clear();
 
-        $query = $this->_em->createQuery("select u from Doctrine\Tests\Models\CMS\CmsUser u where u.username = 'gblanco'");
+        $query = $this->_em->createQuery("select u from " . CmsUser::class . " u where u.username = 'gblanco'");
 
         $fetchedUser = $query->getOneOrNullResult();
         $this->assertInstanceOf(CmsUser::class, $fetchedUser);
         $this->assertEquals('gblanco', $fetchedUser->username);
 
-        $query = $this->_em->createQuery("select u.username from Doctrine\Tests\Models\CMS\CmsUser u where u.username = 'gblanco'");
+        $query = $this->_em->createQuery("select u.username from " . CmsUser::class . " u where u.username = 'gblanco'");
         $fetchedUsername = $query->getOneOrNullResult(Query::HYDRATE_SINGLE_SCALAR);
         $this->assertEquals('gblanco', $fetchedUsername);
     }
diff --git a/tests/Doctrine/Tests/ORM/Functional/SequenceGeneratorTest.php b/tests/Doctrine/Tests/ORM/Functional/SequenceGeneratorTest.php
index 13091c5e5..c00f8bc9f 100644
--- a/tests/Doctrine/Tests/ORM/Functional/SequenceGeneratorTest.php
+++ b/tests/Doctrine/Tests/ORM/Functional/SequenceGeneratorTest.php
@@ -14,18 +14,17 @@ class SequenceGeneratorTest extends OrmFunctionalTestCase
     {
         parent::setUp();
 
-        if (!$this->_em->getConnection()->getDatabasePlatform()->supportsSequences()) {
+        if ( ! $this->_em->getConnection()->getDatabasePlatform()->supportsSequences()) {
             $this->markTestSkipped('Only working for Databases that support sequences.');
         }
 
         try {
             $this->_schemaTool->createSchema(
                 [
-                $this->_em->getClassMetadata(SequenceEntity::class),
+                    $this->_em->getClassMetadata(SequenceEntity::class),
                 ]
             );
         } catch(\Exception $e) {
-
         }
     }
 
@@ -35,6 +34,7 @@ class SequenceGeneratorTest extends OrmFunctionalTestCase
             $e = new SequenceEntity();
             $this->_em->persist($e);
         }
+
         $this->_em->flush();
     }
 }
@@ -48,7 +48,7 @@ class SequenceEntity
      * @Id
      * @column(type="integer")
      * @GeneratedValue(strategy="SEQUENCE")
-     * @SequenceGenerator(allocationSize=5,sequenceName="person_id_seq")
+     * @SequenceGenerator(allocationSize=5, sequenceName="person_id_seq")
      */
     public $id;
 }
diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1113Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1113Test.php
index f3b399f98..7402972b0 100644
--- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1113Test.php
+++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1113Test.php
@@ -8,21 +8,20 @@ namespace Doctrine\Tests\ORM\Functional\Ticket;
  */
 class DDC1113Test extends \Doctrine\Tests\OrmFunctionalTestCase
 {
-
     public function setUp()
     {
         parent::setUp();
+
         try {
             $this->_schemaTool->createSchema(
                 [
-                $this->_em->getClassMetadata(DDC1113Engine::class),
-                $this->_em->getClassMetadata(DDC1113Vehicle::class),
-                $this->_em->getClassMetadata(DDC1113Car::class),
-                $this->_em->getClassMetadata(DDC1113Bus::class),
+                    $this->_em->getClassMetadata(DDC1113Engine::class),
+                    $this->_em->getClassMetadata(DDC1113Vehicle::class),
+                    $this->_em->getClassMetadata(DDC1113Car::class),
+                    $this->_em->getClassMetadata(DDC1113Bus::class),
                 ]
             );
         } catch (\Exception $e) {
-
         }
     }
 
diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC117Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC117Test.php
index 9c6740c33..c6d215cf8 100644
--- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC117Test.php
+++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC117Test.php
@@ -21,7 +21,8 @@ class DDC117Test extends \Doctrine\Tests\OrmFunctionalTestCase
     private $translation;
     private $articleDetails;
 
-    protected function setUp() {
+    protected function setUp()
+    {
         $this->useModelSet('ddc117');
         parent::setUp();
 
@@ -63,7 +64,7 @@ class DDC117Test extends \Doctrine\Tests\OrmFunctionalTestCase
 
         $this->_em->clear();
 
-        $dql = "SELECT r, s FROM Doctrine\Tests\Models\DDC117\DDC117Reference r JOIN r.source s WHERE r.source = ?1";
+        $dql = 'SELECT r, s FROM ' . DDC117Reference::class . ' r JOIN r.source s WHERE r.source = ?1';
         $dqlRef = $this->_em->createQuery($dql)->setParameter(1, 1)->getSingleResult();
 
         $this->assertInstanceOf(DDC117Reference::class, $mapRef);
@@ -73,7 +74,7 @@ class DDC117Test extends \Doctrine\Tests\OrmFunctionalTestCase
 
         $this->_em->clear();
 
-        $dql = "SELECT r, s FROM Doctrine\Tests\Models\DDC117\DDC117Reference r JOIN r.source s WHERE s.title = ?1";
+        $dql = 'SELECT r, s FROM ' . DDC117Reference::class . ' r JOIN r.source s WHERE s.title = ?1';
         $dqlRef = $this->_em->createQuery($dql)->setParameter(1, 'Foo')->getSingleResult();
 
         $this->assertInstanceOf(DDC117Reference::class, $dqlRef);
@@ -81,7 +82,7 @@ class DDC117Test extends \Doctrine\Tests\OrmFunctionalTestCase
         $this->assertInstanceOf(DDC117Article::class, $dqlRef->source());
         $this->assertSame($dqlRef, $this->_em->find(DDC117Reference::class, $idCriteria));
 
-        $dql = "SELECT r, s FROM Doctrine\Tests\Models\DDC117\DDC117Reference r JOIN r.source s WHERE s.title = ?1";
+        $dql = 'SELECT r, s FROM ' . DDC117Reference::class . ' r JOIN r.source s WHERE s.title = ?1';
         $dqlRef = $this->_em->createQuery($dql)->setParameter(1, 'Foo')->getSingleResult();
 
         $this->_em->contains($dqlRef);
@@ -265,12 +266,11 @@ class DDC117Test extends \Doctrine\Tests\OrmFunctionalTestCase
      */
     public function testOneToOneCascadePersist()
     {
-        if (!$this->_em->getConnection()->getDatabasePlatform()->prefersSequences()) {
+        if ( ! $this->_em->getConnection()->getDatabasePlatform()->prefersSequences()) {
             $this->markTestSkipped('Test only works with databases that prefer sequences as ID strategy.');
         }
 
         $this->article1 = new DDC117Article("Foo");
-
         $this->articleDetails = new DDC117ArticleDetails($this->article1, "Very long text");
 
         $this->_em->persist($this->article1);
diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1181Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1181Test.php
index d72a960f7..1c4343e40 100644
--- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1181Test.php
+++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1181Test.php
@@ -11,9 +11,9 @@ class DDC1181Test extends OrmFunctionalTestCase
         parent::setUp();
         $this->_schemaTool->createSchema(
             [
-            $this->_em->getClassMetadata(DDC1181Hotel::class),
-            $this->_em->getClassMetadata(DDC1181Booking::class),
-            $this->_em->getClassMetadata(DDC1181Room::class),
+                $this->_em->getClassMetadata(DDC1181Hotel::class),
+                $this->_em->getClassMetadata(DDC1181Booking::class),
+                $this->_em->getClassMetadata(DDC1181Room::class),
             ]
         );
     }
diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1209Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1209Test.php
index 77cde3262..ce53b7505 100644
--- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1209Test.php
+++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1209Test.php
@@ -12,9 +12,9 @@ class DDC1209Test extends OrmFunctionalTestCase
         try {
             $this->_schemaTool->createSchema(
                 [
-                $this->_em->getClassMetadata(DDC1209_1::class),
-                $this->_em->getClassMetadata(DDC1209_2::class),
-                $this->_em->getClassMetadata(DDC1209_3::class)
+                    $this->_em->getClassMetadata(DDC1209_1::class),
+                    $this->_em->getClassMetadata(DDC1209_2::class),
+                    $this->_em->getClassMetadata(DDC1209_3::class)
                 ]
             );
         } catch(\Exception $e) {
diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1306Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1306Test.php
index 4818c82ad..956c5f7d5 100644
--- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1306Test.php
+++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1306Test.php
@@ -2,6 +2,7 @@
 
 namespace Doctrine\Tests\ORM\Functional\Ticket;
 
+use Doctrine\Tests\Models\CMS\CmsAddress;
 use Doctrine\Tests\Models\CMS\CmsUser;
 use Doctrine\Tests\Models\CMS\CmsPhonenumber;
 
@@ -13,6 +14,7 @@ class DDC1306Test extends \Doctrine\Tests\OrmFunctionalTestCase
     public function setUp()
     {
         $this->useModelSet('cms');
+
         parent::setUp();
     }
 
@@ -25,7 +27,7 @@ class DDC1306Test extends \Doctrine\Tests\OrmFunctionalTestCase
         $this->_em->persist($phone);
         $this->_em->flush();
 
-        $address = new \Doctrine\Tests\Models\CMS\CmsAddress();
+        $address = new CmsAddress();
         $address->city = "bonn";
         $address->country = "Germany";
         $address->street = "somestreet!";
diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1400Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1400Test.php
index 4ac78d9b7..a569c1a82 100644
--- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1400Test.php
+++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1400Test.php
@@ -14,9 +14,9 @@ class DDC1400Test extends \Doctrine\Tests\OrmFunctionalTestCase
         try {
             $this->_schemaTool->createSchema(
                 [
-                $this->_em->getClassMetadata(DDC1400Article::class),
-                $this->_em->getClassMetadata(DDC1400User::class),
-                $this->_em->getClassMetadata(DDC1400UserState::class),
+                    $this->_em->getClassMetadata(DDC1400Article::class),
+                    $this->_em->getClassMetadata(DDC1400User::class),
+                    $this->_em->getClassMetadata(DDC1400UserState::class),
                 ]
             );
         } catch (\Exception $ignored) {
@@ -48,15 +48,14 @@ class DDC1400Test extends \Doctrine\Tests\OrmFunctionalTestCase
 
         $this->_em->persist($userState1);
         $this->_em->persist($userState2);
-
         $this->_em->flush();
         $this->_em->clear();
 
         $user1 = $this->_em->getReference(DDC1400User::class, $user1->id);
 
-        $q = $this->_em->createQuery("SELECT a, s FROM ".__NAMESPACE__."\DDC1400Article a JOIN a.userStates s WITH s.user = :activeUser");
-        $q->setParameter('activeUser', $user1);
-        $articles = $q->getResult();
+        $this->_em->createQuery('SELECT a, s FROM ' . DDC1400Article::class . ' a JOIN a.userStates s WITH s.user = :activeUser')
+                  ->setParameter('activeUser', $user1)
+                  ->getResult();
 
         $this->_em->flush();
     }
diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC144Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC144Test.php
index f85df4a7e..064b78021 100644
--- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC144Test.php
+++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC144Test.php
@@ -8,12 +8,11 @@ class DDC144Test extends OrmFunctionalTestCase
 {
     protected function setUp() {
         parent::setUp();
-        //$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
 
         $this->_schemaTool->createSchema(
             [
-            $this->_em->getClassMetadata(DDC144FlowElement::class),
-            $this->_em->getClassMetadata(DDC144Operand::class),
+                $this->_em->getClassMetadata(DDC144FlowElement::class),
+                $this->_em->getClassMetadata(DDC144Operand::class),
             ]
         );
 
@@ -24,10 +23,10 @@ class DDC144Test extends OrmFunctionalTestCase
      */
     public function testIssue()
     {
-
         $operand = new DDC144Operand;
         $operand->property = 'flowValue';
         $operand->operandProperty = 'operandValue';
+
         $this->_em->persist($operand);
         $this->_em->flush();
 
@@ -41,23 +40,30 @@ class DDC144Test extends OrmFunctionalTestCase
  * @DiscriminatorColumn(type="string", name="discr")
  * @DiscriminatorMap({"flowelement" = "DDC144FlowElement", "operand" = "DDC144Operand"})
  */
-class DDC144FlowElement {
+class DDC144FlowElement
+{
     /**
      * @Id @Column(type="integer") @GeneratedValue
      * @var int
      */
     public $id;
+
     /** @Column */
     public $property;
 }
 
-abstract class DDC144Expression extends DDC144FlowElement {
-    abstract function method();
+abstract class DDC144Expression extends DDC144FlowElement
+{
+    abstract public function method();
 }
 
 /** @Entity @Table(name="ddc144_operands") */
-class DDC144Operand extends DDC144Expression {
+class DDC144Operand extends DDC144Expression
+{
     /** @Column */
     public $operandProperty;
-    function method() {}
+
+    public function method()
+    {
+    }
 }
diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1454Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1454Test.php
index 54d5dbd20..0f5509310 100644
--- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1454Test.php
+++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1454Test.php
@@ -14,12 +14,11 @@ class DDC1454Test extends \Doctrine\Tests\OrmFunctionalTestCase
         try {
             $this->_schemaTool->createSchema(
                 [
-                $this->_em->getClassMetadata(DDC1454File::class),
-                $this->_em->getClassMetadata(DDC1454Picture::class),
+                    $this->_em->getClassMetadata(DDC1454File::class),
+                    $this->_em->getClassMetadata(DDC1454Picture::class),
                 ]
             );
         } catch (\Exception $ignored) {
-
         }
     }
 
@@ -36,7 +35,6 @@ class DDC1454Test extends \Doctrine\Tests\OrmFunctionalTestCase
  */
 class DDC1454Picture extends DDC1454File
 {
-
 }
 
 /**
@@ -53,14 +51,16 @@ class DDC1454File
      */
     public $fileId;
 
-    public function __construct() {
+    public function __construct()
+    {
         $this->fileId = rand();
     }
 
     /**
      * Get fileId
      */
-    public function getFileId() {
+    public function getFileId()
+    {
         return $this->fileId;
     }
 
diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1925Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1925Test.php
index c61fae9c6..8c56951be 100644
--- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1925Test.php
+++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1925Test.php
@@ -14,23 +14,25 @@ class DDC1925Test extends \Doctrine\Tests\OrmFunctionalTestCase
     {
         $this->_schemaTool->createSchema(
             [
-            $this->_em->getClassMetadata(DDC1925User::class),
-            $this->_em->getClassMetadata(DDC1925Product::class),
+                $this->_em->getClassMetadata(DDC1925User::class),
+                $this->_em->getClassMetadata(DDC1925Product::class),
             ]
         );
 
         $user = new DDC1925User();
         $user->setTitle("Test User");
-        $this->_em->persist($user);
 
         $product = new DDC1925Product();
         $product->setTitle("Test product");
+
+        $this->_em->persist($user);
         $this->_em->persist($product);
         $this->_em->flush();
 
         $product->addBuyer($user);
 
-        $this->_em->getUnitOfWork()->computeChangeSets();
+        $this->_em->getUnitOfWork()
+                  ->computeChangeSets();
 
         $this->_em->persist($product);
         $this->_em->flush();
@@ -104,15 +106,7 @@ class DDC1925Product
     }
 
     /**
-     * @param string $buyers
-     */
-    public function setBuyers($buyers)
-    {
-        $this->buyers = $buyers;
-    }
-
-    /**
-     * @return string
+     * @return ArrayCollection
      */
     public function getBuyers()
     {
diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC192Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC192Test.php
index f6f0f173d..e90062363 100644
--- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC192Test.php
+++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC192Test.php
@@ -4,27 +4,31 @@ namespace Doctrine\Tests\ORM\Functional\Ticket;
 
 use Doctrine\Tests\OrmFunctionalTestCase;
 
+/**
+ * @group DDC-192
+ */
 class DDC192Test extends OrmFunctionalTestCase
 {
     public function testSchemaCreation()
     {
         $this->_schemaTool->createSchema(
             [
-            $this->_em->getClassMetadata(DDC192User::class),
-            $this->_em->getClassMetadata(DDC192Phonenumber::class)
+                $this->_em->getClassMetadata(DDC192User::class),
+                $this->_em->getClassMetadata(DDC192Phonenumber::class)
             ]
         );
     }
 }
 
-
 /**
- * @Entity @Table(name="ddc192_users")
+ * @Entity
+ * @Table(name="ddc192_users")
  */
 class DDC192User
 {
     /**
-     * @Id @Column(name="id", type="integer")
+     * @Id
+     * @Column(name="id", type="integer")
      * @GeneratedValue(strategy="AUTO")
      */
     public $id;
@@ -37,12 +41,14 @@ class DDC192User
 
 
 /**
- * @Entity @Table(name="ddc192_phonenumbers")
+ * @Entity
+ * @Table(name="ddc192_phonenumbers")
  */
 class DDC192Phonenumber
 {
     /**
-     * @Id @Column(name="phone", type="string", length=40)
+     * @Id
+     * @Column(name="phone", type="string", length=40)
      */
     protected $phone;
 
@@ -54,14 +60,23 @@ class DDC192Phonenumber
     protected $User;
 
 
-    public function setPhone($value) { $this->phone = $value; }
+    public function setPhone($value)
+    {
+        $this->phone = $value;
+    }
 
-    public function getPhone() { return $this->phone; }
+    public function getPhone()
+    {
+        return $this->phone;
+    }
 
     public function setUser(User $user)
     {
         $this->User = $user;
     }
 
-    public function getUser() { return $this->User; }
+    public function getUser()
+    {
+        return $this->User;
+    }
 }
diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2106Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2106Test.php
index 0fdc7f84d..c56f3fb48 100644
--- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2106Test.php
+++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2106Test.php
@@ -12,9 +12,10 @@ class DDC2106Test extends \Doctrine\Tests\OrmFunctionalTestCase
     protected function setUp()
     {
         parent::setUp();
+
         $this->_schemaTool->createSchema(
             [
-            $this->_em->getClassMetadata(DDC2106Entity::class),
+                $this->_em->getClassMetadata(DDC2106Entity::class),
             ]
         );
     }
diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2256Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2256Test.php
index 681210159..9e6f0bcca 100644
--- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2256Test.php
+++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2256Test.php
@@ -13,10 +13,11 @@ class DDC2256Test extends \Doctrine\Tests\OrmFunctionalTestCase
     protected function setUp()
     {
         parent::setUp();
+
         $this->_schemaTool->createSchema(
             [
-            $this->_em->getClassMetadata(DDC2256User::class),
-            $this->_em->getClassMetadata(DDC2256Group::class)
+                $this->_em->getClassMetadata(DDC2256User::class),
+                $this->_em->getClassMetadata(DDC2256Group::class)
             ]
         );
     }
@@ -55,8 +56,7 @@ class DDC2256Test extends \Doctrine\Tests\OrmFunctionalTestCase
         // Test ResultSetMappingBuilder.
         $rsm = new ResultSetMappingBuilder($this->_em);
         $rsm->addRootEntityFromClassMetadata('MyNamespace:DDC2256User', 'u');
-        $rsm->addJoinedEntityFromClassMetadata('MyNamespace:DDC2256Group', 'g', 'u', 'group', ['id' => 'group_id', 'name' => 'group_name']
-        );
+        $rsm->addJoinedEntityFromClassMetadata('MyNamespace:DDC2256Group', 'g', 'u', 'group', ['id' => 'group_id', 'name' => 'group_name']);
 
         $this->_em->createNativeQuery($sql, $rsm)->getResult();
     }
diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2775Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2775Test.php
index 025ee7633..3f7703385 100644
--- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2775Test.php
+++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2775Test.php
@@ -17,10 +17,10 @@ class DDC2775Test extends OrmFunctionalTestCase
 
         $this->setUpEntitySchema(
             [
-            User::class,
-            Role::class,
-            AdminRole::class,
-            Authorization::class,
+                User::class,
+                Role::class,
+                AdminRole::class,
+                Authorization::class,
             ]
         );
     }
@@ -30,9 +30,8 @@ class DDC2775Test extends OrmFunctionalTestCase
      */
     public function testIssueCascadeRemove()
     {
-        $user = new User();
-
         $role = new AdminRole();
+        $user = new User();
         $user->addRole($role);
 
         $authorization = new Authorization();
diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3170Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3170Test.php
index ac3f10be6..88e3727d2 100644
--- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3170Test.php
+++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3170Test.php
@@ -38,10 +38,9 @@ class DDC3170Test extends \Doctrine\Tests\OrmFunctionalTestCase
      */
     public function testIssue()
     {
-        // $this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
-
         $productJoined = new DDC3170ProductJoined();
         $productSingleTable = new DDC3170ProductSingleTable();
+
         $this->_em->persist($productJoined);
         $this->_em->persist($productSingleTable);
         $this->_em->flush();
diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3711Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3711Test.php
index 3fc4c856b..bd2b1ba9b 100644
--- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3711Test.php
+++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3711Test.php
@@ -26,6 +26,5 @@ class DDC3711Test extends YamlMappingDriverTest
 
         $this->assertEquals(['link_a_id1' => "id1", 'link_a_id2' => "id2"], $entityA->associationMappings['entityB']['relationToSourceKeyColumns']);
         $this->assertEquals(['link_b_id1' => "id1", 'link_b_id2' => "id2"], $entityA->associationMappings['entityB']['relationToTargetKeyColumns']);
-
     }
 }
diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3785Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3785Test.php
index 05498db77..4fcc3932c 100644
--- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3785Test.php
+++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3785Test.php
@@ -17,9 +17,9 @@ class DDC3785Test extends \Doctrine\Tests\OrmFunctionalTestCase
         try {
             $this->_schemaTool->createSchema(
                 [
-                $this->_em->getClassMetadata(DDC3785_Asset::class),
-                $this->_em->getClassMetadata(DDC3785_AssetId::class),
-                $this->_em->getClassMetadata(DDC3785_Attribute::class)
+                    $this->_em->getClassMetadata(DDC3785_Asset::class),
+                    $this->_em->getClassMetadata(DDC3785_AssetId::class),
+                    $this->_em->getClassMetadata(DDC3785_Attribute::class)
                 ]
             );
         } catch(\Exception $e) {
@@ -31,15 +31,18 @@ class DDC3785Test extends \Doctrine\Tests\OrmFunctionalTestCase
      */
     public function testOwningValueObjectIdIsCorrectlyTransformedWhenRemovingOrphanedChildEntities()
     {
-    	$id = new DDC3785_AssetId("919609ba-57d9-4a13-be1d-d202521e858a");
-    	$attributes = [
-    		$attribute1 = new DDC3785_Attribute("foo1", "bar1"),
-    		$attribute2 = new DDC3785_Attribute("foo2", "bar2")
+        $id = new DDC3785_AssetId('919609ba-57d9-4a13-be1d-d202521e858a');
+
+        $attributes = [
+            $attribute1 = new DDC3785_Attribute('foo1', 'bar1'),
+            $attribute2 = new DDC3785_Attribute('foo2', 'bar2')
         ];
+
         $this->_em->persist($asset = new DDC3785_Asset($id, $attributes));
         $this->_em->flush();
 
-        $asset->getAttributes()->removeElement($attribute1);
+        $asset->getAttributes()
+              ->removeElement($attribute1);
 
         $this->_em->persist($asset);
         $this->_em->flush();
@@ -68,12 +71,12 @@ class DDC3785_Asset
 
     public function __construct(DDC3785_AssetId $id, $attributes = [])
     {
-    	$this->id = $id;
-    	$this->attributes = new ArrayCollection();
+        $this->id = $id;
+        $this->attributes = new ArrayCollection();
 
-    	foreach ($attributes as $attribute) {
-    		$this->attributes->add($attribute);
-    	}
+        foreach ($attributes as $attribute) {
+            $this->attributes->add($attribute);
+        }
     }
 
     public function getId()
@@ -83,7 +86,7 @@ class DDC3785_Asset
 
     public function getAttributes()
     {
-    	return $this->attributes;
+        return $this->attributes;
     }
 }
 
@@ -93,23 +96,23 @@ class DDC3785_Asset
  */
 class DDC3785_Attribute
 {
-	/**
+    /**
      * @Id @Column(type="integer")
      * @GeneratedValue
      */
-	private $id;
+    private $id;
 
-	/** @Column(type = "string") */
-	private $name;
+    /** @Column(type = "string") */
+    private $name;
 
-	/** @Column(type = "string") */
-	private $value;
+    /** @Column(type = "string") */
+    private $value;
 
-	public function __construct($name, $value)
-	{
-		$this->name = $name;
-		$this->value = $value;
-	}
+    public function __construct($name, $value)
+    {
+        $this->name = $name;
+        $this->value = $value;
+    }
 }
 
 /** @Embeddable */
@@ -120,12 +123,12 @@ class DDC3785_AssetId
 
     public function __construct($id)
     {
-    	$this->id = $id;
+        $this->id = $id;
     }
 
     public function __toString()
     {
-    	return $this->id;
+        return $this->id;
     }
 }
 
diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC522Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC522Test.php
index 9818e60aa..3909b9ca0 100644
--- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC522Test.php
+++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC522Test.php
@@ -13,16 +13,16 @@ class DDC522Test extends \Doctrine\Tests\OrmFunctionalTestCase
     protected function setUp()
     {
         parent::setUp();
+
         try {
             $this->_schemaTool->createSchema(
                 [
-                $this->_em->getClassMetadata(DDC522Customer::class),
-                $this->_em->getClassMetadata(DDC522Cart::class),
-                $this->_em->getClassMetadata(DDC522ForeignKeyTest::class)
+                    $this->_em->getClassMetadata(DDC522Customer::class),
+                    $this->_em->getClassMetadata(DDC522Cart::class),
+                    $this->_em->getClassMetadata(DDC522ForeignKeyTest::class)
                 ]
             );
         } catch(\Exception $e) {
-
         }
     }
 
@@ -43,8 +43,8 @@ class DDC522Test extends \Doctrine\Tests\OrmFunctionalTestCase
 
         $this->_em->clear();
 
-        $r = $this->_em->createQuery("select ca,c from ".get_class($cart)." ca join ca.customer c")
-                ->getResult();
+        $r = $this->_em->createQuery('select ca,c from ' . DDC522Cart::class . ' ca join ca.customer c')
+                       ->getResult();
 
         $this->assertInstanceOf(DDC522Cart::class, $r[0]);
         $this->assertInstanceOf(DDC522Customer::class, $r[0]->customer);
@@ -71,7 +71,7 @@ class DDC522Test extends \Doctrine\Tests\OrmFunctionalTestCase
     public function testJoinColumnWithNullSameNameAssociationField()
     {
         $fkCust = new DDC522ForeignKeyTest;
-        $fkCust->name = "name";
+        $fkCust->name = 'name';
         $fkCust->cart = null;
 
         $this->_em->persist($fkCust);
@@ -83,21 +83,27 @@ class DDC522Test extends \Doctrine\Tests\OrmFunctionalTestCase
 }
 
 /** @Entity */
-class DDC522Customer {
+class DDC522Customer
+{
     /** @Id @Column(type="integer") @GeneratedValue */
     public $id;
+
     /** @Column */
     public $name;
+
     /** @OneToOne(targetEntity="DDC522Cart", mappedBy="customer") */
     public $cart;
 }
 
 /** @Entity */
-class DDC522Cart {
+class DDC522Cart
+{
     /** @Id @Column(type="integer") @GeneratedValue */
     public $id;
+
     /** @Column(type="integer") */
     public $total;
+
     /**
      * @OneToOne(targetEntity="DDC522Customer", inversedBy="cart")
      * @JoinColumn(name="customer", referencedColumnName="id")
@@ -106,11 +112,14 @@ class DDC522Cart {
 }
 
 /** @Entity */
-class DDC522ForeignKeyTest {
+class DDC522ForeignKeyTest
+{
     /** @Id @Column(type="integer") @GeneratedValue */
     public $id;
+
     /** @Column(type="integer", name="cart_id", nullable=true) */
     public $cartId;
+
     /**
      * @OneToOne(targetEntity="DDC522Cart")
      * @JoinColumn(name="cart_id", referencedColumnName="id")
diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC588Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC588Test.php
index 021e582e6..aa50f2cdb 100644
--- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC588Test.php
+++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC588Test.php
@@ -7,9 +7,10 @@ class DDC588Test extends \Doctrine\Tests\OrmFunctionalTestCase
     protected function setUp()
     {
         parent::setUp();
+
         $this->_schemaTool->createSchema(
             [
-            $this->_em->getClassMetadata(DDC588Site::class),
+                $this->_em->getClassMetadata(DDC588Site::class),
             ]
         );
     }
diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC742Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC742Test.php
index 4d03bca2a..bc465db92 100644
--- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC742Test.php
+++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC742Test.php
@@ -27,8 +27,8 @@ class DDC742Test extends \Doctrine\Tests\OrmFunctionalTestCase
         try {
             $this->_schemaTool->createSchema(
                 [
-                $this->_em->getClassMetadata(DDC742User::class),
-                $this->_em->getClassMetadata(DDC742Comment::class)
+                    $this->_em->getClassMetadata(DDC742User::class),
+                    $this->_em->getClassMetadata(DDC742Comment::class)
                 ]
             );
         } catch(\Exception $e) {
@@ -64,9 +64,9 @@ class DDC742Test extends \Doctrine\Tests\OrmFunctionalTestCase
         $this->_em->flush();
         $this->_em->clear();
 
-        $user = $this->_em->find(get_class($user), $user->id);
-        $comment3 = $this->_em->find(get_class($comment3), $comment3->id);
-        $user->favoriteComments->add($comment3);
+        $user = $this->_em->find(DDC742User::class, $user->id);
+        $user->favoriteComments->add($this->_em->find(DDC742Comment::class, $comment3->id));
+
         $this->_em->flush();
     }
 }
@@ -86,11 +86,13 @@ class DDC742User
      * @var int
      */
     public $id;
+
     /**
      * @Column(length=100, type="string")
      * @var string
      */
     public $title;
+
     /**
      * @ManyToMany(targetEntity="DDC742Comment", cascade={"persist"}, fetch="EAGER")
      * @JoinTable(
@@ -99,7 +101,7 @@ class DDC742User
      *  inverseJoinColumns={@JoinColumn(name="comment_id", referencedColumnName="id")}
      * )
      *
-     * @var Doctrine\ORM\PersistentCollection
+     * @var \Doctrine\ORM\PersistentCollection
      */
     public $favoriteComments;
 }
@@ -119,6 +121,7 @@ class DDC742Comment
      * @var int
      */
     public $id;
+
     /**
      * @Column(length=100, type="string")
      * @var string
diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC832Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC832Test.php
index 9e674e3ca..ee46b5bc7 100644
--- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC832Test.php
+++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC832Test.php
@@ -7,22 +7,24 @@ class DDC832Test extends \Doctrine\Tests\OrmFunctionalTestCase
     public function setUp()
     {
         parent::setUp();
+
         $platform = $this->_em->getConnection()->getDatabasePlatform();
-        if ($platform->getName() == "oracle") {
+
+        if ($platform->getName() === 'oracle') {
             $this->markTestSkipped('Doesnt run on Oracle.');
         }
 
         $this->_em->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger());
+
         try {
             $this->_schemaTool->createSchema(
                 [
-                $this->_em->getClassMetadata(DDC832JoinedIndex::class),
-                $this->_em->getClassMetadata(DDC832JoinedTreeIndex::class),
-                $this->_em->getClassMetadata(DDC832Like::class),
+                    $this->_em->getClassMetadata(DDC832JoinedIndex::class),
+                    $this->_em->getClassMetadata(DDC832JoinedTreeIndex::class),
+                    $this->_em->getClassMetadata(DDC832Like::class),
                 ]
             );
         } catch(\Exception $e) {
-
         }
     }
 
@@ -30,6 +32,7 @@ class DDC832Test extends \Doctrine\Tests\OrmFunctionalTestCase
     {
         /* @var $sm \Doctrine\DBAL\Schema\AbstractSchemaManager */
         $platform = $this->_em->getConnection()->getDatabasePlatform();
+
         $sm = $this->_em->getConnection()->getSchemaManager();
         $sm->dropTable($platform->quoteIdentifier('TREE_INDEX'));
         $sm->dropTable($platform->quoteIdentifier('INDEX'));
@@ -41,11 +44,11 @@ class DDC832Test extends \Doctrine\Tests\OrmFunctionalTestCase
      */
     public function testQuotedTableBasicUpdate()
     {
-        $like = new DDC832Like("test");
+        $like = new DDC832Like('test');
         $this->_em->persist($like);
         $this->_em->flush();
 
-        $like->word = "test2";
+        $like->word = 'test2';
         $this->_em->flush();
     }
 
@@ -54,7 +57,7 @@ class DDC832Test extends \Doctrine\Tests\OrmFunctionalTestCase
      */
     public function testQuotedTableBasicRemove()
     {
-        $like = new DDC832Like("test");
+        $like = new DDC832Like('test');
         $this->_em->persist($like);
         $this->_em->flush();
 
@@ -67,11 +70,11 @@ class DDC832Test extends \Doctrine\Tests\OrmFunctionalTestCase
      */
     public function testQuotedTableJoinedUpdate()
     {
-        $index = new DDC832JoinedIndex("test");
+        $index = new DDC832JoinedIndex('test');
         $this->_em->persist($index);
         $this->_em->flush();
 
-        $index->name = "asdf";
+        $index->name = 'asdf';
         $this->_em->flush();
     }
 
@@ -80,7 +83,7 @@ class DDC832Test extends \Doctrine\Tests\OrmFunctionalTestCase
      */
     public function testQuotedTableJoinedRemove()
     {
-        $index = new DDC832JoinedIndex("test");
+        $index = new DDC832JoinedIndex('test');
         $this->_em->persist($index);
         $this->_em->flush();
 
@@ -93,11 +96,11 @@ class DDC832Test extends \Doctrine\Tests\OrmFunctionalTestCase
      */
     public function testQuotedTableJoinedChildUpdate()
     {
-        $index = new DDC832JoinedTreeIndex("test", 1, 2);
+        $index = new DDC832JoinedTreeIndex('test', 1, 2);
         $this->_em->persist($index);
         $this->_em->flush();
 
-        $index->name = "asdf";
+        $index->name = 'asdf';
         $this->_em->flush();
     }
 
@@ -106,7 +109,7 @@ class DDC832Test extends \Doctrine\Tests\OrmFunctionalTestCase
      */
     public function testQuotedTableJoinedChildRemove()
     {
-        $index = new DDC832JoinedTreeIndex("test", 1, 2);
+        $index = new DDC832JoinedTreeIndex('test', 1, 2);
         $this->_em->persist($index);
         $this->_em->flush();
 
@@ -178,6 +181,7 @@ class DDC832JoinedTreeIndex extends DDC832JoinedIndex
 {
     /** @Column(type="integer") */
     public $lft;
+
     /** @Column(type="integer") */
     public $rgt;
 
diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC933Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC933Test.php
index e4c9d1328..039eb7ab8 100644
--- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC933Test.php
+++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC933Test.php
@@ -2,6 +2,8 @@
 
 namespace Doctrine\Tests\ORM\Functional\Ticket;
 
+use Doctrine\DBAL\LockMode;
+use Doctrine\Tests\Models\Company\CompanyManager;
 use Doctrine\Tests\OrmFunctionalTestCase;
 
 class DDC933Test extends OrmFunctionalTestCase
@@ -9,6 +11,7 @@ class DDC933Test extends OrmFunctionalTestCase
     public function setUp()
     {
         $this->useModelSet('company');
+
         parent::setUp();
     }
 
@@ -17,9 +20,7 @@ class DDC933Test extends OrmFunctionalTestCase
      */
     public function testLockCTIClass()
     {
-        //$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger());
-
-        $manager = new \Doctrine\Tests\Models\Company\CompanyManager();
+        $manager = new CompanyManager();
         $manager->setName('beberlei');
         $manager->setSalary(1234);
         $manager->setTitle('Vice President of This Test');
@@ -29,7 +30,7 @@ class DDC933Test extends OrmFunctionalTestCase
         $this->_em->flush();
 
         $this->_em->beginTransaction();
-        $this->_em->lock($manager, \Doctrine\DBAL\LockMode::PESSIMISTIC_READ);
+        $this->_em->lock($manager, LockMode::PESSIMISTIC_READ);
         $this->_em->rollback();
     }
 }
diff --git a/tests/Doctrine/Tests/ORM/Functional/TypeTest.php b/tests/Doctrine/Tests/ORM/Functional/TypeTest.php
index 052002014..9276d74ee 100644
--- a/tests/Doctrine/Tests/ORM/Functional/TypeTest.php
+++ b/tests/Doctrine/Tests/ORM/Functional/TypeTest.php
@@ -15,6 +15,7 @@ class TypeTest extends OrmFunctionalTestCase
     protected function setUp()
     {
         $this->useModelSet('generic');
+
         parent::setUp();
     }
 
@@ -28,7 +29,7 @@ class TypeTest extends OrmFunctionalTestCase
         $this->_em->flush();
         $this->_em->clear();
 
-        $dql = "SELECT d FROM Doctrine\Tests\Models\Generic\DecimalModel d";
+        $dql = 'SELECT d FROM ' . DecimalModel::class . ' d';
         $decimal = $this->_em->createQuery($dql)->getSingleResult();
 
         $this->assertEquals(0.15, $decimal->decimal);
@@ -48,7 +49,7 @@ class TypeTest extends OrmFunctionalTestCase
         $this->_em->flush();
         $this->_em->clear();
 
-        $dql = "SELECT b FROM Doctrine\Tests\Models\Generic\BooleanModel b WHERE b.booleanField = true";
+        $dql = 'SELECT b FROM ' . BooleanModel::class . ' b WHERE b.booleanField = true';
         $bool = $this->_em->createQuery($dql)->getSingleResult();
 
         $this->assertTrue($bool->booleanField);
@@ -58,7 +59,7 @@ class TypeTest extends OrmFunctionalTestCase
         $this->_em->flush();
         $this->_em->clear();
 
-        $dql = "SELECT b FROM Doctrine\Tests\Models\Generic\BooleanModel b WHERE b.booleanField = false";
+        $dql = 'SELECT b FROM ' . BooleanModel::class . ' b WHERE b.booleanField = false';
         $bool = $this->_em->createQuery($dql)->getSingleResult();
 
         $this->assertFalse($bool->booleanField);
@@ -74,7 +75,7 @@ class TypeTest extends OrmFunctionalTestCase
         $this->_em->flush();
         $this->_em->clear();
 
-        $dql = "SELECT s FROM Doctrine\Tests\Models\Generic\SerializationModel s";
+        $dql = 'SELECT s FROM ' . SerializationModel::class . ' s';
         $serialize = $this->_em->createQuery($dql)->getSingleResult();
 
         $this->assertEquals(["foo" => "bar", "bar" => "baz"], $serialize->array);
@@ -89,7 +90,7 @@ class TypeTest extends OrmFunctionalTestCase
         $this->_em->flush();
         $this->_em->clear();
 
-        $dql = "SELECT s FROM Doctrine\Tests\Models\Generic\SerializationModel s";
+        $dql = 'SELECT s FROM ' . SerializationModel::class . ' s';
         $serialize = $this->_em->createQuery($dql)->getSingleResult();
 
         $this->assertInstanceOf('stdClass', $serialize->object);
@@ -106,7 +107,7 @@ class TypeTest extends OrmFunctionalTestCase
 
         $dateTimeDb = $this->_em->find(DateTimeModel::class, $dateTime->id);
 
-        $this->assertInstanceOf('DateTime', $dateTimeDb->date);
+        $this->assertInstanceOf(\DateTime::class, $dateTimeDb->date);
         $this->assertEquals('2009-10-01', $dateTimeDb->date->format('Y-m-d'));
     }
 
@@ -121,12 +122,12 @@ class TypeTest extends OrmFunctionalTestCase
 
         $dateTimeDb = $this->_em->find(DateTimeModel::class, $dateTime->id);
 
-        $this->assertInstanceOf('DateTime', $dateTimeDb->datetime);
+        $this->assertInstanceOf(\DateTime::class, $dateTimeDb->datetime);
         $this->assertEquals('2009-10-02 20:10:52', $dateTimeDb->datetime->format('Y-m-d H:i:s'));
 
-        $articles = $this->_em->getRepository( DateTimeModel::class )->findBy( ['datetime' => new \DateTime( "now" )]
-        );
-        $this->assertEquals( 0, count( $articles ) );
+        $articles = $this->_em->getRepository(DateTimeModel::class)
+                              ->findBy(['datetime' => new \DateTime()]);
+        $this->assertEquals(0, count($articles));
     }
 
     public function testDqlQueryBindDateTimeInstance()
@@ -175,7 +176,7 @@ class TypeTest extends OrmFunctionalTestCase
 
         $dateTimeDb = $this->_em->find(DateTimeModel::class, $dateTime->id);
 
-        $this->assertInstanceOf('DateTime', $dateTime->time);
-        $this->assertEquals('19:27:20', $dateTime->time->format('H:i:s'));
+        $this->assertInstanceOf(\DateTime::class, $dateTimeDb->time);
+        $this->assertEquals('19:27:20', $dateTimeDb->time->format('H:i:s'));
     }
 }
diff --git a/tests/Doctrine/Tests/ORM/Functional/TypeValueSqlTest.php b/tests/Doctrine/Tests/ORM/Functional/TypeValueSqlTest.php
index 971af9170..3af954cfd 100644
--- a/tests/Doctrine/Tests/ORM/Functional/TypeValueSqlTest.php
+++ b/tests/Doctrine/Tests/ORM/Functional/TypeValueSqlTest.php
@@ -3,6 +3,8 @@
 namespace Doctrine\Tests\ORM\Functional;
 
 use Doctrine\DBAL\Types\Type as DBALType;
+use Doctrine\Tests\DbalTypes\NegativeToPositiveType;
+use Doctrine\Tests\DbalTypes\UpperCaseStringType;
 use Doctrine\Tests\Models\CustomType\CustomTypeChild;
 use Doctrine\Tests\Models\CustomType\CustomTypeParent;
 use Doctrine\Tests\Models\CustomType\CustomTypeUpperCase;
@@ -12,16 +14,16 @@ class TypeValueSqlTest extends OrmFunctionalTestCase
 {
     protected function setUp()
     {
-        if (DBALType::hasType('upper_case_string')) {
-            DBALType::overrideType('upper_case_string', '\Doctrine\Tests\DbalTypes\UpperCaseStringType');
+        if (DBALType::hasType(UpperCaseStringType::NAME)) {
+            DBALType::overrideType(UpperCaseStringType::NAME, UpperCaseStringType::class);
         } else {
-            DBALType::addType('upper_case_string', '\Doctrine\Tests\DbalTypes\UpperCaseStringType');
+            DBALType::addType(UpperCaseStringType::NAME, UpperCaseStringType::class);
         }
 
-        if (DBALType::hasType('negative_to_positive')) {
-            DBALType::overrideType('negative_to_positive', '\Doctrine\Tests\DbalTypes\NegativeToPositiveType');
+        if (DBALType::hasType(NegativeToPositiveType::NAME)) {
+            DBALType::overrideType(NegativeToPositiveType::NAME, NegativeToPositiveType::class);
         } else {
-            DBALType::addType('negative_to_positive', '\Doctrine\Tests\DbalTypes\NegativeToPositiveType');
+            DBALType::addType(NegativeToPositiveType::NAME, NegativeToPositiveType::class);
         }
 
         $this->useModelSet('customtype');
diff --git a/tests/Doctrine/Tests/ORM/Hydration/ScalarHydratorTest.php b/tests/Doctrine/Tests/ORM/Hydration/ScalarHydratorTest.php
index 2ad9461ff..2c51929bc 100644
--- a/tests/Doctrine/Tests/ORM/Hydration/ScalarHydratorTest.php
+++ b/tests/Doctrine/Tests/ORM/Hydration/ScalarHydratorTest.php
@@ -2,6 +2,7 @@
 
 namespace Doctrine\Tests\ORM\Hydration;
 
+use Doctrine\ORM\Internal\Hydration\ScalarHydrator;
 use Doctrine\Tests\Mocks\HydratorMockStatement;
 use Doctrine\ORM\Query\ResultSetMapping;
 use Doctrine\Tests\Models\CMS\CmsUser;
@@ -32,7 +33,7 @@ class ScalarHydratorTest extends HydrationTestCase
 
 
         $stmt = new HydratorMockStatement($resultSet);
-        $hydrator = new \Doctrine\ORM\Internal\Hydration\ScalarHydrator($this->_em);
+        $hydrator = new ScalarHydrator($this->_em);
 
         $result = $hydrator->hydrateAll($stmt, $rsm);
 
@@ -63,7 +64,7 @@ class ScalarHydratorTest extends HydrationTestCase
         ];
 
         $stmt = new HydratorMockStatement($resultSet);
-        $hydrator = new \Doctrine\ORM\Internal\Hydration\ScalarHydrator($this->_em);
+        $hydrator = new ScalarHydrator($this->_em);
 
         $result = $hydrator->hydrateAll($stmt, $rsm);
     }
@@ -93,7 +94,7 @@ class ScalarHydratorTest extends HydrationTestCase
         ];
 
         $stmt = new HydratorMockStatement($resultSet);
-        $hydrator = new \Doctrine\ORM\Internal\Hydration\ScalarHydrator($this->_em);
+        $hydrator = new ScalarHydrator($this->_em);
 
         $result = $hydrator->hydrateAll($stmt, $rsm);
     }
diff --git a/tests/Doctrine/Tests/ORM/Hydration/SingleScalarHydratorTest.php b/tests/Doctrine/Tests/ORM/Hydration/SingleScalarHydratorTest.php
index d0cebbc49..694259b29 100644
--- a/tests/Doctrine/Tests/ORM/Hydration/SingleScalarHydratorTest.php
+++ b/tests/Doctrine/Tests/ORM/Hydration/SingleScalarHydratorTest.php
@@ -2,6 +2,8 @@
 
 namespace Doctrine\Tests\ORM\Hydration;
 
+use Doctrine\ORM\Internal\Hydration\SingleScalarHydrator;
+use Doctrine\ORM\NonUniqueResultException;
 use Doctrine\Tests\Mocks\HydratorMockStatement;
 use Doctrine\ORM\Query\ResultSetMapping;
 use Doctrine\Tests\Models\CMS\CmsUser;
@@ -9,48 +11,49 @@ use Doctrine\Tests\Models\CMS\CmsUser;
 class SingleScalarHydratorTest extends HydrationTestCase
 {
     /** Result set provider for the HYDRATE_SINGLE_SCALAR tests */
-    public static function singleScalarResultSetProvider() {
+    public static function singleScalarResultSetProvider(): array
+    {
         return [
-          // valid
-          [
-              'name' => 'result1',
+            // valid
+            'valid' => [
+                'name'      => 'result1',
                 'resultSet' => [
-                  [
-                      'u__name' => 'romanb'
-                  ]
-                ]
-          ],
-          // valid
-          [
-              'name' => 'result2',
+                    [
+                        'u__name' => 'romanb',
+                    ],
+                ],
+            ],
+            // valid
+            [
+                'name'      => 'result2',
                 'resultSet' => [
-                  [
-                      'u__id' => '1'
-                  ]
-                ]
-          ],
-           // invalid
-           [
-               'name' => 'result3',
+                    [
+                        'u__id' => '1',
+                    ],
+                ],
+            ],
+            // invalid
+            [
+                'name'      => 'result3',
                 'resultSet' => [
-                  [
-                      'u__id' => '1',
-                      'u__name' => 'romanb'
-                  ]
-                ]
-           ],
-           // invalid
-           [
-               'name' => 'result4',
+                    [
+                        'u__id'   => '1',
+                        'u__name' => 'romanb',
+                    ],
+                ],
+            ],
+            // invalid
+            [
+                'name'      => 'result4',
                 'resultSet' => [
-                  [
-                      'u__id' => '1'
-                  ],
-                  [
-                      'u__id' => '2'
-                  ]
-                ]
-           ],
+                    [
+                        'u__id' => '1',
+                    ],
+                    [
+                        'u__id' => '2',
+                    ],
+                ],
+            ],
         ];
     }
 
@@ -67,7 +70,7 @@ class SingleScalarHydratorTest extends HydrationTestCase
         $rsm->addFieldResult('u', 'u__name', 'name');
 
         $stmt = new HydratorMockStatement($resultSet);
-        $hydrator = new \Doctrine\ORM\Internal\Hydration\SingleScalarHydrator($this->_em);
+        $hydrator = new SingleScalarHydrator($this->_em);
 
         if ($name == 'result1') {
             $result = $hydrator->hydrateAll($stmt, $rsm);
diff --git a/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php b/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php
index f857bed45..e13d7aa7e 100644
--- a/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php
+++ b/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php
@@ -68,17 +68,10 @@ abstract class AbstractMappingDriverTest extends OrmTestCase
         return $factory;
     }
 
-    public function testLoadMapping()
+    public function testEntityTableNameAndInheritance()
     {
-        return $this->createClassMetadata(User::class);
-    }
+        $class = $this->createClassMetadata(User::class);
 
-    /**
-     * @depends testLoadMapping
-     * @param ClassMetadata $class
-     */
-    public function testEntityTableNameAndInheritance($class)
-    {
         $this->assertEquals('cms_users', $class->getTableName());
         $this->assertEquals(ClassMetadata::INHERITANCE_TYPE_NONE, $class->inheritanceType);
 
@@ -274,14 +267,12 @@ abstract class AbstractMappingDriverTest extends OrmTestCase
     /**
      * @group #6129
      *
-     * @depends testLoadMapping
-     *
-     * @param ClassMetadata $class
-     *
      * @return ClassMetadata
      */
-    public function testBooleanValuesForOptionIsSetCorrectly(ClassMetadata $class)
+    public function testBooleanValuesForOptionIsSetCorrectly()
     {
+        $class = $this->createClassMetadata(User::class);
+
         $this->assertInternalType('bool', $class->fieldMappings['id']['options']['unsigned']);
         $this->assertFalse($class->fieldMappings['id']['options']['unsigned']);
 
diff --git a/tests/Doctrine/Tests/ORM/Mapping/StaticPHPMappingDriverTest.php b/tests/Doctrine/Tests/ORM/Mapping/StaticPHPMappingDriverTest.php
index e374e135e..5f2f0c1d7 100644
--- a/tests/Doctrine/Tests/ORM/Mapping/StaticPHPMappingDriverTest.php
+++ b/tests/Doctrine/Tests/ORM/Mapping/StaticPHPMappingDriverTest.php
@@ -12,7 +12,6 @@ class StaticPHPMappingDriverTest extends AbstractMappingDriverTest
         return new StaticPHPDriver(__DIR__ . DIRECTORY_SEPARATOR . 'php');
     }
 
-
     /**
      * All class with static::loadMetadata are entities for php driver
      *