Failed Conditions
Pull Request — master (#7242)
by Gabriel
08:46
created
tests/Doctrine/Tests/ORM/Functional/CustomFunctionsTest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 use Doctrine\Tests\Models\CMS\CmsUser;
13 13
 use Doctrine\Tests\OrmFunctionalTestCase;
14 14
 
15
-require_once __DIR__ . '/../../TestInit.php';
15
+require_once __DIR__.'/../../TestInit.php';
16 16
 
17 17
 class CustomFunctionsTest extends OrmFunctionalTestCase
18 18
 {
@@ -32,10 +32,10 @@  discard block
 block discarded – undo
32 32
         $this->em->flush();
33 33
 
34 34
         // Instead of defining the function with the class name, we use a callback
35
-        $this->em->getConfiguration()->addCustomStringFunction('FOO', function ($funcName) {
35
+        $this->em->getConfiguration()->addCustomStringFunction('FOO', function($funcName) {
36 36
             return new NoOp($funcName);
37 37
         });
38
-        $this->em->getConfiguration()->addCustomNumericFunction('BAR', function ($funcName) {
38
+        $this->em->getConfiguration()->addCustomNumericFunction('BAR', function($funcName) {
39 39
             return new NoOp($funcName);
40 40
         });
41 41
 
Please login to merge, or discard this patch.
tests/Doctrine/Tests/ORM/Functional/PaginationTest.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
         $iter = $paginator->getIterator();
135 135
         self::assertCount(9, $iter);
136 136
         $result = iterator_to_array($iter);
137
-        self::assertEquals($checkField . '0', $result[0]->{$checkField});
137
+        self::assertEquals($checkField.'0', $result[0]->{$checkField});
138 138
     }
139 139
 
140 140
     private function iterateWithOrderAscWithLimit($useOutputWalkers, $fetchJoinCollection, $baseDql, $checkField)
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
         $iter = $paginator->getIterator();
151 151
         self::assertCount(3, $iter);
152 152
         $result = iterator_to_array($iter);
153
-        self::assertEquals($checkField . '0', $result[0]->{$checkField});
153
+        self::assertEquals($checkField.'0', $result[0]->{$checkField});
154 154
     }
155 155
 
156 156
     private function iterateWithOrderAscWithLimitAndOffset($useOutputWalkers, $fetchJoinCollection, $baseDql, $checkField)
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
         $iter = $paginator->getIterator();
167 167
         self::assertCount(3, $iter);
168 168
         $result = iterator_to_array($iter);
169
-        self::assertEquals($checkField . '3', $result[0]->{$checkField});
169
+        self::assertEquals($checkField.'3', $result[0]->{$checkField});
170 170
     }
171 171
 
172 172
     private function iterateWithOrderDesc($useOutputWalkers, $fetchJoinCollection, $baseDql, $checkField)
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
         $iter = $paginator->getIterator();
180 180
         self::assertCount(9, $iter);
181 181
         $result = iterator_to_array($iter);
182
-        self::assertEquals($checkField . '8', $result[0]->{$checkField});
182
+        self::assertEquals($checkField.'8', $result[0]->{$checkField});
183 183
     }
184 184
 
185 185
     private function iterateWithOrderDescWithLimit($useOutputWalkers, $fetchJoinCollection, $baseDql, $checkField)
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
         $iter = $paginator->getIterator();
195 195
         self::assertCount(3, $iter);
196 196
         $result = iterator_to_array($iter);
197
-        self::assertEquals($checkField . '8', $result[0]->{$checkField});
197
+        self::assertEquals($checkField.'8', $result[0]->{$checkField});
198 198
     }
199 199
 
200 200
     private function iterateWithOrderDescWithLimitAndOffset($useOutputWalkers, $fetchJoinCollection, $baseDql, $checkField)
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
         $iter = $paginator->getIterator();
210 210
         self::assertCount(3, $iter);
211 211
         $result = iterator_to_array($iter);
212
-        self::assertEquals($checkField . '5', $result[0]->{$checkField});
212
+        self::assertEquals($checkField.'5', $result[0]->{$checkField});
213 213
     }
214 214
 
