@@ -16,7 +16,7 @@ |
||
16 | 16 | */ |
17 | 17 | class ResultCacheTest extends OrmFunctionalTestCase |
18 | 18 | { |
19 | - /** |
|
19 | + /** |
|
20 | 20 | * @var \ReflectionProperty |
21 | 21 | */ |
22 | 22 | private $cacheDataReflection; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | parent::setUp(); |
25 | 25 | $this->_factory = new ProxyFactory( |
26 | 26 | $this->_em, |
27 | - __DIR__ . '/../../Proxies', |
|
27 | + __DIR__.'/../../Proxies', |
|
28 | 28 | 'Doctrine\Tests\Proxies', |
29 | 29 | true); |
30 | 30 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | { |
69 | 69 | $id = $this->createProduct(); |
70 | 70 | |
71 | - $entity = $this->_em->getReference(ECommerceProduct::class , $id); |
|
71 | + $entity = $this->_em->getReference(ECommerceProduct::class, $id); |
|
72 | 72 | $class = $this->_em->getClassMetadata(get_class($entity)); |
73 | 73 | |
74 | 74 | $this->assertEquals(ECommerceProduct::class, $class->name); |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | { |
82 | 82 | $id = $this->createProduct(); |
83 | 83 | |
84 | - $entity = $this->_em->getReference(ECommerceProduct::class , $id); |
|
85 | - $entity2 = $this->_em->find(ECommerceProduct::class , $id); |
|
84 | + $entity = $this->_em->getReference(ECommerceProduct::class, $id); |
|
85 | + $entity2 = $this->_em->find(ECommerceProduct::class, $id); |
|
86 | 86 | |
87 | 87 | $this->assertSame($entity, $entity2); |
88 | 88 | $this->assertEquals('Doctrine Cookbook', $entity2->getName()); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $id = $this->createProduct(); |
97 | 97 | |
98 | 98 | /* @var $entity ECommerceProduct */ |
99 | - $entity = $this->_em->getReference(ECommerceProduct::class , $id); |
|
99 | + $entity = $this->_em->getReference(ECommerceProduct::class, $id); |
|
100 | 100 | |
101 | 101 | /* @var $clone ECommerceProduct */ |
102 | 102 | $clone = clone $entity; |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | $id = $this->createProduct(); |
122 | 122 | |
123 | 123 | /* @var $entity ECommerceProduct */ |
124 | - $entity = $this->_em->getReference(ECommerceProduct::class , $id); |
|
124 | + $entity = $this->_em->getReference(ECommerceProduct::class, $id); |
|
125 | 125 | |
126 | 126 | $this->assertFalse($entity->__isInitialized__, "Pre-Condition: Object is unitialized proxy."); |
127 | 127 | $this->_em->getUnitOfWork()->initializeObject($entity); |
@@ -136,13 +136,13 @@ discard block |
||
136 | 136 | $id = $this->createProduct(); |
137 | 137 | |
138 | 138 | /* @var $entity ECommerceProduct */ |
139 | - $entity = $this->_em->getReference(ECommerceProduct::class , $id); |
|
139 | + $entity = $this->_em->getReference(ECommerceProduct::class, $id); |
|
140 | 140 | $entity->setName('Doctrine 2 Cookbook'); |
141 | 141 | |
142 | 142 | $this->_em->flush(); |
143 | 143 | $this->_em->clear(); |
144 | 144 | |
145 | - $entity = $this->_em->getReference(ECommerceProduct::class , $id); |
|
145 | + $entity = $this->_em->getReference(ECommerceProduct::class, $id); |
|
146 | 146 | $this->assertEquals('Doctrine 2 Cookbook', $entity->getName()); |
147 | 147 | } |
148 | 148 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | $id = $this->createProduct(); |
155 | 155 | |
156 | 156 | /* @var $entity ECommerceProduct */ |
157 | - $entity = $this->_em->getReference(ECommerceProduct::class , $id); |
|
157 | + $entity = $this->_em->getReference(ECommerceProduct::class, $id); |
|
158 | 158 | |
159 | 159 | $this->assertFalse($entity->wakeUp); |
160 | 160 | |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | $id = $this->createProduct(); |
169 | 169 | |
170 | 170 | /* @var $entity ECommerceProduct */ |
171 | - $entity = $this->_em->getReference(ECommerceProduct::class , $id); |
|
171 | + $entity = $this->_em->getReference(ECommerceProduct::class, $id); |
|
172 | 172 | |
173 | 173 | $this->assertFalse($entity->__isInitialized__, "Pre-Condition: Object is unitialized proxy."); |
174 | 174 | $this->assertEquals($id, $entity->getId()); |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | $id = $this->createAuction(); |
184 | 184 | |
185 | 185 | /* @var $entity CompanyAuction */ |
186 | - $entity = $this->_em->getReference(CompanyAuction::class , $id); |
|
186 | + $entity = $this->_em->getReference(CompanyAuction::class, $id); |
|
187 | 187 | |
188 | 188 | $this->assertFalse($entity->__isInitialized__, "Pre-Condition: Object is unitialized proxy."); |
189 | 189 | $this->assertEquals($id, $entity->getId()); |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | $id = $this->createProduct(); |
219 | 219 | |
220 | 220 | /* @var $entity ECommerceProduct */ |
221 | - $entity = $this->_em->getReference(ECommerceProduct::class , $id); |
|
221 | + $entity = $this->_em->getReference(ECommerceProduct::class, $id); |
|
222 | 222 | |
223 | 223 | $this->assertFalse($entity->__isInitialized__, "Pre-Condition: Object is unitialized proxy."); |
224 | 224 | $this->assertEquals('Doctrine Cookbook', $entity->getName()); |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | $id = $this->createProduct(); |
234 | 234 | |
235 | 235 | /* @var $entity ECommerceProduct */ |
236 | - $entity = $this->_em->getReference(ECommerceProduct::class , $id); |
|
236 | + $entity = $this->_em->getReference(ECommerceProduct::class, $id); |
|
237 | 237 | $className = ClassUtils::getClass($entity); |
238 | 238 | |
239 | 239 | $this->assertInstanceOf(Proxy::class, $entity); |
@@ -241,8 +241,8 @@ discard block |
||
241 | 241 | $this->assertEquals(ECommerceProduct::class, $className); |
242 | 242 | |
243 | 243 | $restName = str_replace($this->_em->getConfiguration()->getProxyNamespace(), "", get_class($entity)); |
244 | - $restName = substr(get_class($entity), strlen($this->_em->getConfiguration()->getProxyNamespace()) +1); |
|
245 | - $proxyFileName = $this->_em->getConfiguration()->getProxyDir() . DIRECTORY_SEPARATOR . str_replace("\\", "", $restName) . ".php"; |
|
244 | + $restName = substr(get_class($entity), strlen($this->_em->getConfiguration()->getProxyNamespace()) + 1); |
|
245 | + $proxyFileName = $this->_em->getConfiguration()->getProxyDir().DIRECTORY_SEPARATOR.str_replace("\\", "", $restName).".php"; |
|
246 | 246 | $this->assertTrue(file_exists($proxyFileName), "Proxy file name cannot be found generically."); |
247 | 247 | |
248 | 248 | $entity->__load(); |
@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | $worker->addFunction("dqlWithLock", [$lockAgent, "dqlWithLock"]); |
25 | 25 | $worker->addFunction('lock', [$lockAgent, 'lock']); |
26 | 26 | |
27 | - while($worker->work()) { |
|
27 | + while ($worker->work()) { |
|
28 | 28 | if ($worker->returnCode() != GEARMAN_SUCCESS) { |
29 | - echo "return_code: " . $worker->returnCode() . "\n"; |
|
29 | + echo "return_code: ".$worker->returnCode()."\n"; |
|
30 | 30 | break; |
31 | 31 | } |
32 | 32 | } |
@@ -77,18 +77,18 @@ discard block |
||
77 | 77 | |
78 | 78 | protected function processWorkload($job) |
79 | 79 | { |
80 | - echo "Received job: " . $job->handle() . " for function " . $job->functionName() . "\n"; |
|
80 | + echo "Received job: ".$job->handle()." for function ".$job->functionName()."\n"; |
|
81 | 81 | |
82 | 82 | $workload = $job->workload(); |
83 | 83 | $workload = unserialize($workload); |
84 | 84 | |
85 | - if (!isset($workload['conn']) || !is_array($workload['conn'])) { |
|
85 | + if ( ! isset($workload['conn']) || ! is_array($workload['conn'])) { |
|
86 | 86 | throw new \InvalidArgumentException("Missing Database parameters"); |
87 | 87 | } |
88 | 88 | |
89 | 89 | $this->em = $this->createEntityManager($workload['conn']); |
90 | 90 | |
91 | - if (!isset($workload['fixture'])) { |
|
91 | + if ( ! isset($workload['fixture'])) { |
|
92 | 92 | throw new \InvalidArgumentException("Missing Fixture parameters"); |
93 | 93 | } |
94 | 94 | return $workload['fixture']; |
@@ -97,11 +97,11 @@ discard block |
||
97 | 97 | protected function createEntityManager($conn) |
98 | 98 | { |
99 | 99 | $config = new Configuration(); |
100 | - $config->setProxyDir(__DIR__ . '/../../../Proxies'); |
|
100 | + $config->setProxyDir(__DIR__.'/../../../Proxies'); |
|
101 | 101 | $config->setProxyNamespace('MyProject\Proxies'); |
102 | 102 | $config->setAutoGenerateProxyClasses(true); |
103 | 103 | |
104 | - $annotDriver = $config->newDefaultAnnotationDriver([__DIR__ . '/../../../Models/'], true); |
|
104 | + $annotDriver = $config->newDefaultAnnotationDriver([__DIR__.'/../../../Models/'], true); |
|
105 | 105 | $config->setMetadataDriverImpl($annotDriver); |
106 | 106 | |
107 | 107 | $cache = new ArrayCache(); |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | |
18 | 18 | protected function setUp() |
19 | 19 | { |
20 | - if (!class_exists('GearmanClient', false)) { |
|
20 | + if ( ! class_exists('GearmanClient', false)) { |
|
21 | 21 | $this->markTestSkipped('pecl/gearman is required for this test to run.'); |
22 | 22 | } |
23 | 23 | |
@@ -133,11 +133,11 @@ discard block |
||
133 | 133 | $this->gearman->runTasks(); |
134 | 134 | |
135 | 135 | $this->assertTrue($this->maxRunTime > $forTime, |
136 | - "Because of locking this tests should have run at least " . $forTime . " seconds, ". |
|
137 | - "but only did for " . $this->maxRunTime . " seconds."); |
|
136 | + "Because of locking this tests should have run at least ".$forTime." seconds, ". |
|
137 | + "but only did for ".$this->maxRunTime." seconds."); |
|
138 | 138 | $this->assertTrue($this->maxRunTime < $notLongerThan, |
139 | - "The longest task should not run longer than " . $notLongerThan . " seconds, ". |
|
140 | - "but did for " . $this->maxRunTime . " seconds." |
|
139 | + "The longest task should not run longer than ".$notLongerThan." seconds, ". |
|
140 | + "but did for ".$this->maxRunTime." seconds." |
|
141 | 141 | ); |
142 | 142 | } |
143 | 143 |
@@ -206,7 +206,7 @@ |
||
206 | 206 | $this->expectExceptionMessage('The optimistic lock on an entity failed.'); |
207 | 207 | |
208 | 208 | $this->_em->createQuery($dql) |
209 | - ->setHint(Query::HINT_LOCK_MODE, LockMode::OPTIMISTIC) |
|
210 | - ->getSQL(); |
|
209 | + ->setHint(Query::HINT_LOCK_MODE, LockMode::OPTIMISTIC) |
|
210 | + ->getSQL(); |
|
211 | 211 | } |
212 | 212 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $article = new CmsArticle(); |
88 | 88 | |
89 | 89 | $this->expectException(\InvalidArgumentException::class); |
90 | - $this->expectExceptionMessage('Entity ' . CmsArticle::class); |
|
90 | + $this->expectExceptionMessage('Entity '.CmsArticle::class); |
|
91 | 91 | |
92 | 92 | $this->_em->lock($article, LockMode::OPTIMISTIC, $article->version + 1); |
93 | 93 | } |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | { |
137 | 137 | $writeLockSql = $this->_em->getConnection()->getDatabasePlatform()->getWriteLockSQL(); |
138 | 138 | |
139 | - if (! $writeLockSql) { |
|
139 | + if ( ! $writeLockSql) { |
|
140 | 140 | $this->markTestSkipped('Database Driver has no Write Lock support.'); |
141 | 141 | } |
142 | 142 | |
@@ -156,8 +156,8 @@ discard block |
||
156 | 156 | throw $e; |
157 | 157 | } |
158 | 158 | |
159 | - $query = array_pop( $this->_sqlLoggerStack->queries ); |
|
160 | - $query = array_pop( $this->_sqlLoggerStack->queries ); |
|
159 | + $query = array_pop($this->_sqlLoggerStack->queries); |
|
160 | + $query = array_pop($this->_sqlLoggerStack->queries); |
|
161 | 161 | $this->assertContains($writeLockSql, $query['sql']); |
162 | 162 | } |
163 | 163 | |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | { |
169 | 169 | $readLockSql = $this->_em->getConnection()->getDatabasePlatform()->getReadLockSQL(); |
170 | 170 | |
171 | - if (! $readLockSql) { |
|
171 | + if ( ! $readLockSql) { |
|
172 | 172 | $this->markTestSkipped('Database Driver has no Write Lock support.'); |
173 | 173 | } |
174 | 174 | |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | */ |
201 | 201 | public function testLockOptimisticNonVersionedThrowsExceptionInDQL() |
202 | 202 | { |
203 | - $dql = "SELECT u FROM " . CmsUser::class . " u WHERE u.username = 'gblanco'"; |
|
203 | + $dql = "SELECT u FROM ".CmsUser::class." u WHERE u.username = 'gblanco'"; |
|
204 | 204 | |
205 | 205 | $this->expectException(OptimisticLockException::class); |
206 | 206 | $this->expectExceptionMessage('The optimistic lock on an entity failed.'); |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | $test = new OptimisticStandard(); |
116 | 116 | |
117 | 117 | for ($i = 0; $i < 5; $i++) { |
118 | - $test->name = 'test' . $i; |
|
118 | + $test->name = 'test'.$i; |
|
119 | 119 | |
120 | 120 | $this->_em->persist($test); |
121 | 121 | $this->_em->flush(); |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | $caughtException = null; |
250 | 250 | |
251 | 251 | try { |
252 | - $expectedVersionExpired = DateTime::createFromFormat('U', $test->version->getTimestamp()-3600); |
|
252 | + $expectedVersionExpired = DateTime::createFromFormat('U', $test->version->getTimestamp() - 3600); |
|
253 | 253 | |
254 | 254 | $this->_em->lock($test, LockMode::OPTIMISTIC, $expectedVersionExpired); |
255 | 255 | } catch (OptimisticLockException $e) { |
@@ -232,7 +232,7 @@ |
||
232 | 232 | $entity = $this->_em->find(Travel::class, $entitiId); |
233 | 233 | |
234 | 234 | $this->assertEquals(0, $entity->getVisitedCities()->count()); |
235 | - $this->assertEquals($queryCount+2, $this->getCurrentQueryCount()); |
|
235 | + $this->assertEquals($queryCount + 2, $this->getCurrentQueryCount()); |
|
236 | 236 | |
237 | 237 | $this->_em->clear(); |
238 | 238 |
@@ -102,8 +102,8 @@ |
||
102 | 102 | $routeId = $this->createPersistedRouteWithLegs(); |
103 | 103 | |
104 | 104 | $route = $this->_em->createQuery("SELECT r, l FROM Doctrine\Tests\Models\Routing\RoutingRoute r JOIN r.legs l WHERE r.id = ?1") |
105 | - ->setParameter(1, $routeId) |
|
106 | - ->getSingleResult(); |
|
105 | + ->setParameter(1, $routeId) |
|
106 | + ->getSingleResult(); |
|
107 | 107 | |
108 | 108 | $this->assertEquals(2, count($route->legs)); |
109 | 109 | $this->assertEquals("Berlin", $route->legs[0]->fromLocation->getName()); |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function testIssue2059() |
29 | 29 | { |
30 | - if (!$this->_em->getConnection()->getDatabasePlatform()->supportsForeignKeyConstraints()) { |
|
30 | + if ( ! $this->_em->getConnection()->getDatabasePlatform()->supportsForeignKeyConstraints()) { |
|
31 | 31 | $this->markTestSkipped('Platform does not support foreign keys.'); |
32 | 32 | } |
33 | 33 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | public function testLoadMetadataFromDatabase() |
51 | 51 | { |
52 | - if (!$this->_em->getConnection()->getDatabasePlatform()->supportsForeignKeyConstraints()) { |
|
52 | + if ( ! $this->_em->getConnection()->getDatabasePlatform()->supportsForeignKeyConstraints()) { |
|
53 | 53 | $this->markTestSkipped('Platform does not support foreign keys.'); |
54 | 54 | } |
55 | 55 | |
@@ -65,22 +65,22 @@ discard block |
||
65 | 65 | $this->assertArrayHasKey('DbdriverFoo', $metadatas); |
66 | 66 | $metadata = $metadatas['DbdriverFoo']; |
67 | 67 | |
68 | - $this->assertArrayHasKey('id', $metadata->fieldMappings); |
|
69 | - $this->assertEquals('id', $metadata->fieldMappings['id']['fieldName']); |
|
70 | - $this->assertEquals('id', strtolower($metadata->fieldMappings['id']['columnName'])); |
|
71 | - $this->assertEquals('integer', (string)$metadata->fieldMappings['id']['type']); |
|
68 | + $this->assertArrayHasKey('id', $metadata->fieldMappings); |
|
69 | + $this->assertEquals('id', $metadata->fieldMappings['id']['fieldName']); |
|
70 | + $this->assertEquals('id', strtolower($metadata->fieldMappings['id']['columnName'])); |
|
71 | + $this->assertEquals('integer', (string) $metadata->fieldMappings['id']['type']); |
|
72 | 72 | |
73 | - $this->assertArrayHasKey('bar', $metadata->fieldMappings); |
|
74 | - $this->assertEquals('bar', $metadata->fieldMappings['bar']['fieldName']); |
|
75 | - $this->assertEquals('bar', strtolower($metadata->fieldMappings['bar']['columnName'])); |
|
76 | - $this->assertEquals('string', (string)$metadata->fieldMappings['bar']['type']); |
|
77 | - $this->assertEquals(200, $metadata->fieldMappings['bar']['length']); |
|
73 | + $this->assertArrayHasKey('bar', $metadata->fieldMappings); |
|
74 | + $this->assertEquals('bar', $metadata->fieldMappings['bar']['fieldName']); |
|
75 | + $this->assertEquals('bar', strtolower($metadata->fieldMappings['bar']['columnName'])); |
|
76 | + $this->assertEquals('string', (string) $metadata->fieldMappings['bar']['type']); |
|
77 | + $this->assertEquals(200, $metadata->fieldMappings['bar']['length']); |
|
78 | 78 | $this->assertTrue($metadata->fieldMappings['bar']['nullable']); |
79 | 79 | } |
80 | 80 | |
81 | 81 | public function testLoadMetadataWithForeignKeyFromDatabase() |
82 | 82 | { |
83 | - if (!$this->_em->getConnection()->getDatabasePlatform()->supportsForeignKeyConstraints()) { |
|
83 | + if ( ! $this->_em->getConnection()->getDatabasePlatform()->supportsForeignKeyConstraints()) { |
|
84 | 84 | $this->markTestSkipped('Platform does not support foreign keys.'); |
85 | 85 | } |
86 | 86 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | |
115 | 115 | public function testDetectManyToManyTables() |
116 | 116 | { |
117 | - if (!$this->_em->getConnection()->getDatabasePlatform()->supportsForeignKeyConstraints()) { |
|
117 | + if ( ! $this->_em->getConnection()->getDatabasePlatform()->supportsForeignKeyConstraints()) { |
|
118 | 118 | $this->markTestSkipped('Platform does not support foreign keys.'); |
119 | 119 | } |
120 | 120 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | |
170 | 170 | $table->addColumn('column_index1', 'string'); |
171 | 171 | $table->addColumn('column_index2', 'string'); |
172 | - $table->addIndex(['column_index1','column_index2'], 'index1'); |
|
172 | + $table->addIndex(['column_index1', 'column_index2'], 'index1'); |
|
173 | 173 | |
174 | 174 | $table->addColumn('column_unique_index1', 'string'); |
175 | 175 | $table->addColumn('column_unique_index2', 'string'); |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | |
209 | 209 | $this->assertTrue( ! empty($metadata->table['indexes']['index1']['columns'])); |
210 | 210 | $this->assertEquals( |
211 | - ['column_index1','column_index2'], |
|
211 | + ['column_index1', 'column_index2'], |
|
212 | 212 | $metadata->table['indexes']['index1']['columns'] |
213 | 213 | ); |
214 | 214 |