@@ -227,6 +227,9 @@ discard block |
||
227 | 227 | $this->assertEquals([], $metadata); |
228 | 228 | } |
229 | 229 | |
230 | + /** |
|
231 | + * @param \PHPUnit_Framework_MockObject_MockObject $conn |
|
232 | + */ |
|
230 | 233 | protected function _createEntityManager($metadataDriver, $conn = null) |
231 | 234 | { |
232 | 235 | $driverMock = new DriverMock(); |
@@ -255,7 +258,6 @@ discard block |
||
255 | 258 | } |
256 | 259 | |
257 | 260 | /** |
258 | - * @param string $class |
|
259 | 261 | * @return ClassMetadata |
260 | 262 | */ |
261 | 263 | protected function _createValidClassMetadata() |
@@ -469,6 +471,10 @@ discard block |
||
469 | 471 | return $this->mockMetadata[$className]; |
470 | 472 | } |
471 | 473 | |
474 | + /** |
|
475 | + * @param string $className |
|
476 | + * @param ClassMetadata $metadata |
|
477 | + */ |
|
472 | 478 | public function setMetadataForClass($className, $metadata) |
473 | 479 | { |
474 | 480 | $this->mockMetadata[$className] = $metadata; |
@@ -131,13 +131,13 @@ discard block |
||
131 | 131 | $cmf = new ClassMetadataFactory(); |
132 | 132 | $driver = $this->createMock(MappingDriver::class); |
133 | 133 | $driver->expects($this->at(0)) |
134 | - ->method('isTransient') |
|
135 | - ->with($this->equalTo(CmsUser::class)) |
|
136 | - ->will($this->returnValue(true)); |
|
134 | + ->method('isTransient') |
|
135 | + ->with($this->equalTo(CmsUser::class)) |
|
136 | + ->will($this->returnValue(true)); |
|
137 | 137 | $driver->expects($this->at(1)) |
138 | - ->method('isTransient') |
|
139 | - ->with($this->equalTo(CmsArticle::class)) |
|
140 | - ->will($this->returnValue(false)); |
|
138 | + ->method('isTransient') |
|
139 | + ->with($this->equalTo(CmsArticle::class)) |
|
140 | + ->will($this->returnValue(false)); |
|
141 | 141 | |
142 | 142 | $em = $this->_createEntityManager($driver); |
143 | 143 | |
@@ -153,13 +153,13 @@ discard block |
||
153 | 153 | $cmf = new ClassMetadataFactory(); |
154 | 154 | $driver = $this->createMock(MappingDriver::class); |
155 | 155 | $driver->expects($this->at(0)) |
156 | - ->method('isTransient') |
|
157 | - ->with($this->equalTo(CmsUser::class)) |
|
158 | - ->will($this->returnValue(true)); |
|
156 | + ->method('isTransient') |
|
157 | + ->with($this->equalTo(CmsUser::class)) |
|
158 | + ->will($this->returnValue(true)); |
|
159 | 159 | $driver->expects($this->at(1)) |
160 | - ->method('isTransient') |
|
161 | - ->with($this->equalTo(CmsArticle::class)) |
|
162 | - ->will($this->returnValue(false)); |
|
160 | + ->method('isTransient') |
|
161 | + ->with($this->equalTo(CmsArticle::class)) |
|
162 | + ->will($this->returnValue(false)); |
|
163 | 163 | |
164 | 164 | $em = $this->_createEntityManager($driver); |
165 | 165 | $em->getConfiguration()->addEntityNamespace('CMS', 'Doctrine\Tests\Models\CMS'); |
@@ -283,8 +283,8 @@ discard block |
||
283 | 283 | } |
284 | 284 | |
285 | 285 | /** |
286 | - * @group DDC-1845 |
|
287 | - */ |
|
286 | + * @group DDC-1845 |
|
287 | + */ |
|
288 | 288 | public function testQuoteMetadata() |
289 | 289 | { |
290 | 290 | $cmf = new ClassMetadataFactory(); |
@@ -108,15 +108,15 @@ discard block |
||
108 | 108 | { |
109 | 109 | require_once __DIR__."/../../Models/Global/GlobalNamespaceModel.php"; |
110 | 110 | |
111 | - $metadataDriver = $this->createAnnotationDriver([__DIR__ . '/../../Models/Global/']); |
|
111 | + $metadataDriver = $this->createAnnotationDriver([__DIR__.'/../../Models/Global/']); |
|
112 | 112 | |
113 | 113 | $entityManager = $this->_createEntityManager($metadataDriver); |
114 | 114 | |
115 | 115 | $mf = $entityManager->getMetadataFactory(); |
116 | 116 | $m1 = $mf->getMetadataFor(DoctrineGlobal_Article::class); |
117 | 117 | $h1 = $mf->hasMetadataFor(DoctrineGlobal_Article::class); |
118 | - $h2 = $mf->hasMetadataFor('\\' . DoctrineGlobal_Article::class); |
|
119 | - $m2 = $mf->getMetadataFor('\\' . DoctrineGlobal_Article::class); |
|
118 | + $h2 = $mf->hasMetadataFor('\\'.DoctrineGlobal_Article::class); |
|
119 | + $m2 = $mf->getMetadataFor('\\'.DoctrineGlobal_Article::class); |
|
120 | 120 | |
121 | 121 | $this->assertNotSame($m1, $m2); |
122 | 122 | $this->assertFalse($h2); |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | public function testAddDefaultDiscriminatorMap() |
172 | 172 | { |
173 | 173 | $cmf = new ClassMetadataFactory(); |
174 | - $driver = $this->createAnnotationDriver([__DIR__ . '/../../Models/JoinedInheritanceType/']); |
|
174 | + $driver = $this->createAnnotationDriver([__DIR__.'/../../Models/JoinedInheritanceType/']); |
|
175 | 175 | $em = $this->_createEntityManager($driver); |
176 | 176 | $cmf->setEntityManager($em); |
177 | 177 | |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | { |
212 | 212 | // DDC-3551 |
213 | 213 | $conn = $this->createMock(Connection::class); |
214 | - $mockDriver = new MetadataDriverMock(); |
|
214 | + $mockDriver = new MetadataDriverMock(); |
|
215 | 215 | $em = $this->_createEntityManager($mockDriver, $conn); |
216 | 216 | |
217 | 217 | $conn->expects($this->any()) |
@@ -231,10 +231,10 @@ discard block |
||
231 | 231 | { |
232 | 232 | $driverMock = new DriverMock(); |
233 | 233 | $config = new Configuration(); |
234 | - $config->setProxyDir(__DIR__ . '/../../Proxies'); |
|
234 | + $config->setProxyDir(__DIR__.'/../../Proxies'); |
|
235 | 235 | $config->setProxyNamespace('Doctrine\Tests\Proxies'); |
236 | 236 | $eventManager = new EventManager(); |
237 | - if (!$conn) { |
|
237 | + if ( ! $conn) { |
|
238 | 238 | $conn = new ConnectionMock([], $driverMock, $config, $eventManager); |
239 | 239 | } |
240 | 240 | $config->setMetadataDriverImpl($metadataDriver); |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | public function testQuoteMetadata() |
289 | 289 | { |
290 | 290 | $cmf = new ClassMetadataFactory(); |
291 | - $driver = $this->createAnnotationDriver([__DIR__ . '/../../Models/Quote/']); |
|
291 | + $driver = $this->createAnnotationDriver([__DIR__.'/../../Models/Quote/']); |
|
292 | 292 | $em = $this->_createEntityManager($driver); |
293 | 293 | $cmf->setEntityManager($em); |
294 | 294 | |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | $listener |
384 | 384 | ->expects($this->any()) |
385 | 385 | ->method('onClassMetadataNotFound') |
386 | - ->will($this->returnCallback(function (OnClassMetadataNotFoundEventArgs $args) use ($metadata, $em, $test) { |
|
386 | + ->will($this->returnCallback(function(OnClassMetadataNotFoundEventArgs $args) use ($metadata, $em, $test) { |
|
387 | 387 | $test->assertNull($args->getFoundMetadata()); |
388 | 388 | $test->assertSame('Foo', $args->getClassName()); |
389 | 389 | $test->assertSame($em, $args->getObjectManager()); |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | public function testInheritsIdGeneratorMappingFromEmbeddable() |
444 | 444 | { |
445 | 445 | $cmf = new ClassMetadataFactory(); |
446 | - $driver = $this->createAnnotationDriver([__DIR__ . '/../../Models/DDC4006/']); |
|
446 | + $driver = $this->createAnnotationDriver([__DIR__.'/../../Models/DDC4006/']); |
|
447 | 447 | $em = $this->_createEntityManager($driver); |
448 | 448 | $cmf->setEntityManager($em); |
449 | 449 |
@@ -5,7 +5,6 @@ |
||
5 | 5 | use Doctrine\Instantiator\Instantiator; |
6 | 6 | use Doctrine\ORM\Mapping\ReflectionEmbeddedProperty; |
7 | 7 | use Doctrine\Tests\Models\Generic\BooleanModel; |
8 | -use Doctrine\Tests\Models\Mapping\Entity; |
|
9 | 8 | use Doctrine\Tests\Models\Reflection\AbstractEmbeddable; |
10 | 9 | use Doctrine\Tests\Models\Reflection\ArrayObjectExtendingClass; |
11 | 10 | use Doctrine\Tests\Models\Reflection\ConcreteEmbeddable; |
@@ -7,7 +7,6 @@ |
||
7 | 7 | use Doctrine\DBAL\Types\Type as DBALType; |
8 | 8 | use Doctrine\ORM\Persisters\Entity\BasicEntityPersister; |
9 | 9 | use Doctrine\Tests\Models\CustomType\CustomTypeChild; |
10 | -use Doctrine\Tests\Models\CustomType\CustomTypeFriend; |
|
11 | 10 | use Doctrine\Tests\Models\CustomType\CustomTypeParent; |
12 | 11 | use Doctrine\Tests\Models\Generic\NonAlphaColumnsEntity; |
13 | 12 | use Doctrine\Tests\OrmTestCase; |
@@ -84,7 +84,7 @@ |
||
84 | 84 | $method = new \ReflectionMethod($this->_persister, 'getSelectConditionSQL'); |
85 | 85 | $method->setAccessible(true); |
86 | 86 | |
87 | - $sql = $method->invoke($this->_persister, ['customInteger' => 1, 'child' => 1]); |
|
87 | + $sql = $method->invoke($this->_persister, ['customInteger' => 1, 'child' => 1]); |
|
88 | 88 | |
89 | 89 | $this->assertEquals('t0.customInteger = ABS(?) AND t0.child_id = ?', $sql); |
90 | 90 | } |
@@ -38,6 +38,10 @@ |
||
38 | 38 | return $query->getSql(); |
39 | 39 | } |
40 | 40 | |
41 | + /** |
|
42 | + * @param string $dqlToBeTested |
|
43 | + * @param string $sqlToBeConfirmed |
|
44 | + */ |
|
41 | 45 | public function assertSqlGeneration($dqlToBeTested, $sqlToBeConfirmed, $treeWalkers = [], $outputWalker = null) |
42 | 46 | { |
43 | 47 | try { |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | try { |
44 | 44 | $this->assertEquals($sqlToBeConfirmed, $this->generateSql($dqlToBeTested, $treeWalkers, $outputWalker)); |
45 | 45 | } catch (\Exception $e) { |
46 | - $this->fail($e->getMessage() . ' at "' . $e->getFile() . '" on line ' . $e->getLine()); |
|
46 | + $this->fail($e->getMessage().' at "'.$e->getFile().'" on line '.$e->getLine()); |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 | |
@@ -201,9 +201,9 @@ discard block |
||
201 | 201 | { |
202 | 202 | $rangeVariableDecl = $identificationVariableDecl->rangeVariableDeclaration; |
203 | 203 | $joinAssocPathExpression = new Query\AST\JoinAssociationPathExpression($rangeVariableDecl->aliasIdentificationVariable, 'address'); |
204 | - $joinAssocDeclaration = new Query\AST\JoinAssociationDeclaration($joinAssocPathExpression, $rangeVariableDecl->aliasIdentificationVariable . 'a', null); |
|
204 | + $joinAssocDeclaration = new Query\AST\JoinAssociationDeclaration($joinAssocPathExpression, $rangeVariableDecl->aliasIdentificationVariable.'a', null); |
|
205 | 205 | $join = new Query\AST\Join(Query\AST\Join::JOIN_TYPE_LEFT, $joinAssocDeclaration); |
206 | - $selectExpression = new Query\AST\SelectExpression($rangeVariableDecl->aliasIdentificationVariable . 'a', null, false); |
|
206 | + $selectExpression = new Query\AST\SelectExpression($rangeVariableDecl->aliasIdentificationVariable.'a', null, false); |
|
207 | 207 | |
208 | 208 | $identificationVariableDecl->joins[] = $join; |
209 | 209 | $selectStatement->selectClause->selectExpressions[] = $selectExpression; |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | $userMetadata = $entityManager->getClassMetadata(CmsUser::class); |
213 | 213 | $addressMetadata = $entityManager->getClassMetadata(CmsAddress::class); |
214 | 214 | |
215 | - $this->setQueryComponent($rangeVariableDecl->aliasIdentificationVariable . 'a', |
|
215 | + $this->setQueryComponent($rangeVariableDecl->aliasIdentificationVariable.'a', |
|
216 | 216 | [ |
217 | 217 | 'metadata' => $addressMetadata, |
218 | 218 | 'parent' => $rangeVariableDecl->aliasIdentificationVariable, |
@@ -43,6 +43,10 @@ |
||
43 | 43 | $this->_em = $this->_getTestEntityManager(); |
44 | 44 | } |
45 | 45 | |
46 | + /** |
|
47 | + * @param string $dqlToBeTested |
|
48 | + * @param string $sqlToBeConfirmed |
|
49 | + */ |
|
46 | 50 | public function assertSqlGeneration($dqlToBeTested, $sqlToBeConfirmed) |
47 | 51 | { |
48 | 52 | try { |
@@ -35,6 +35,9 @@ |
||
35 | 35 | $this->_em = $this->_getTestEntityManager(); |
36 | 36 | } |
37 | 37 | |
38 | + /** |
|
39 | + * @param string $expectedDql |
|
40 | + */ |
|
38 | 41 | protected function assertValidQueryBuilder(QueryBuilder $qb, $expectedDql) |
39 | 42 | { |
40 | 43 | $dql = $qb->getDQL(); |
@@ -272,12 +272,12 @@ discard block |
||
272 | 272 | { |
273 | 273 | $qb = $this->_em->createQueryBuilder(); |
274 | 274 | $qb->select('u') |
275 | - ->from(CmsUser::class, 'u') |
|
276 | - ->where('u.id = :uid') |
|
277 | - ->orWhere('u.id = :uid2') |
|
278 | - ->andWhere('u.id = :uid3') |
|
279 | - ->orWhere('u.name = :name1', 'u.name = :name2') |
|
280 | - ->andWhere('u.name <> :noname'); |
|
275 | + ->from(CmsUser::class, 'u') |
|
276 | + ->where('u.id = :uid') |
|
277 | + ->orWhere('u.id = :uid2') |
|
278 | + ->andWhere('u.id = :uid3') |
|
279 | + ->orWhere('u.name = :name1', 'u.name = :name2') |
|
280 | + ->andWhere('u.name <> :noname'); |
|
281 | 281 | |
282 | 282 | $this->assertValidQueryBuilder($qb, 'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE (((u.id = :uid OR u.id = :uid2) AND u.id = :uid3) OR u.name = :name1 OR u.name = :name2) AND u.name <> :noname'); |
283 | 283 | } |
@@ -286,9 +286,9 @@ discard block |
||
286 | 286 | { |
287 | 287 | $qb = $this->_em->createQueryBuilder(); |
288 | 288 | $qb->select('u') |
289 | - ->from(CmsUser::class, 'u') |
|
290 | - ->where('u.id = :uid') |
|
291 | - ->andWhere($qb->expr()->in('u.id', [1, 2, 3])); |
|
289 | + ->from(CmsUser::class, 'u') |
|
290 | + ->where('u.id = :uid') |
|
291 | + ->andWhere($qb->expr()->in('u.id', [1, 2, 3])); |
|
292 | 292 | |
293 | 293 | $this->assertValidQueryBuilder($qb, 'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id = :uid AND u.id IN(1, 2, 3)'); |
294 | 294 | } |
@@ -297,9 +297,9 @@ discard block |
||
297 | 297 | { |
298 | 298 | $qb = $this->_em->createQueryBuilder(); |
299 | 299 | $qb->select('u') |
300 | - ->from(CmsUser::class, 'u') |
|
301 | - ->where('u.id = :uid') |
|
302 | - ->orWhere($qb->expr()->in('u.id', [1, 2, 3])); |
|
300 | + ->from(CmsUser::class, 'u') |
|
301 | + ->where('u.id = :uid') |
|
302 | + ->orWhere($qb->expr()->in('u.id', [1, 2, 3])); |
|
303 | 303 | |
304 | 304 | $this->assertValidQueryBuilder($qb, 'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id = :uid OR u.id IN(1, 2, 3)'); |
305 | 305 | } |
@@ -308,9 +308,9 @@ discard block |
||
308 | 308 | { |
309 | 309 | $qb = $this->_em->createQueryBuilder(); |
310 | 310 | $qb->select('u') |
311 | - ->from(CmsUser::class, 'u') |
|
312 | - ->where('u.id = :uid') |
|
313 | - ->andWhere($qb->expr()->notIn('u.id', [1, 2, 3])); |
|
311 | + ->from(CmsUser::class, 'u') |
|
312 | + ->where('u.id = :uid') |
|
313 | + ->andWhere($qb->expr()->notIn('u.id', [1, 2, 3])); |
|
314 | 314 | |
315 | 315 | $this->assertValidQueryBuilder($qb, 'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id = :uid AND u.id NOT IN(1, 2, 3)'); |
316 | 316 | } |
@@ -319,9 +319,9 @@ discard block |
||
319 | 319 | { |
320 | 320 | $qb = $this->_em->createQueryBuilder(); |
321 | 321 | $qb->select('u') |
322 | - ->from(CmsUser::class, 'u') |
|
323 | - ->where('u.id = :uid') |
|
324 | - ->orWhere($qb->expr()->notIn('u.id', [1, 2, 3])); |
|
322 | + ->from(CmsUser::class, 'u') |
|
323 | + ->where('u.id = :uid') |
|
324 | + ->orWhere($qb->expr()->notIn('u.id', [1, 2, 3])); |
|
325 | 325 | |
326 | 326 | $this->assertValidQueryBuilder($qb, 'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id = :uid OR u.id NOT IN(1, 2, 3)'); |
327 | 327 | } |
@@ -617,8 +617,8 @@ discard block |
||
617 | 617 | { |
618 | 618 | $qb = $this->_em->createQueryBuilder(); |
619 | 619 | $qb->select('u') |
620 | - ->from(CmsUser::class, 'u') |
|
621 | - ->where($qb->expr()->orX('u.username = :username', 'u.username = :username2')); |
|
620 | + ->from(CmsUser::class, 'u') |
|
621 | + ->where($qb->expr()->orX('u.username = :username', 'u.username = :username2')); |
|
622 | 622 | |
623 | 623 | $parameters = new ArrayCollection(); |
624 | 624 | $parameters->add(new Parameter('username', 'jwage')); |
@@ -634,8 +634,8 @@ discard block |
||
634 | 634 | { |
635 | 635 | $qb = $this->_em->createQueryBuilder(); |
636 | 636 | $qb->select('u') |
637 | - ->from(CmsUser::class, 'u') |
|
638 | - ->where('u.id = :id'); |
|
637 | + ->from(CmsUser::class, 'u') |
|
638 | + ->where('u.id = :id'); |
|
639 | 639 | |
640 | 640 | $parameters = new ArrayCollection(); |
641 | 641 | $parameters->add(new Parameter('id', 1)); |
@@ -684,8 +684,8 @@ discard block |
||
684 | 684 | { |
685 | 685 | $qb = $this->_em->createQueryBuilder(); |
686 | 686 | $qb->select('u') |
687 | - ->from(CmsUser::class, 'u') |
|
688 | - ->orWhere('u.id = :uid', $qb->expr()->eq('u.id', ':uid2')); |
|
687 | + ->from(CmsUser::class, 'u') |
|
688 | + ->orWhere('u.id = :uid', $qb->expr()->eq('u.id', ':uid2')); |
|
689 | 689 | |
690 | 690 | $this->assertValidQueryBuilder($qb, 'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id = :uid OR u.id = :uid2'); |
691 | 691 | } |
@@ -698,8 +698,8 @@ discard block |
||
698 | 698 | $orExpr->add($qb->expr()->in('u.id', [1])); |
699 | 699 | |
700 | 700 | $qb->select('u') |
701 | - ->from(CmsUser::class, 'u') |
|
702 | - ->where($orExpr); |
|
701 | + ->from(CmsUser::class, 'u') |
|
702 | + ->where($orExpr); |
|
703 | 703 | |
704 | 704 | $this->assertValidQueryBuilder($qb, 'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id = :uid3 OR u.id IN(1)'); |
705 | 705 | } |
@@ -708,8 +708,8 @@ discard block |
||
708 | 708 | { |
709 | 709 | $qb = $this->_em->createQueryBuilder(); |
710 | 710 | $qb->select('u') |
711 | - ->from(CmsUser::class, 'u') |
|
712 | - ->where($qb->expr()->in('u.name', ['one', 'two', 'three'])); |
|
711 | + ->from(CmsUser::class, 'u') |
|
712 | + ->where($qb->expr()->in('u.name', ['one', 'two', 'three'])); |
|
713 | 713 | |
714 | 714 | $this->assertValidQueryBuilder($qb, "SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.name IN('one', 'two', 'three')"); |
715 | 715 | |
@@ -723,8 +723,8 @@ discard block |
||
723 | 723 | $qb = $this->_em->createQueryBuilder(); |
724 | 724 | $expr = $this->_em->getExpressionBuilder(); |
725 | 725 | $qb->select('u') |
726 | - ->from(CmsUser::class, 'u') |
|
727 | - ->where($expr->in('u.name', [$expr->literal('one'), $expr->literal('two'), $expr->literal('three')])); |
|
726 | + ->from(CmsUser::class, 'u') |
|
727 | + ->where($expr->in('u.name', [$expr->literal('one'), $expr->literal('two'), $expr->literal('three')])); |
|
728 | 728 | |
729 | 729 | $this->assertValidQueryBuilder($qb, "SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.name IN('one', 'two', 'three')"); |
730 | 730 | |
@@ -742,8 +742,8 @@ discard block |
||
742 | 742 | |
743 | 743 | $qb = $this->_em->createQueryBuilder(); |
744 | 744 | $qb->select('u') |
745 | - ->from(CmsUser::class, 'u') |
|
746 | - ->where($orExpr); |
|
745 | + ->from(CmsUser::class, 'u') |
|
746 | + ->where($orExpr); |
|
747 | 747 | |
748 | 748 | $this->assertValidQueryBuilder($qb, 'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id = :uid3 OR NOT(u.id IN(1))'); |
749 | 749 | } |
@@ -754,8 +754,8 @@ discard block |
||
754 | 754 | $expr = $this->_em->getExpressionBuilder(); |
755 | 755 | |
756 | 756 | $qb->select('u') |
757 | - ->from(CmsUser::class, 'u') |
|
758 | - ->where($expr->gt('u.id', $expr->all('select a.id from Doctrine\Tests\Models\CMS\CmsArticle a'))); |
|
757 | + ->from(CmsUser::class, 'u') |
|
758 | + ->where($expr->gt('u.id', $expr->all('select a.id from Doctrine\Tests\Models\CMS\CmsArticle a'))); |
|
759 | 759 | |
760 | 760 | $this->assertValidQueryBuilder($qb, 'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id > ALL(select a.id from Doctrine\Tests\Models\CMS\CmsArticle a)'); |
761 | 761 | |
@@ -1121,9 +1121,9 @@ discard block |
||
1121 | 1121 | public function testRebuildsFromParts() |
1122 | 1122 | { |
1123 | 1123 | $qb = $this->_em->createQueryBuilder() |
1124 | - ->select('u') |
|
1125 | - ->from(CmsUser::class, 'u') |
|
1126 | - ->join('u.article', 'a'); |
|
1124 | + ->select('u') |
|
1125 | + ->from(CmsUser::class, 'u') |
|
1126 | + ->join('u.article', 'a'); |
|
1127 | 1127 | |
1128 | 1128 | $dqlParts = $qb->getDQLParts(); |
1129 | 1129 | $dql = $qb->getDQL(); |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | $qb = $this->_em->createQueryBuilder(); |
548 | 548 | $qb->select('u') |
549 | 549 | ->from(CmsUser::class, 'u') |
550 | - ->join('u.article','a'); |
|
550 | + ->join('u.article', 'a'); |
|
551 | 551 | |
552 | 552 | $criteria = new Criteria(); |
553 | 553 | $criteria->orderBy(['a.field' => Criteria::DESC]); |
@@ -824,7 +824,7 @@ discard block |
||
824 | 824 | ->from(CmsUser::class, 'u') |
825 | 825 | ->where('u.username = ?1')->orderBy('u.username'); |
826 | 826 | |
827 | - $this->assertEquals('u.username = ?1', (string)$qb->getDQLPart('where')); |
|
827 | + $this->assertEquals('u.username = ?1', (string) $qb->getDQLPart('where')); |
|
828 | 828 | $this->assertEquals(1, count($qb->getDQLPart('orderBy'))); |
829 | 829 | |
830 | 830 | $qb->resetDQLPart('where')->resetDQLPart('orderBy'); |
@@ -888,7 +888,7 @@ discard block |
||
888 | 888 | { |
889 | 889 | $qb = $this->_em->createQueryBuilder(); |
890 | 890 | $qb->select('alias1')->from(CmsUser::class, 'alias1'); |
891 | - $qb->join('alias1.articles','alias2'); |
|
891 | + $qb->join('alias1.articles', 'alias2'); |
|
892 | 892 | |
893 | 893 | $criteria = new Criteria(); |
894 | 894 | $criteria->where($criteria->expr()->eq('field', 'value1')); |
@@ -908,7 +908,7 @@ discard block |
||
908 | 908 | { |
909 | 909 | $qb = $this->_em->createQueryBuilder(); |
910 | 910 | $qb->select('alias1')->from(CmsUser::class, 'alias1'); |
911 | - $qb->join('alias1.articles','alias2'); |
|
911 | + $qb->join('alias1.articles', 'alias2'); |
|
912 | 912 | |
913 | 913 | $criteria = new Criteria(); |
914 | 914 | $criteria->where($criteria->expr()->eq('alias1.field', 'value1')); |
@@ -928,7 +928,7 @@ discard block |
||
928 | 928 | { |
929 | 929 | $qb = $this->_em->createQueryBuilder(); |
930 | 930 | $qb->select('alias1')->from(CmsUser::class, 'alias1'); |
931 | - $qb->join('alias1.articles','alias2'); |
|
931 | + $qb->join('alias1.articles', 'alias2'); |
|
932 | 932 | |
933 | 933 | $criteria = new Criteria(); |
934 | 934 | $criteria->where($criteria->expr()->eq('alias1.field', 'value1')); |
@@ -1044,7 +1044,7 @@ discard block |
||
1044 | 1044 | { |
1045 | 1045 | $qb = $this->_em->createQueryBuilder() |
1046 | 1046 | ->add('select', 'u') |
1047 | - ->add('from', CmsUser::class . ' u'); |
|
1047 | + ->add('from', CmsUser::class.' u'); |
|
1048 | 1048 | |
1049 | 1049 | $this->assertEquals('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u', $qb->getDQL()); |
1050 | 1050 | } |
@@ -48,6 +48,9 @@ discard block |
||
48 | 48 | return EntityManagerMock::create($conn, $config, $eventManager); |
49 | 49 | } |
50 | 50 | |
51 | + /** |
|
52 | + * @param string $path |
|
53 | + */ |
|
51 | 54 | protected function _createMetadataDriver($type, $path) |
52 | 55 | { |
53 | 56 | $mappingDriver = [ |
@@ -67,6 +70,9 @@ discard block |
||
67 | 70 | return $driver; |
68 | 71 | } |
69 | 72 | |
73 | + /** |
|
74 | + * @param EntityManagerMock $em |
|
75 | + */ |
|
70 | 76 | protected function _createClassMetadataFactory($em, $type) |
71 | 77 | { |
72 | 78 | $factory = ($type === 'annotation') |
@@ -277,7 +283,6 @@ discard block |
||
277 | 283 | |
278 | 284 | /** |
279 | 285 | * @depends testOneToManyAssociationsAreExported |
280 | - * @param ClassMetadataInfo $metadata |
|
281 | 286 | */ |
282 | 287 | public function testManyToManyAssociationsAreExported($class) |
283 | 288 | { |
@@ -376,6 +381,9 @@ discard block |
||
376 | 381 | # $this->_deleteDirectory(__DIR__ . '/export/'.$this->_getType()); |
377 | 382 | } |
378 | 383 | |
384 | + /** |
|
385 | + * @param string $path |
|
386 | + */ |
|
379 | 387 | protected function _deleteDirectory($path) |
380 | 388 | { |
381 | 389 | if (is_file($path)) { |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | { |
40 | 40 | $driverMock = new DriverMock(); |
41 | 41 | $config = new Configuration(); |
42 | - $config->setProxyDir(__DIR__ . '/../../Proxies'); |
|
42 | + $config->setProxyDir(__DIR__.'/../../Proxies'); |
|
43 | 43 | $config->setProxyNamespace('Doctrine\Tests\Proxies'); |
44 | 44 | $eventManager = new EventManager(); |
45 | 45 | $conn = new ConnectionMock([], $driverMock, $config, $eventManager); |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | 'yaml' => YamlDriver::class, |
58 | 58 | ]; |
59 | 59 | |
60 | - $this->assertArrayHasKey($type, $mappingDriver, "There is no metadata driver for the type '" . $type . "'."); |
|
60 | + $this->assertArrayHasKey($type, $mappingDriver, "There is no metadata driver for the type '".$type."'."); |
|
61 | 61 | |
62 | 62 | $class = $mappingDriver[$type]; |
63 | 63 | $driver = ($type === 'annotation') |
@@ -80,10 +80,10 @@ discard block |
||
80 | 80 | |
81 | 81 | public function testExportDirectoryAndFilesAreCreated() |
82 | 82 | { |
83 | - $this->_deleteDirectory(__DIR__ . '/export/'.$this->_getType()); |
|
83 | + $this->_deleteDirectory(__DIR__.'/export/'.$this->_getType()); |
|
84 | 84 | |
85 | 85 | $type = $this->_getType(); |
86 | - $metadataDriver = $this->_createMetadataDriver($type, __DIR__ . '/' . $type); |
|
86 | + $metadataDriver = $this->_createMetadataDriver($type, __DIR__.'/'.$type); |
|
87 | 87 | $em = $this->_createEntityManager($metadataDriver); |
88 | 88 | $cmf = $this->_createClassMetadataFactory($em, $type); |
89 | 89 | $metadata = $cmf->getAllMetadata(); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | |
95 | 95 | $type = $this->_getType(); |
96 | 96 | $cme = new ClassMetadataExporter(); |
97 | - $exporter = $cme->getExporter($type, __DIR__ . '/export/' . $type); |
|
97 | + $exporter = $cme->getExporter($type, __DIR__.'/export/'.$type); |
|
98 | 98 | |
99 | 99 | if ($type === 'annotation') { |
100 | 100 | $entityGenerator = new EntityGenerator(); |
@@ -109,9 +109,9 @@ discard block |
||
109 | 109 | $exporter->export(); |
110 | 110 | |
111 | 111 | if ($type == 'annotation') { |
112 | - $this->assertTrue(file_exists(__DIR__ . '/export/' . $type . '/'.str_replace('\\', '/', ExportedUser::class).$this->_extension)); |
|
112 | + $this->assertTrue(file_exists(__DIR__.'/export/'.$type.'/'.str_replace('\\', '/', ExportedUser::class).$this->_extension)); |
|
113 | 113 | } else { |
114 | - $this->assertTrue(file_exists(__DIR__ . '/export/' . $type . '/Doctrine.Tests.ORM.Tools.Export.ExportedUser'.$this->_extension)); |
|
114 | + $this->assertTrue(file_exists(__DIR__.'/export/'.$type.'/Doctrine.Tests.ORM.Tools.Export.ExportedUser'.$this->_extension)); |
|
115 | 115 | } |
116 | 116 | } |
117 | 117 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | { |
123 | 123 | $type = $this->_getType(); |
124 | 124 | |
125 | - $metadataDriver = $this->_createMetadataDriver($type, __DIR__ . '/export/' . $type); |
|
125 | + $metadataDriver = $this->_createMetadataDriver($type, __DIR__.'/export/'.$type); |
|
126 | 126 | $em = $this->_createEntityManager($metadataDriver); |
127 | 127 | $cmf = $this->_createClassMetadataFactory($em, $type); |
128 | 128 | $metadata = $cmf->getAllMetadata(); |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | $type = $this->_getType(); |
209 | 209 | |
210 | 210 | if ($type == 'xml') { |
211 | - $xml = simplexml_load_file(__DIR__ . '/export/'.$type.'/Doctrine.Tests.ORM.Tools.Export.ExportedUser.dcm.xml'); |
|
211 | + $xml = simplexml_load_file(__DIR__.'/export/'.$type.'/Doctrine.Tests.ORM.Tools.Export.ExportedUser.dcm.xml'); |
|
212 | 212 | |
213 | 213 | $xml->registerXPathNamespace("d", "http://doctrine-project.org/schemas/orm/doctrine-mapping"); |
214 | 214 | $nodes = $xml->xpath("/d:doctrine-mapping/d:entity/d:field[@name='name' and @type='string' and @nullable='true']"); |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | $type = $this->_getType(); |
353 | 353 | |
354 | 354 | if ($type == 'xml') { |
355 | - $xml = simplexml_load_file(__DIR__ . '/export/'.$type.'/Doctrine.Tests.ORM.Tools.Export.ExportedUser.dcm.xml'); |
|
355 | + $xml = simplexml_load_file(__DIR__.'/export/'.$type.'/Doctrine.Tests.ORM.Tools.Export.ExportedUser.dcm.xml'); |
|
356 | 356 | |
357 | 357 | $xml->registerXPathNamespace("d", "http://doctrine-project.org/schemas/orm/doctrine-mapping"); |
358 | 358 | $nodes = $xml->xpath("/d:doctrine-mapping/d:entity/d:one-to-many[@field='interests']/d:cascade/d:*"); |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | $this->assertEquals('cascade-all', $nodes[0]->getName()); |
362 | 362 | } else if ($type == 'yaml') { |
363 | 363 | $yaml = new Parser(); |
364 | - $value = $yaml->parse(file_get_contents(__DIR__ . '/export/'.$type.'/Doctrine.Tests.ORM.Tools.Export.ExportedUser.dcm.yml')); |
|
364 | + $value = $yaml->parse(file_get_contents(__DIR__.'/export/'.$type.'/Doctrine.Tests.ORM.Tools.Export.ExportedUser.dcm.yml')); |
|
365 | 365 | |
366 | 366 | $this->assertTrue(isset($value[ExportedUser::class]['oneToMany']['interests']['cascade'])); |
367 | 367 | $this->assertEquals(1, count($value[ExportedUser::class]['oneToMany']['interests']['cascade'])); |
@@ -381,10 +381,10 @@ discard block |
||
381 | 381 | if (is_file($path)) { |
382 | 382 | return unlink($path); |
383 | 383 | } else if (is_dir($path)) { |
384 | - $files = glob(rtrim($path,'/').'/*'); |
|
384 | + $files = glob(rtrim($path, '/').'/*'); |
|
385 | 385 | |
386 | 386 | if (is_array($files)) { |
387 | - foreach ($files as $file){ |
|
387 | + foreach ($files as $file) { |
|
388 | 388 | $this->_deleteDirectory($file); |
389 | 389 | } |
390 | 390 | } |
@@ -88,8 +88,8 @@ discard block |
||
88 | 88 | // 1. Create an INSERT INTO temptable ... SELECT identifiers WHERE $AST->getWhereClause() |
89 | 89 | $sqlWalker->setSQLTableAlias($primaryClass->getTableName(), 't0', $updateClause->aliasIdentificationVariable); |
90 | 90 | |
91 | - $this->_insertSql = 'INSERT INTO ' . $tempTable . ' (' . $idColumnList . ')' |
|
92 | - . ' SELECT t0.' . implode(', t0.', $idColumnNames); |
|
91 | + $this->_insertSql = 'INSERT INTO '.$tempTable.' ('.$idColumnList.')' |
|
92 | + . ' SELECT t0.'.implode(', t0.', $idColumnNames); |
|
93 | 93 | |
94 | 94 | $rangeDecl = new AST\RangeVariableDeclaration($primaryClass->name, $updateClause->aliasIdentificationVariable); |
95 | 95 | $fromClause = new AST\FromClause([new AST\IdentificationVariableDeclaration($rangeDecl, null, [])]); |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | $this->_insertSql .= $sqlWalker->walkFromClause($fromClause); |
98 | 98 | |
99 | 99 | // 2. Create ID subselect statement used in UPDATE ... WHERE ... IN (subselect) |
100 | - $idSubselect = 'SELECT ' . $idColumnList . ' FROM ' . $tempTable; |
|
100 | + $idSubselect = 'SELECT '.$idColumnList.' FROM '.$tempTable; |
|
101 | 101 | |
102 | 102 | // 3. Create and store UPDATE statements |
103 | 103 | $classNames = array_merge($primaryClass->parentClasses, [$primaryClass->name], $primaryClass->subClasses); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | foreach (array_reverse($classNames) as $className) { |
107 | 107 | $affected = false; |
108 | 108 | $class = $em->getClassMetadata($className); |
109 | - $updateSql = 'UPDATE ' . $quoteStrategy->getTableName($class, $platform) . ' SET '; |
|
109 | + $updateSql = 'UPDATE '.$quoteStrategy->getTableName($class, $platform).' SET '; |
|
110 | 110 | |
111 | 111 | foreach ($updateItems as $updateItem) { |
112 | 112 | $field = $updateItem->pathExpression->field; |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | } |
134 | 134 | |
135 | 135 | if ($affected) { |
136 | - $this->_sqlStatements[$i] = $updateSql . ' WHERE (' . $idColumnList . ') IN (' . $idSubselect . ')'; |
|
136 | + $this->_sqlStatements[$i] = $updateSql.' WHERE ('.$idColumnList.') IN ('.$idSubselect.')'; |
|
137 | 137 | } |
138 | 138 | } |
139 | 139 | |
@@ -152,8 +152,8 @@ discard block |
||
152 | 152 | ]; |
153 | 153 | } |
154 | 154 | |
155 | - $this->_createTempTableSql = $platform->getCreateTemporaryTableSnippetSQL() . ' ' . $tempTable . ' (' |
|
156 | - . $platform->getColumnDeclarationListSQL($columnDefinitions) . ')'; |
|
155 | + $this->_createTempTableSql = $platform->getCreateTemporaryTableSnippetSQL().' '.$tempTable.' (' |
|
156 | + . $platform->getColumnDeclarationListSQL($columnDefinitions).')'; |
|
157 | 157 | |
158 | 158 | $this->_dropTempTableSql = $platform->getDropTemporaryTableSQL($tempTable); |
159 | 159 | } |
@@ -77,8 +77,8 @@ discard block |
||
77 | 77 | // 1. Create an INSERT INTO temptable ... SELECT identifiers WHERE $AST->getWhereClause() |
78 | 78 | $sqlWalker->setSQLTableAlias($primaryClass->getTableName(), 't0', $primaryDqlAlias); |
79 | 79 | |
80 | - $this->_insertSql = 'INSERT INTO ' . $tempTable . ' (' . $idColumnList . ')' |
|
81 | - . ' SELECT t0.' . implode(', t0.', $idColumnNames); |
|
80 | + $this->_insertSql = 'INSERT INTO '.$tempTable.' ('.$idColumnList.')' |
|
81 | + . ' SELECT t0.'.implode(', t0.', $idColumnNames); |
|
82 | 82 | |
83 | 83 | $rangeDecl = new AST\RangeVariableDeclaration($primaryClass->name, $primaryDqlAlias); |
84 | 84 | $fromClause = new AST\FromClause([new AST\IdentificationVariableDeclaration($rangeDecl, null, [])]); |
@@ -90,14 +90,14 @@ discard block |
||
90 | 90 | } |
91 | 91 | |
92 | 92 | // 2. Create ID subselect statement used in DELETE ... WHERE ... IN (subselect) |
93 | - $idSubselect = 'SELECT ' . $idColumnList . ' FROM ' . $tempTable; |
|
93 | + $idSubselect = 'SELECT '.$idColumnList.' FROM '.$tempTable; |
|
94 | 94 | |
95 | 95 | // 3. Create and store DELETE statements |
96 | 96 | $classNames = array_merge($primaryClass->parentClasses, [$primaryClass->name], $primaryClass->subClasses); |
97 | 97 | foreach (array_reverse($classNames) as $className) { |
98 | 98 | $tableName = $quoteStrategy->getTableName($em->getClassMetadata($className), $platform); |
99 | - $this->_sqlStatements[] = 'DELETE FROM ' . $tableName |
|
100 | - . ' WHERE (' . $idColumnList . ') IN (' . $idSubselect . ')'; |
|
99 | + $this->_sqlStatements[] = 'DELETE FROM '.$tableName |
|
100 | + . ' WHERE ('.$idColumnList.') IN ('.$idSubselect.')'; |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | // 4. Store DDL for temporary identifier table. |
@@ -108,8 +108,8 @@ discard block |
||
108 | 108 | 'type' => Type::getType(PersisterHelper::getTypeOfColumn($idColumnName, $rootClass, $em)), |
109 | 109 | ]; |
110 | 110 | } |
111 | - $this->_createTempTableSql = $platform->getCreateTemporaryTableSnippetSQL() . ' ' . $tempTable . ' (' |
|
112 | - . $platform->getColumnDeclarationListSQL($columnDefinitions) . ')'; |
|
111 | + $this->_createTempTableSql = $platform->getCreateTemporaryTableSnippetSQL().' '.$tempTable.' (' |
|
112 | + . $platform->getColumnDeclarationListSQL($columnDefinitions).')'; |
|
113 | 113 | $this->_dropTempTableSql = $platform->getDropTemporaryTableSQL($tempTable); |
114 | 114 | } |
115 | 115 |