215 215
     /**
@@ -482,8 +482,8 @@  discard block
 block discarded – undo
482 482
     public function testIterateWithFetchJoinOneToManyWithOrderByColumnFromBoth($useOutputWalkers) : void
483 483
     {
484 484
         $dql     = 'SELECT c, d FROM Doctrine\Tests\Models\Pagination\Company c JOIN c.departments d ORDER BY c.name';
485
-        $dqlAsc  = $dql . ' ASC, d.name';
486
-        $dqlDesc = $dql . ' DESC, d.name';
485
+        $dqlAsc  = $dql.' ASC, d.name';
486
+        $dqlDesc = $dql.' DESC, d.name';
487 487
         $this->iterateWithOrderAsc($useOutputWalkers, true, $dqlAsc, 'name');
488 488
         $this->iterateWithOrderDesc($useOutputWalkers, true, $dqlDesc, 'name');
489 489
     }
@@ -491,8 +491,8 @@  discard block
 block discarded – undo
491 491
     public function testIterateWithFetchJoinOneToManyWithOrderByColumnFromBothWithLimitWithOutputWalker() : void
492 492
     {
493 493
         $dql     = 'SELECT c, d FROM Doctrine\Tests\Models\Pagination\Company c JOIN c.departments d ORDER BY c.name';
494
-        $dqlAsc  = $dql . ' ASC, d.name';
495
-        $dqlDesc = $dql . ' DESC, d.name';
494
+        $dqlAsc  = $dql.' ASC, d.name';
495
+        $dqlDesc = $dql.' DESC, d.name';
496 496
         $this->iterateWithOrderAscWithLimit(true, true, $dqlAsc, 'name');
497 497
         $this->iterateWithOrderDescWithLimit(true, true, $dqlDesc, 'name');
498 498
     }
@@ -503,8 +503,8 @@  discard block
 block discarded – undo
503 503
         $this->expectExceptionMessage('Cannot select distinct identifiers from query with LIMIT and ORDER BY on a column from a fetch joined to-many association. Use output walkers.');
504 504
 
505 505
         $dql     = 'SELECT c, d FROM Doctrine\Tests\Models\Pagination\Company c JOIN c.departments d ORDER BY c.name';
506
-        $dqlAsc  = $dql . ' ASC, d.name';
507
-        $dqlDesc = $dql . ' DESC, d.name';
506
+        $dqlAsc  = $dql.' ASC, d.name';
507
+        $dqlDesc = $dql.' DESC, d.name';
508 508
         $this->iterateWithOrderAscWithLimit(false, true, $dqlAsc, 'name');
509 509
         $this->iterateWithOrderDescWithLimit(false, true, $dqlDesc, 'name');
510 510
     }
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
         $users = iterator_to_array($paginator->getIterator());
589 589
         self::assertCount(9, $users);
590 590
         foreach ($users as $i => $user) {
591
-            self::assertEquals('username' . (8 - $i), $user->username);
591
+            self::assertEquals('username'.(8 - $i), $user->username);
592 592
         }
593 593
     }
594 594
 
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
             $company->logo->image_width  = 100 + $i;
739 739
             $company->logo->image_height = 100 + $i;
740 740
             $company->logo->company      = $company;
741
-            for ($j=0; $j<3; $j++) {
741
+            for ($j = 0; $j < 3; $j++) {
742 742
                 $department             = new Department();
743 743
                 $department->name       = sprintf('name%d%d', $i, $j);
744 744
                 $department->company    = $company;
Please login to merge, or discard this patch.
tests/Doctrine/Tests/ORM/Functional/TypeValueSqlTest.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
         $entity = $this->em->find('\Doctrine\Tests\Models\CustomType\CustomTypeUpperCase', $id);
48 48
 
49 49
         self::assertEquals('foo', $entity->lowerCaseString, 'Entity holds lowercase string');
50
-        self::assertEquals('FOO', $this->em->getConnection()->fetchColumn('select lowerCaseString from customtype_uppercases where id=' . $entity->id . ''), 'Database holds uppercase string');
50
+        self::assertEquals('FOO', $this->em->getConnection()->fetchColumn('select lowerCaseString from customtype_uppercases where id='.$entity->id.''), 'Database holds uppercase string');
51 51
     }
52 52
 
53 53
     /**
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 
69 69
         $entity = $this->em->find('\Doctrine\Tests\Models\CustomType\CustomTypeUpperCase', $id);
70 70
         self::assertEquals('foo', $entity->namedLowerCaseString, 'Entity holds lowercase string');
71
-        self::assertEquals('FOO', $this->em->getConnection()->fetchColumn('select named_lower_case_string from customtype_uppercases where id=' . $entity->id . ''), 'Database holds uppercase string');
71
+        self::assertEquals('FOO', $this->em->getConnection()->fetchColumn('select named_lower_case_string from customtype_uppercases where id='.$entity->id.''), 'Database holds uppercase string');
72 72
 
73 73
         $entity->namedLowerCaseString = 'bar';
74 74
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 
82 82
         $entity = $this->em->find('\Doctrine\Tests\Models\CustomType\CustomTypeUpperCase', $id);
83 83
         self::assertEquals('bar', $entity->namedLowerCaseString, 'Entity holds lowercase string');
84
-        self::assertEquals('BAR', $this->em->getConnection()->fetchColumn('select named_lower_case_string from customtype_uppercases where id=' . $entity->id . ''), 'Database holds uppercase string');
84
+        self::assertEquals('BAR', $this->em->getConnection()->fetchColumn('select named_lower_case_string from customtype_uppercases where id='.$entity->id.''), 'Database holds uppercase string');
85 85
     }
86 86
 
87 87
     public function testTypeValueSqlWithAssociations() : void
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
         $entity = $this->em->find(CustomTypeParent::class, $parentId);
109 109
 
110 110
         self::assertTrue($entity->customInteger < 0, 'Fetched customInteger negative');
111
-        self::assertEquals(1, $this->em->getConnection()->fetchColumn('select customInteger from customtype_parents where id=' . $entity->id . ''), 'Database has stored customInteger positive');
111
+        self::assertEquals(1, $this->em->getConnection()->fetchColumn('select customInteger from customtype_parents where id='.$entity->id.''), 'Database has stored customInteger positive');
112 112
 
113 113
         self::assertNotNull($parent->child, 'Child attached');
114 114
         self::assertCount(2, $entity->getMyFriends(), '2 friends attached');
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 
128 128
         $this->em->clear();
129 129
 
130
-        $query = $this->em->createQuery('SELECT p, p.customInteger, c from Doctrine\Tests\Models\CustomType\CustomTypeParent p JOIN p.child c where p.id = ' . $parentId);
130
+        $query = $this->em->createQuery('SELECT p, p.customInteger, c from Doctrine\Tests\Models\CustomType\CustomTypeParent p JOIN p.child c where p.id = '.$parentId);
131 131
 
132 132
         $result = $query->getResult();
133 133
 
Please login to merge, or discard this patch.
tests/Doctrine/Tests/ORM/Functional/DatabaseDriverTestCase.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
         $driver = new DatabaseDriver($sm);
63 63
 
64 64
         foreach ($driver->getAllClassNames() as $className) {
65
-            if (! in_array(strtolower($className), $classNames, true)) {
65
+            if ( ! in_array(strtolower($className), $classNames, true)) {
66 66
                 continue;
67 67
             }
68 68
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
         }
75 75
 
76 76
         if (count($metadatas) !== count($classNames)) {
77
-            $this->fail("Have not found all classes matching the names '" . implode(', ', $classNames) . "' only tables " . implode(', ', array_keys($metadatas)));
77
+            $this->fail("Have not found all classes matching the names '".implode(', ', $classNames)."' only tables ".implode(', ', array_keys($metadatas)));
78 78
         }
79 79
         return $metadatas;
80 80
     }
Please login to merge, or discard this patch.
tests/Doctrine/Tests/ORM/Functional/SecondLevelCacheQueryCacheTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -804,7 +804,7 @@
 block discarded – undo
804 804
         $this->secondLevelCacheLogger->clearStats();
805 805
         $this->em->clear();
806 806
 
807
-        $getHash = function (AbstractQuery $query) {
807
+        $getHash = function(AbstractQuery $query) {
808 808
             $method = new \ReflectionMethod($query, 'getHash');
809 809
             $method->setAccessible(true);
810 810
 
Please login to merge, or discard this patch.
tests/Doctrine/Tests/ORM/Functional/SingleTableInheritanceTest.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 
234 234
         $contracts = $this->em->createQuery('SELECT c FROM Doctrine\Tests\Models\Company\CompanyContract c ORDER BY c.id')->getScalarResult();
235 235
 
236
-        $discrValues = array_map(function ($a) {
236
+        $discrValues = array_map(function($a) {
237 237
             return $a['c_discr'];
238 238
         }, $contracts);
239 239
 
@@ -335,19 +335,19 @@  discard block
 block discarded – undo
335 335
 
336 336
         $repos     = $this->em->getRepository(CompanyContract::class);
337 337
         $contracts = $repos->findBy(['salesPerson' => $this->salesPerson->getId()]);
338
-        self::assertCount(3, $contracts, 'There should be 3 entities related to ' . $this->salesPerson->getId() . " for 'Doctrine\Tests\Models\Company\CompanyContract'");
338
+        self::assertCount(3, $contracts, 'There should be 3 entities related to '.$this->salesPerson->getId()." for 'Doctrine\Tests\Models\Company\CompanyContract'");
339 339
 
340 340
         $repos     = $this->em->getRepository(CompanyFixContract::class);
341 341
         $contracts = $repos->findBy(['salesPerson' => $this->salesPerson->getId()]);
342
-        self::assertCount(1, $contracts, 'There should be 1 entities related to ' . $this->salesPerson->getId() . " for 'Doctrine\Tests\Models\Company\CompanyFixContract'");
342
+        self::assertCount(1, $contracts, 'There should be 1 entities related to '.$this->salesPerson->getId()." for 'Doctrine\Tests\Models\Company\CompanyFixContract'");
343 343
 
344 344
         $repos     = $this->em->getRepository(CompanyFlexContract::class);
345 345
         $contracts = $repos->findBy(['salesPerson' => $this->salesPerson->getId()]);
346
-        self::assertCount(2, $contracts, 'There should be 2 entities related to ' . $this->salesPerson->getId() . " for 'Doctrine\Tests\Models\Company\CompanyFlexContract'");
346
+        self::assertCount(2, $contracts, 'There should be 2 entities related to '.$this->salesPerson->getId()." for 'Doctrine\Tests\Models\Company\CompanyFlexContract'");
347 347
 
348 348
         $repos     = $this->em->getRepository(CompanyFlexUltraContract::class);
349 349
         $contracts = $repos->findBy(['salesPerson' => $this->salesPerson->getId()]);
350
-        self::assertCount(1, $contracts, 'There should be 1 entities related to ' . $this->salesPerson->getId() . " for 'Doctrine\Tests\Models\Company\CompanyFlexUltraContract'");
350
+        self::assertCount(1, $contracts, 'There should be 1 entities related to '.$this->salesPerson->getId()." for 'Doctrine\Tests\Models\Company\CompanyFlexUltraContract'");
351 351
     }
352 352
 
353 353
     /**
Please login to merge, or discard this patch.
tests/Doctrine/Tests/ORM/Functional/Locking/GearmanLockTest.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 
24 24
     protected function setUp() : void
25 25
     {
26
-        if (! class_exists('GearmanClient', false)) {
26
+        if ( ! class_exists('GearmanClient', false)) {
27 27
             $this->markTestSkipped('pecl/gearman is required for this test to run.');
28 28
         }
29 29
 
@@ -140,13 +140,13 @@  discard block
 block discarded – undo
140 140
 
141 141
         self::assertTrue(
142 142
             $this->maxRunTime > $forTime,
143
-            'Because of locking this tests should have run at least ' . $forTime . ' seconds, ' .
144
-            'but only did for ' . $this->maxRunTime . ' seconds.'
143
+            'Because of locking this tests should have run at least '.$forTime.' seconds, '.
144
+            'but only did for '.$this->maxRunTime.' seconds.'
145 145
         );
146 146
         self::assertTrue(
147 147
             $this->maxRunTime < $notLongerThan,
148
-            'The longest task should not run longer than ' . $notLongerThan . ' seconds, ' .
149
-            'but did for ' . $this->maxRunTime . ' seconds.'
148
+            'The longest task should not run longer than '.$notLongerThan.' seconds, '.
149
+            'but did for '.$this->maxRunTime.' seconds.'
150 150
         );
151 151
     }
152 152
 
Please login to merge, or discard this patch.
tests/Doctrine/Tests/ORM/Functional/Locking/OptimisticTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
         $test = new OptimisticStandard();
121 121
 
122 122
         for ($i = 0; $i < 5; $i++) {
123
-            $test->name = 'test' . $i;
123
+            $test->name = 'test'.$i;
124 124
 
125 125
             $this->em->persist($test);
126 126
             $this->em->flush();
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
         $caughtException = null;
253 253
 
254 254
         try {
255
-            $expectedVersionExpired = DateTime::createFromFormat('U', (string) ($test->version->getTimestamp()-3600));
255
+            $expectedVersionExpired = DateTime::createFromFormat('U', (string) ($test->version->getTimestamp() - 3600));
256 256
 
257 257
             $this->em->lock($test, LockMode::OPTIMISTIC, $expectedVersionExpired);
258 258
         } catch (OptimisticLockException $e) {
Please login to merge, or discard this patch.
tests/Doctrine/Tests/ORM/Functional/Locking/LockAgentWorker.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 
34 34
         while ($worker->work()) {
35 35
             if ($worker->returnCode() !== GEARMAN_SUCCESS) {
36
-                echo 'return_code: ' . $worker->returnCode() . "\n";
36
+                echo 'return_code: '.$worker->returnCode()."\n";
37 37
                 break;
38 38
             }
39 39
         }
@@ -58,14 +58,14 @@  discard block
 block discarded – undo
58 58
 
59 59
     public function findWithLock($job)
60 60
     {
61
-        return $this->process($job, function ($fixture, $em) {
61
+        return $this->process($job, function($fixture, $em) {
62 62
             $entity = $em->find($fixture['entityName'], $fixture['entityId'], $fixture['lockMode']);
63 63
         });
64 64
     }
65 65
 
66 66
     public function dqlWithLock($job)
67 67
     {
68
-        return $this->process($job, function ($fixture, $em) {
68
+        return $this->process($job, function($fixture, $em) {
69 69
             /** @var Doctrine\ORM\Query $query */
70 70
             $query = $em->createQuery($fixture['dql']);
71 71
             $query->setLockMode($fixture['lockMode']);
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 
77 77
     public function lock($job)
78 78
     {
79
-        return $this->process($job, function ($fixture, $em) {
79
+        return $this->process($job, function($fixture, $em) {
80 80
             $entity = $em->find($fixture['entityName'], $fixture['entityId']);
81 81
             $em->lock($entity, $fixture['lockMode']);
82 82
         });
@@ -84,18 +84,18 @@  discard block
 block discarded – undo
84 84
 
85 85
     protected function processWorkload($job)
86 86
     {
87
-        echo 'Received job: ' . $job->handle() . ' for function ' . $job->functionName() . "\n";
87
+        echo 'Received job: '.$job->handle().' for function '.$job->functionName()."\n";
88 88
 
89 89
         $workload = $job->workload();
90 90
         $workload = unserialize($workload);
91 91
 
92
-        if (! isset($workload['conn']) || ! is_array($workload['conn'])) {
92
+        if ( ! isset($workload['conn']) || ! is_array($workload['conn'])) {
93 93
             throw new \InvalidArgumentException('Missing Database parameters');
94 94
         }
95 95
 
96 96
         $this->em = $this->createEntityManager($workload['conn']);
97 97
 
98
-        if (! isset($workload['fixture'])) {
98
+        if ( ! isset($workload['fixture'])) {
99 99
             throw new \InvalidArgumentException('Missing Fixture parameters');
100 100
         }
101 101
         return $workload['fixture'];
@@ -104,11 +104,11 @@  discard block
 block discarded – undo
104 104
     protected function createEntityManager($conn)
105 105
     {
106 106
         $config = new Configuration();
107
-        $config->setProxyDir(__DIR__ . '/../../../Proxies');
107
+        $config->setProxyDir(__DIR__.'/../../../Proxies');
108 108
         $config->setProxyNamespace('MyProject\Proxies');
109 109
         $config->setAutoGenerateProxyClasses(true);
110 110
 
111
-        $annotDriver = $config->newDefaultAnnotationDriver([__DIR__ . '/../../../Models/']);
111
+        $annotDriver = $config->newDefaultAnnotationDriver([__DIR__.'/../../../Models/']);
112 112
         $config->setMetadataDriverImpl($annotDriver);
113 113
 
114 114
         $cache = new ArrayCache();
Please login to merge, or discard this patch.