‪TYPO3CMS  10.4
QueryBuilderTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
20 use Doctrine\DBAL\ForwardCompatibility\Result;
21 use Doctrine\DBAL\Platforms\AbstractPlatform;
22 use Doctrine\DBAL\Platforms\MySqlPlatform;
23 use Doctrine\DBAL\Platforms\OraclePlatform;
24 use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
25 use Doctrine\DBAL\Platforms\SqlitePlatform;
26 use Doctrine\DBAL\Platforms\SQLServerPlatform;
27 use Prophecy\Argument;
37 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
38 
42 class ‪QueryBuilderTest extends UnitTestCase
43 {
47  protected ‪$connection;
48 
52  protected ‪$platform;
53 
57  protected ‪$subject;
58 
62  protected ‪$concreteQueryBuilder;
63 
67  protected function ‪setUp(): void
68  {
69  parent::setUp();
70 
71  $this->concreteQueryBuilder = $this->prophesize(\Doctrine\DBAL\Query\QueryBuilder::class);
72 
73  $this->connection = $this->prophesize(Connection::class);
74  $this->connection->getDatabasePlatform()->willReturn(new ‪MockPlatform());
75 
76  $this->subject = new ‪QueryBuilder(
77  $this->connection->reveal(),
78  null,
79  $this->concreteQueryBuilder->reveal()
80  );
81  }
82 
86  public function ‪exprReturnsExpressionBuilderForConnection(): void
87  {
88  $this->connection->getExpressionBuilder()
89  ->shouldBeCalled()
90  ->willReturn(GeneralUtility::makeInstance(ExpressionBuilder::class, $this->connection->reveal()));
91 
92  $this->subject->expr();
93  }
94 
98  public function ‪getTypeDelegatesToConcreteQueryBuilder(): void
99  {
100  $this->concreteQueryBuilder->getType()
101  ->shouldBeCalled()
102  ->willReturn(\Doctrine\DBAL\Query\QueryBuilder::INSERT);
103 
104  $this->subject->getType();
105  }
106 
110  public function ‪getStateDelegatesToConcreteQueryBuilder(): void
111  {
112  $this->concreteQueryBuilder->getState()
113  ->shouldBeCalled()
114  ->willReturn(\Doctrine\DBAL\Query\QueryBuilder::STATE_CLEAN);
115 
116  $this->subject->getState();
117  }
118 
122  public function ‪getSQLDelegatesToConcreteQueryBuilder(): void
123  {
124  $this->concreteQueryBuilder->getSQL()
125  ->shouldBeCalled()
126  ->willReturn('UPDATE aTable SET pid = 7');
127  $this->concreteQueryBuilder->getType()
128  ->willReturn(2); // Update Type
129 
130  $this->subject->getSQL();
131  }
132 
136  public function ‪setParameterDelegatesToConcreteQueryBuilder(): void
137  {
138  $this->concreteQueryBuilder->setParameter(Argument::exact('aField'), Argument::exact(5), Argument::cetera())
139  ->shouldBeCalled()
140  ->willReturn($this->subject);
141 
142  $this->subject->setParameter('aField', 5);
143  }
144 
149  {
150  $this->concreteQueryBuilder->setParameters(Argument::exact(['aField' => 'aValue']), Argument::exact([]))
151  ->shouldBeCalled()
152  ->willReturn($this->subject);
153 
154  $this->subject->setParameters(['aField' => 'aValue']);
155  }
156 
161  {
162  $this->concreteQueryBuilder->getParameters()
163  ->shouldBeCalled()
164  ->willReturn(['aField' => 'aValue']);
165 
166  $this->subject->getParameters();
167  }
168 
172  public function ‪getParameterDelegatesToConcreteQueryBuilder(): void
173  {
174  $this->concreteQueryBuilder->getParameter(Argument::exact('aField'))
175  ->shouldBeCalled()
176  ->willReturn('aValue');
177 
178  $this->subject->getParameter('aField');
179  }
180 
185  {
186  $this->concreteQueryBuilder->getParameterTypes()
187  ->shouldBeCalled()
188  ->willReturn([]);
189 
190  $this->subject->getParameterTypes();
191  }
192 
197  {
198  $this->concreteQueryBuilder->getParameterType(Argument::exact('aField'))
199  ->shouldBeCalled()
200  ->willReturn(‪Connection::PARAM_STR);
201 
202  $this->subject->getParameterType('aField');
203  }
204 
209  {
210  $this->concreteQueryBuilder->setFirstResult(Argument::cetera())
211  ->shouldBeCalled()
212  ->willReturn($this->subject);
213 
214  $this->subject->setFirstResult(1);
215  }
216 
221  {
222  $this->concreteQueryBuilder->getFirstResult()
223  ->shouldBeCalled()
224  ->willReturn(1);
225 
226  $this->subject->getFirstResult();
227  }
228 
233  {
234  $this->concreteQueryBuilder->setMaxResults(Argument::cetera())
235  ->shouldBeCalled()
236  ->willReturn($this->subject);
237 
238  $this->subject->setMaxResults(1);
239  }
240 
245  {
246  $this->concreteQueryBuilder->getMaxResults()
247  ->shouldBeCalled()
248  ->willReturn(1);
249 
250  $this->subject->getMaxResults();
251  }
252 
256  public function ‪addDelegatesToConcreteQueryBuilder(): void
257  {
258  $this->concreteQueryBuilder->add(Argument::exact('select'), Argument::exact('aField'), Argument::cetera())
259  ->shouldBeCalled()
260  ->willReturn($this->subject);
261 
262  $this->subject->add('select', 'aField');
263  }
264 
268  public function ‪countBuildsExpressionAndCallsSelect(): void
269  {
270  $this->concreteQueryBuilder->select(Argument::exact('COUNT(*)'))
271  ->shouldBeCalled()
272  ->willReturn($this->subject);
273 
274  $this->subject->count('*');
275  }
276 
281  {
282  $this->connection->quoteIdentifier('aField')
283  ->shouldBeCalled()
284  ->willReturnArgument(0);
285  $this->connection->quoteIdentifier('anotherField')
286  ->shouldBeCalled()
287  ->willReturnArgument(0);
288  $this->concreteQueryBuilder->select(Argument::exact('aField'), Argument::exact('anotherField'))
289  ->shouldBeCalled()
290  ->willReturn($this->subject);
291 
292  $this->subject->select('aField', 'anotherField');
293  }
294 
298  public function ‪quoteIdentifiersForSelectDataProvider(): array
299  {
300  return [
301  'fieldName' => [
302  'fieldName',
303  '"fieldName"',
304  ],
305  'tableName.fieldName' => [
306  'tableName.fieldName',
307  '"tableName"."fieldName"',
308  ],
309  'tableName.*' => [
310  'tableName.*',
311  '"tableName".*',
312  ],
313  '*' => [
314  '*',
315  '*',
316  ],
317  'fieldName AS anotherFieldName' => [
318  'fieldName AS anotherFieldName',
319  '"fieldName" AS "anotherFieldName"',
320  ],
321  'tableName.fieldName AS anotherFieldName' => [
322  'tableName.fieldName AS anotherFieldName',
323  '"tableName"."fieldName" AS "anotherFieldName"',
324  ],
325  'tableName.fieldName AS anotherTable.anotherFieldName' => [
326  'tableName.fieldName AS anotherTable.anotherFieldName',
327  '"tableName"."fieldName" AS "anotherTable"."anotherFieldName"',
328  ],
329  'fieldName as anotherFieldName' => [
330  'fieldName as anotherFieldName',
331  '"fieldName" AS "anotherFieldName"',
332  ],
333  'tableName.fieldName as anotherFieldName' => [
334  'tableName.fieldName as anotherFieldName',
335  '"tableName"."fieldName" AS "anotherFieldName"',
336  ],
337  'tableName.fieldName as anotherTable.anotherFieldName' => [
338  'tableName.fieldName as anotherTable.anotherFieldName',
339  '"tableName"."fieldName" AS "anotherTable"."anotherFieldName"',
340  ],
341  'fieldName aS anotherFieldName' => [
342  'fieldName aS anotherFieldName',
343  '"fieldName" AS "anotherFieldName"',
344  ],
345  'tableName.fieldName aS anotherFieldName' => [
346  'tableName.fieldName aS anotherFieldName',
347  '"tableName"."fieldName" AS "anotherFieldName"',
348  ],
349  'tableName.fieldName aS anotherTable.anotherFieldName' => [
350  'tableName.fieldName aS anotherTable.anotherFieldName',
351  '"tableName"."fieldName" AS "anotherTable"."anotherFieldName"',
352  ],
353  ];
354  }
355 
362  public function ‪quoteIdentifiersForSelect($identifier, $expectedResult): void
363  {
364  $this->connection->quoteIdentifier(Argument::cetera())->will(
365  function (‪$args) {
367 
368  return ‪$platform->quoteIdentifier(‪$args[0]);
369  }
370  );
371 
372  self::assertSame([$expectedResult], $this->subject->quoteIdentifiersForSelect([$identifier]));
373  }
374 
378  public function ‪quoteIdentifiersForSelectWithInvalidAlias(): void
379  {
380  $this->expectException(\InvalidArgumentException::class);
381  $this->expectExceptionCode(1461170686);
382 
383  $this->connection->quoteIdentifier(Argument::cetera())->will(
384  function (‪$args) {
386 
387  return ‪$platform->quoteIdentifier(‪$args[0]);
388  }
389  );
390  $this->subject->quoteIdentifiersForSelect(['aField AS anotherField,someField AS someThing']);
391  }
392 
396  public function ‪selectDoesNotQuoteStarPlaceholder(): void
397  {
398  $this->connection->quoteIdentifier('aField')
399  ->shouldBeCalled()
400  ->willReturnArgument(0);
401  $this->connection->quoteIdentifier('*')
402  ->shouldNotBeCalled();
403  $this->concreteQueryBuilder->select(Argument::exact('aField'), Argument::exact('*'))
404  ->shouldBeCalled()
405  ->willReturn($this->subject);
406 
407  $this->subject->select('aField', '*');
408  }
409 
414  {
415  $this->connection->quoteIdentifier('aField')
416  ->shouldBeCalled()
417  ->willReturnArgument(0);
418  $this->connection->quoteIdentifier('anotherField')
419  ->shouldBeCalled()
420  ->willReturnArgument(0);
421  $this->concreteQueryBuilder->addSelect(Argument::exact('aField'), Argument::exact('anotherField'))
422  ->shouldBeCalled()
423  ->willReturn($this->subject);
424 
425  $this->subject->addSelect('aField', 'anotherField');
426  }
427 
431  public function ‪addSelectDoesNotQuoteStarPlaceholder(): void
432  {
433  $this->connection->quoteIdentifier('aField')
434  ->shouldBeCalled()
435  ->willReturnArgument(0);
436  $this->connection->quoteIdentifier('*')
437  ->shouldNotBeCalled();
438  $this->concreteQueryBuilder->addSelect(Argument::exact('aField'), Argument::exact('*'))
439  ->shouldBeCalled()
440  ->willReturn($this->subject);
441 
442  $this->subject->addSelect('aField', '*');
443  }
444 
449  {
450  $this->connection->quoteIdentifier(Argument::cetera())
451  ->shouldNotBeCalled();
452  $this->concreteQueryBuilder->select(Argument::exact('MAX(aField) AS anAlias'))
453  ->shouldBeCalled()
454  ->willReturn($this->subject);
455 
456  $this->subject->selectLiteral('MAX(aField) AS anAlias');
457  }
458 
463  {
464  $this->connection->quoteIdentifier(Argument::cetera())
465  ->shouldNotBeCalled();
466  $this->concreteQueryBuilder->addSelect(Argument::exact('MAX(aField) AS anAlias'))
467  ->shouldBeCalled()
468  ->willReturn($this->subject);
469 
470  $this->subject->addSelectLiteral('MAX(aField) AS anAlias');
471  }
472 
478  {
479  $this->connection->quoteIdentifier('aTable')
480  ->shouldBeCalled()
481  ->willReturnArgument(0);
482  $this->concreteQueryBuilder->delete(Argument::exact('aTable'), Argument::cetera())
483  ->shouldBeCalled()
484  ->willReturn($this->subject);
485 
486  $this->subject->delete('aTable');
487  }
488 
494  {
495  $this->connection->quoteIdentifier('aTable')
496  ->shouldBeCalled()
497  ->willReturnArgument(0);
498  $this->concreteQueryBuilder->update(Argument::exact('aTable'), Argument::cetera())
499  ->shouldBeCalled()
500  ->willReturn($this->subject);
501 
502  $this->subject->update('aTable');
503  }
504 
509  {
510  $this->connection->quoteIdentifier('aTable')
511  ->shouldBeCalled()
512  ->willReturnArgument(0);
513  $this->concreteQueryBuilder->insert(Argument::exact('aTable'))
514  ->shouldBeCalled()
515  ->willReturn($this->subject);
516 
517  $this->subject->insert('aTable');
518  }
519 
525  {
526  $this->connection->quoteIdentifier('aTable')
527  ->shouldBeCalled()
528  ->willReturnArgument(0);
529  $this->concreteQueryBuilder->from(Argument::exact('aTable'), Argument::cetera())
530  ->shouldBeCalled()
531  ->willReturn($this->subject);
532 
533  $this->subject->from('aTable');
534  }
535 
540  {
541  $this->connection->quoteIdentifier('fromAlias')
542  ->shouldBeCalled()
543  ->willReturnArgument(0);
544  $this->connection->quoteIdentifier('join')
545  ->shouldBeCalled()
546  ->willReturnArgument(0);
547  $this->connection->quoteIdentifier('alias')
548  ->shouldBeCalled()
549  ->willReturnArgument(0);
550  $this->concreteQueryBuilder->innerJoin('fromAlias', 'join', 'alias', null)
551  ->shouldBeCalled()
552  ->willReturn($this->subject);
553 
554  $this->subject->join('fromAlias', 'join', 'alias');
555  }
556 
561  {
562  $this->connection->quoteIdentifier('fromAlias')
563  ->shouldBeCalled()
564  ->willReturnArgument(0);
565  $this->connection->quoteIdentifier('join')
566  ->shouldBeCalled()
567  ->willReturnArgument(0);
568  $this->connection->quoteIdentifier('alias')
569  ->shouldBeCalled()
570  ->willReturnArgument(0);
571  $this->concreteQueryBuilder->innerJoin('fromAlias', 'join', 'alias', null)
572  ->shouldBeCalled()
573  ->willReturn($this->subject);
574 
575  $this->subject->innerJoin('fromAlias', 'join', 'alias');
576  }
577 
582  {
583  $this->connection->quoteIdentifier('fromAlias')
584  ->shouldBeCalled()
585  ->willReturnArgument(0);
586  $this->connection->quoteIdentifier('join')
587  ->shouldBeCalled()
588  ->willReturnArgument(0);
589  $this->connection->quoteIdentifier('alias')
590  ->shouldBeCalled()
591  ->willReturnArgument(0);
592  $this->concreteQueryBuilder->leftJoin('fromAlias', 'join', 'alias', Argument::cetera())
593  ->shouldBeCalled()
594  ->willReturn($this->subject);
595 
596  $expressionBuilder = GeneralUtility::makeInstance(ExpressionBuilder::class, $this->connection->reveal());
597  $this->connection->getExpressionBuilder()->willReturn($expressionBuilder);
598 
599  $this->subject->leftJoin('fromAlias', 'join', 'alias');
600  }
601 
606  {
607  $this->connection->quoteIdentifier('fromAlias')
608  ->shouldBeCalled()
609  ->willReturnArgument(0);
610  $this->connection->quoteIdentifier('join')
611  ->shouldBeCalled()
612  ->willReturnArgument(0);
613  $this->connection->quoteIdentifier('alias')
614  ->shouldBeCalled()
615  ->willReturnArgument(0);
616  $this->concreteQueryBuilder->rightJoin('fromAlias', 'join', 'alias', Argument::cetera())
617  ->shouldBeCalled()
618  ->willReturn($this->subject);
619 
620  $this->concreteQueryBuilder->getQueryPart('from')->willReturn([]);
621 
622  $expressionBuilder = GeneralUtility::makeInstance(ExpressionBuilder::class, $this->connection->reveal());
623  $this->connection->getExpressionBuilder()->willReturn($expressionBuilder);
624 
625  $this->subject->rightJoin('fromAlias', 'join', 'alias');
626  }
627 
632  {
633  $this->connection->quoteIdentifier('aField')
634  ->shouldBeCalled()
635  ->willReturnArgument(0);
636  $this->concreteQueryBuilder->createNamedParameter('aValue', Argument::cetera())
637  ->shouldBeCalled()
638  ->willReturn(':dcValue1');
639  $this->concreteQueryBuilder->set('aField', ':dcValue1')
640  ->shouldBeCalled()
641  ->willReturn($this->subject);
642 
643  $this->subject->set('aField', 'aValue');
644  }
645 
650  {
651  $this->connection->quoteIdentifier('aField')
652  ->shouldBeCalled()
653  ->willReturnArgument(0);
654  $this->concreteQueryBuilder->createNamedParameter(Argument::cetera())->shouldNotBeCalled();
655  $this->concreteQueryBuilder->set('aField', 'aValue')
656  ->shouldBeCalled()
657  ->willReturn($this->subject);
658 
659  $this->subject->set('aField', 'aValue', false);
660  }
661 
665  public function ‪whereDelegatesToConcreteQueryBuilder(): void
666  {
667  $this->concreteQueryBuilder->where('uid=1', 'type=9')
668  ->shouldBeCalled()
669  ->willReturn($this->subject);
670 
671  $this->subject->where('uid=1', 'type=9');
672  }
673 
677  public function ‪andWhereDelegatesToConcreteQueryBuilder(): void
678  {
679  $this->concreteQueryBuilder->andWhere('uid=1', 'type=9')
680  ->shouldBeCalled()
681  ->willReturn($this->subject);
682 
683  $this->subject->andWhere('uid=1', 'type=9');
684  }
685 
689  public function ‪orWhereDelegatesToConcreteQueryBuilder(): void
690  {
691  $this->concreteQueryBuilder->orWhere('uid=1', 'type=9')
692  ->shouldBeCalled()
693  ->willReturn($this->subject);
694 
695  $this->subject->orWhere('uid=1', 'type=9');
696  }
697 
702  {
703  $this->connection->quoteIdentifiers(['aField', 'anotherField'])
704  ->shouldBeCalled()
705  ->willReturnArgument(0);
706  $this->concreteQueryBuilder->groupBy('aField', 'anotherField')
707  ->shouldBeCalled()
708  ->willReturn($this->subject);
709 
710  $this->subject->groupBy('aField', 'anotherField');
711  }
712 
717  {
718  $this->connection->quoteIdentifiers(['aField', 'anotherField'])
719  ->shouldBeCalled()
720  ->willReturnArgument(0);
721  $this->concreteQueryBuilder->addGroupBy('aField', 'anotherField')
722  ->shouldBeCalled()
723  ->willReturn($this->subject);
724 
725  $this->subject->addGroupBy('aField', 'anotherField');
726  }
727 
732  {
733  $this->connection->quoteIdentifier('aField')
734  ->shouldBeCalled()
735  ->willReturnArgument(0);
736  $this->concreteQueryBuilder->createNamedParameter('aValue', Argument::cetera())
737  ->shouldBeCalled()
738  ->willReturn(':dcValue1');
739  $this->concreteQueryBuilder->setValue('aField', ':dcValue1')
740  ->shouldBeCalled()
741  ->willReturn($this->subject);
742 
743  $this->subject->setValue('aField', 'aValue');
744  }
745 
750  {
751  $this->connection->quoteIdentifier('aField')
752  ->shouldBeCalled()
753  ->willReturnArgument(0);
754  $this->concreteQueryBuilder->setValue('aField', 'aValue')
755  ->shouldBeCalled()
756  ->willReturn($this->subject);
757 
758  $this->subject->setValue('aField', 'aValue', false);
759  }
760 
765  {
766  $this->connection->quoteColumnValuePairs(['aField' => ':dcValue1', 'aValue' => ':dcValue2'])
767  ->shouldBeCalled()
768  ->willReturnArgument(0);
769  $this->concreteQueryBuilder->createNamedParameter(1, Argument::cetera())
770  ->shouldBeCalled()
771  ->willReturn(':dcValue1');
772  $this->concreteQueryBuilder->createNamedParameter(2, Argument::cetera())
773  ->shouldBeCalled()
774  ->willReturn(':dcValue2');
775  $this->concreteQueryBuilder->values(['aField' => ':dcValue1', 'aValue' => ':dcValue2'])
776  ->shouldBeCalled()
777  ->willReturn($this->subject);
778 
779  $this->subject->values(['aField' => 1, 'aValue' => 2]);
780  }
781 
786  {
787  $this->connection->quoteColumnValuePairs(['aField' => 1, 'aValue' => 2])
788  ->shouldBeCalled()
789  ->willReturnArgument(0);
790  $this->concreteQueryBuilder->values(['aField' => 1, 'aValue' => 2])
791  ->shouldBeCalled()
792  ->willReturn($this->subject);
793 
794  $this->subject->values(['aField' => 1, 'aValue' => 2], false);
795  }
796 
800  public function ‪havingDelegatesToConcreteQueryBuilder(): void
801  {
802  $this->concreteQueryBuilder->having('uid=1', 'type=9')
803  ->shouldBeCalled()
804  ->willReturn($this->subject);
805 
806  $this->subject->having('uid=1', 'type=9');
807  }
808 
812  public function ‪andHavingDelegatesToConcreteQueryBuilder(): void
813  {
814  $this->concreteQueryBuilder->andHaving('uid=1', 'type=9')
815  ->shouldBeCalled()
816  ->willReturn($this->subject);
817 
818  $this->subject->andHaving('uid=1', 'type=9');
819  }
820 
824  public function ‪orHavingDelegatesToConcreteQueryBuilder(): void
825  {
826  $this->concreteQueryBuilder->orHaving('uid=1', 'type=9')
827  ->shouldBeCalled()
828  ->willReturn($this->subject);
829 
830  $this->subject->orHaving('uid=1', 'type=9');
831  }
832 
837  {
838  $this->connection->quoteIdentifier('aField')
839  ->shouldBeCalled()
840  ->willReturnArgument(0);
841  $this->concreteQueryBuilder->orderBy('aField', null)
842  ->shouldBeCalled()
843  ->willReturn($this->subject);
844 
845  $this->subject->orderBy('aField');
846  }
847 
852  {
853  $this->connection->quoteIdentifier('aField')
854  ->shouldBeCalled()
855  ->willReturnArgument(0);
856  $this->concreteQueryBuilder->addOrderBy('aField', 'DESC')
857  ->shouldBeCalled()
858  ->willReturn($this->subject);
859 
860  $this->subject->addOrderBy('aField', 'DESC');
861  }
862 
866  public function ‪getQueryPartDelegatesToConcreteQueryBuilder(): void
867  {
868  $this->concreteQueryBuilder->getQueryPart('from')
869  ->shouldBeCalled()
870  ->willReturn('aTable');
871 
872  $this->subject->getQueryPart('from');
873  }
874 
879  {
880  $this->concreteQueryBuilder->getQueryParts()
881  ->shouldBeCalled()
882  ->willReturn([]);
883 
884  $this->subject->getQueryParts();
885  }
886 
891  {
892  $this->concreteQueryBuilder->resetQueryParts(['select', 'from'])
893  ->shouldBeCalled()
894  ->willReturn($this->subject);
895 
896  $this->subject->resetQueryParts(['select', 'from']);
897  }
898 
903  {
904  $this->concreteQueryBuilder->resetQueryPart('select')
905  ->shouldBeCalled()
906  ->willReturn($this->subject);
907 
908  $this->subject->resetQueryPart('select');
909  }
910 
915  {
916  $this->concreteQueryBuilder->createNamedParameter(5, Argument::cetera())
917  ->shouldBeCalled()
918  ->willReturn(':dcValue1');
919 
920  $this->subject->createNamedParameter(5);
921  }
922 
927  {
928  $this->concreteQueryBuilder->createPositionalParameter(5, Argument::cetera())
929  ->shouldBeCalled()
930  ->willReturn('?');
931 
932  $this->subject->createPositionalParameter(5);
933  }
934 
938  public function ‪queryRestrictionsAreAddedForSelectOnExecute(): void
939  {
940  ‪$GLOBALS['TCA']['pages']['ctrl'] = [
941  'tstamp' => 'tstamp',
942  'versioningWS' => true,
943  'delete' => 'deleted',
944  'crdate' => 'crdate',
945  'enablecolumns' => [
946  'disabled' => 'hidden',
947  ],
948  ];
949 
950  $this->connection->quoteIdentifier(Argument::cetera())
951  ->willReturnArgument(0);
952  $this->connection->quoteIdentifiers(Argument::cetera())
953  ->willReturnArgument(0);
954 
955  $connectionBuilder = GeneralUtility::makeInstance(
956  \Doctrine\DBAL\Query\QueryBuilder::class,
957  $this->connection->reveal()
958  );
959 
960  $expressionBuilder = GeneralUtility::makeInstance(ExpressionBuilder::class, $this->connection->reveal());
961  $this->connection->getExpressionBuilder()
962  ->willReturn($expressionBuilder);
963 
964  ‪$subject = GeneralUtility::makeInstance(
965  QueryBuilder::class,
966  $this->connection->reveal(),
967  null,
968  $connectionBuilder
969  );
970 
971  ‪$subject->‪select('*')
972  ->‪from('pages')
973  ->‪where('uid=1');
974 
975  $expectedSQL = 'SELECT * FROM pages WHERE (uid=1) AND ((pages.deleted = 0) AND (pages.hidden = 0))';
976  if (class_exists(Result::class)) {
977  $this->connection->executeQuery($expectedSQL, Argument::cetera())
978  ->willReturn($this->prophesize(Result::class)->reveal());
979  } else {
980  $this->connection->executeQuery($expectedSQL, Argument::cetera())
981  ->shouldBeCalled();
982  }
983 
985  }
986 
990  public function ‪queryRestrictionsAreAddedForCountOnExecute(): void
991  {
992  ‪$GLOBALS['TCA']['pages']['ctrl'] = [
993  'tstamp' => 'tstamp',
994  'versioningWS' => true,
995  'delete' => 'deleted',
996  'crdate' => 'crdate',
997  'enablecolumns' => [
998  'disabled' => 'hidden',
999  ],
1000  ];
1001 
1002  $this->connection->quoteIdentifier(Argument::cetera())
1003  ->willReturnArgument(0);
1004  $this->connection->quoteIdentifiers(Argument::cetera())
1005  ->willReturnArgument(0);
1006 
1007  $connectionBuilder = GeneralUtility::makeInstance(
1008  \Doctrine\DBAL\Query\QueryBuilder::class,
1009  $this->connection->reveal()
1010  );
1011 
1012  $expressionBuilder = GeneralUtility::makeInstance(ExpressionBuilder::class, $this->connection->reveal());
1013  $this->connection->getExpressionBuilder()
1014  ->willReturn($expressionBuilder);
1015 
1016  ‪$subject = GeneralUtility::makeInstance(
1017  QueryBuilder::class,
1018  $this->connection->reveal(),
1019  null,
1020  $connectionBuilder
1021  );
1022 
1023  ‪$subject->‪count('uid')
1024  ->‪from('pages')
1025  ->‪where('uid=1');
1026 
1027  $expectedSQL = 'SELECT COUNT(uid) FROM pages WHERE (uid=1) AND ((pages.deleted = 0) AND (pages.hidden = 0))';
1028 
1029  if (class_exists(Result::class)) {
1030  $this->connection->executeQuery($expectedSQL, Argument::cetera())
1031  ->willReturn($this->prophesize(Result::class)->reveal());
1032  } else {
1033  $this->connection->executeQuery($expectedSQL, Argument::cetera())
1034  ->shouldBeCalled();
1035  }
1036 
1038  }
1044  {
1045  ‪$GLOBALS['TCA']['pages']['ctrl'] = [
1046  'tstamp' => 'tstamp',
1047  'versioningWS' => true,
1048  'delete' => 'deleted',
1049  'crdate' => 'crdate',
1050  'enablecolumns' => [
1051  'disabled' => 'hidden',
1052  ],
1053  ];
1054 
1055  $this->connection->quoteIdentifier(Argument::cetera())
1056  ->willReturnArgument(0);
1057  $this->connection->quoteIdentifiers(Argument::cetera())
1058  ->willReturnArgument(0);
1059  $this->connection->getExpressionBuilder()
1060  ->willReturn(GeneralUtility::makeInstance(ExpressionBuilder::class, $this->connection->reveal()));
1061 
1062  ‪$concreteQueryBuilder = GeneralUtility::makeInstance(
1063  \Doctrine\DBAL\Query\QueryBuilder::class,
1064  $this->connection->reveal()
1065  );
1066 
1067  ‪$subject = GeneralUtility::makeInstance(
1068  QueryBuilder::class,
1069  $this->connection->reveal(),
1070  null,
1072  );
1073 
1074  ‪$subject->‪select('*')
1075  ->‪from('pages')
1076  ->‪where('uid=1');
1077 
1078  $expectedSQL = 'SELECT * FROM pages WHERE (uid=1) AND ((pages.deleted = 0) AND (pages.hidden = 0))';
1079  self::assertSame($expectedSQL, ‪$subject->‪getSQL());
1080 
1082 
1083  $expectedSQL = 'SELECT * FROM pages WHERE (uid=1) AND (pages.deleted = 0)';
1084  self::assertSame($expectedSQL, ‪$subject->‪getSQL());
1085  }
1091  {
1092  ‪$GLOBALS['TCA']['pages']['ctrl'] = [
1093  'tstamp' => 'tstamp',
1094  'versioningWS' => true,
1095  'delete' => 'deleted',
1096  'crdate' => 'crdate',
1097  'enablecolumns' => [
1098  'disabled' => 'hidden',
1099  ],
1100  ];
1101 
1102  $this->connection->quoteIdentifier(Argument::cetera())
1103  ->willReturnArgument(0);
1104  $this->connection->quoteIdentifiers(Argument::cetera())
1105  ->willReturnArgument(0);
1106  $this->connection->getExpressionBuilder()
1107  ->willReturn(GeneralUtility::makeInstance(ExpressionBuilder::class, $this->connection->reveal()));
1108 
1109  ‪$concreteQueryBuilder = GeneralUtility::makeInstance(
1110  \Doctrine\DBAL\Query\QueryBuilder::class,
1111  $this->connection->reveal()
1112  );
1113 
1114  ‪$subject = GeneralUtility::makeInstance(
1115  QueryBuilder::class,
1116  $this->connection->reveal(),
1117  null,
1119  );
1120 
1121  ‪$subject->‪select('*')
1122  ->‪from('pages')
1123  ->‪where('uid=1');
1124 
1126 
1127  $expectedSQL = 'SELECT * FROM pages WHERE (uid=1) AND (pages.deleted = 0)';
1128 
1129  if (class_exists(Result::class)) {
1130  $this->connection->executeQuery($expectedSQL, Argument::cetera())
1131  ->willReturn($this->prophesize(Result::class)->reveal());
1132  } else {
1133  $this->connection->executeQuery($expectedSQL, Argument::cetera())
1134  ->shouldBeCalled();
1135  }
1136 
1138 
1140 
1141  $expectedSQL = 'SELECT * FROM pages WHERE (uid=1) AND ((pages.deleted = 0) AND (pages.hidden = 0))';
1142  if (class_exists(Result::class)) {
1143  $this->connection->executeQuery($expectedSQL, Argument::cetera())
1144  ->willReturn($this->prophesize(Result::class)->reveal());
1145  } else {
1146  $this->connection->executeQuery($expectedSQL, Argument::cetera())
1147  ->shouldBeCalled();
1148  }
1149 
1151  }
1157  {
1158  $this->concreteQueryBuilder->getQueryPart('from')
1159  ->shouldBeCalled()
1160  ->willReturn([
1161  [
1162  'table' => 'aTable',
1163  ],
1164  ]);
1165  $this->concreteQueryBuilder->getQueryPart('join')
1166  ->shouldBeCalled()
1167  ->willReturn([
1168  'aTable' => [
1169  [
1170  'joinType' => 'inner',
1171  'joinTable' => 'aTable',
1172  'joinAlias' => 'aTable_alias'
1173  ]
1174  ]
1175  ]);
1176 
1177  // Call a protected method
1178  $result = \Closure::bind(function () {
1179  return $this->getQueriedTables();
1180  }, ‪$this->subject, QueryBuilder::class)();
1181 
1182  $expected = [
1183  'aTable' => 'aTable',
1184  'aTable_alias' => 'aTable'
1185  ];
1186  self::assertEquals($expected, $result);
1187  }
1193  {
1194  return [
1195  'mysql' => [
1196  'platform' => MySqlPlatform::class,
1197  'quoteChar' => '`',
1198  'input' => '`anIdentifier`',
1199  'expected' => 'anIdentifier',
1200  ],
1201  'mysql with spaces' => [
1202  'platform' => MySqlPlatform::class,
1203  'quoteChar' => '`',
1204  'input' => ' `anIdentifier` ',
1205  'expected' => 'anIdentifier',
1206  ],
1207  'postgres' => [
1208  'platform' => PostgreSqlPlatform::class,
1209  'quoteChar' => '"',
1210  'input' => '"anIdentifier"',
1211  'expected' => 'anIdentifier',
1212  ],
1213  'mssql' => [
1214  'platform' => SQLServerPlatform::class,
1215  'quoteChar' => '', // no single quote character, but [ and ]
1216  'input' => '[anIdentifier]',
1217  'expected' => 'anIdentifier',
1218  ],
1219  ];
1220  }
1221 
1230  public function ‪unquoteSingleIdentifierUnquotesCorrectlyOnDifferentPlatforms(string ‪$platform, string $quoteChar, string $input, string $expected): void
1231  {
1232  $connectionProphecy = $this->prophesize(Connection::class);
1233  $databasePlatformProphecy = $this->prophesize(‪$platform);
1234  $databasePlatformProphecy->getIdentifierQuoteCharacter()->willReturn($quoteChar);
1235  $connectionProphecy->getDatabasePlatform()->willReturn($databasePlatformProphecy);
1236  ‪$subject = $this->getAccessibleMock(QueryBuilder::class, ['dummy'], [$connectionProphecy->reveal()]);
1237  $result = ‪$subject->_call('unquoteSingleIdentifier', $input);
1238  self::assertEquals($expected, $result);
1239  }
1244  public function ‪cloningQueryBuilderClonesConcreteQueryBuilder(): void
1245  {
1246  $clonedQueryBuilder = clone ‪$this->subject;
1247  self::assertNotSame($this->subject->getConcreteQueryBuilder(), $clonedQueryBuilder->getConcreteQueryBuilder());
1248  }
1254  {
1255  ‪$GLOBALS['TCA']['pages']['ctrl'] = [
1256  'tstamp' => 'tstamp',
1257  'versioningWS' => true,
1258  'delete' => 'deleted',
1259  'crdate' => 'crdate',
1260  'enablecolumns' => [
1261  'disabled' => 'hidden',
1262  ],
1263  ];
1264 
1265  $this->connection->quoteIdentifier(Argument::cetera())
1266  ->willReturnArgument(0);
1267  $this->connection->quoteIdentifiers(Argument::cetera())
1268  ->willReturnArgument(0);
1269  $this->connection->getExpressionBuilder()
1270  ->willReturn(GeneralUtility::makeInstance(ExpressionBuilder::class, $this->connection->reveal()));
1271 
1272  ‪$concreteQueryBuilder = GeneralUtility::makeInstance(
1273  \Doctrine\DBAL\Query\QueryBuilder::class,
1274  $this->connection->reveal()
1275  );
1276 
1277  ‪$subject = GeneralUtility::makeInstance(
1278  QueryBuilder::class,
1279  $this->connection->reveal(),
1280  null,
1282  );
1283 
1284  ‪$subject->‪select('*')
1285  ->‪from('pages')
1286  ->‪where('uid=1');
1287 
1288  $expectedSQL = 'SELECT * FROM pages WHERE (uid=1) AND ((pages.deleted = 0) AND (pages.hidden = 0))';
1289  self::assertSame($expectedSQL, ‪$subject->‪getSQL());
1290 
1291  $clonedQueryBuilder = clone ‪$subject;
1292  //just after cloning both query builders should return the same sql
1293  self::assertSame($expectedSQL, $clonedQueryBuilder->getSQL());
1294 
1295  //change cloned QueryBuilder
1296  $clonedQueryBuilder->count('*');
1297  $expectedCountSQL = 'SELECT COUNT(*) FROM pages WHERE (uid=1) AND ((pages.deleted = 0) AND (pages.hidden = 0))';
1298  self::assertSame($expectedCountSQL, $clonedQueryBuilder->getSQL());
1299 
1300  //check if the original QueryBuilder has not changed
1301  self::assertSame($expectedSQL, ‪$subject->‪getSQL());
1302 
1303  //change restrictions in the original QueryBuilder and check if cloned has changed
1305  $expectedSQL = 'SELECT * FROM pages WHERE (uid=1) AND (pages.deleted = 0)';
1306  self::assertSame($expectedSQL, ‪$subject->‪getSQL());
1307 
1308  self::assertSame($expectedCountSQL, $clonedQueryBuilder->getSQL());
1309  }
1315  {
1316  $restrictionClass = get_class($this->prophesize(QueryRestrictionInterface::class)->reveal());
1317  $queryBuilder = new ‪QueryBuilder(
1318  $this->connection->reveal(),
1319  null,
1320  $this->concreteQueryBuilder->reveal(),
1321  [
1322  $restrictionClass => [],
1323  ]
1324  );
1325 
1326  $container = $this->prophesize(AbstractRestrictionContainer::class);
1327  $container->add(new $restrictionClass())->shouldBeCalled();
1328 
1329  $queryBuilder->setRestrictions($container->reveal());
1330  }
1336  {
1337  $restrictionClass = get_class($this->prophesize(QueryRestrictionInterface::class)->reveal());
1338  ‪$GLOBALS['TYPO3_CONF_VARS']['DB']['additionalQueryRestrictions'][$restrictionClass] = [];
1339  $queryBuilder = new ‪QueryBuilder(
1340  $this->connection->reveal(),
1341  null,
1342  $this->concreteQueryBuilder->reveal()
1343  );
1344 
1345  $container = $this->prophesize(AbstractRestrictionContainer::class);
1346  $container->add(new $restrictionClass())->shouldBeCalled();
1347 
1348  $queryBuilder->setRestrictions($container->reveal());
1349  }
1355  {
1356  $restrictionClass = get_class($this->prophesize(QueryRestrictionInterface::class)->reveal());
1357  ‪$GLOBALS['TYPO3_CONF_VARS']['DB']['additionalQueryRestrictions'][$restrictionClass] = ['disabled' => true];
1358  $queryBuilder = new ‪QueryBuilder(
1359  $this->connection->reveal(),
1360  null,
1361  $this->concreteQueryBuilder->reveal()
1362  );
1363 
1364  $container = $this->prophesize(AbstractRestrictionContainer::class);
1365  $container->add(new $restrictionClass())->shouldNotBeCalled();
1366 
1367  $queryBuilder->setRestrictions($container->reveal());
1368  }
1374  {
1375  $restrictionClass = get_class($this->prophesize(QueryRestrictionInterface::class)->reveal());
1376  $queryBuilder = new ‪QueryBuilder(
1377  $this->connection->reveal(),
1378  null,
1379  $this->concreteQueryBuilder->reveal(),
1380  [
1381  $restrictionClass => [],
1382  ]
1383  );
1384 
1385  $container = $this->prophesize(DefaultRestrictionContainer::class);
1386  $container->add(new $restrictionClass())->shouldBeCalled();
1387  GeneralUtility::addInstance(DefaultRestrictionContainer::class, $container->reveal());
1388 
1389  $queryBuilder->resetRestrictions();
1390  }
1391 
1398  public function ‪setWithNamedParameterPassesGivenTypeToCreateNamedParameter($input, int $type): void
1399  {
1400  $this->connection->quoteIdentifier('aField')
1401  ->willReturnArgument(0);
1402  ‪$concreteQueryBuilder = new \Doctrine\DBAL\Query\QueryBuilder($this->connection->reveal());
1403 
1404  ‪$subject = new ‪QueryBuilder($this->connection->reveal(), null, ‪$concreteQueryBuilder);
1405  ‪$subject->‪set('aField', $input, true, $type);
1406  self::assertSame($type, ‪$concreteQueryBuilder->‪getParameterType('dcValue1'));
1407  }
1408 
1409  public function ‪createNamedParameterInput(): array
1410  {
1411  return [
1412  'string input and output' => [
1413  'aValue',
1414  \PDO::PARAM_STR,
1415  ],
1416  'int input and string output' => [
1417  17,
1418  \PDO::PARAM_STR,
1419  ],
1420  'int input and int output' => [
1421  17,
1422  \PDO::PARAM_INT,
1423  ],
1424  'string input and array output' => [
1425  'aValue',
1426  Connection::PARAM_STR_ARRAY
1427  ],
1428  ];
1429  }
1430 
1431  public function ‪castFieldToTextTypeDataProvider(): array
1432  {
1433  return [
1434  'Test cast for MySqlPlatform' => [
1435  new MySqlPlatform(),
1436  'CONVERT(aField, CHAR)'
1437  ],
1438  'Test cast for PostgreSqlPlatform' => [
1439  new PostgreSqlPlatform(),
1440  'aField::text'
1441  ],
1442  'Test cast for SqlitePlatform' => [
1443  new SqlitePlatform(),
1444  'CAST(aField as TEXT)'
1445  ],
1446  'Test cast for SQLServerPlatform' => [
1447  new SQLServerPlatform(),
1448  'CAST(aField as VARCHAR)'
1449  ],
1450  'Test cast for OraclePlatform' => [
1451  new OraclePlatform(),
1452  'CAST(aField as VARCHAR)'
1453  ],
1454  ];
1455  }
1456 
1464  public function ‪castFieldToTextType(AbstractPlatform ‪$platform, string $expectation): void
1465  {
1466  $this->connection->quoteIdentifier('aField')
1467  ->shouldBeCalled()
1468  ->willReturnArgument(0);
1469 
1470  $this->connection->getDatabasePlatform()->willReturn(‪$platform);
1471 
1472  ‪$concreteQueryBuilder = new \Doctrine\DBAL\Query\QueryBuilder($this->connection->reveal());
1473 
1474  ‪$subject = new ‪QueryBuilder($this->connection->reveal(), null, ‪$concreteQueryBuilder);
1475  $result = ‪$subject->‪castFieldToTextType('aField');
1476 
1477  $this->connection->quoteIdentifier('aField')->shouldHaveBeenCalled();
1478  self::assertSame($expectation, $result);
1479  }
1485  {
1486  ‪$GLOBALS['TCA']['tt_content']['ctrl'] = ‪$GLOBALS['TCA']['pages']['ctrl'] = [
1487  'delete' => 'deleted',
1488  'enablecolumns' => [
1489  'disabled' => 'hidden',
1490  ],
1491  ];
1492 
1493  $this->connection->quoteIdentifier(Argument::cetera())
1494  ->willReturnArgument(0);
1495  $this->connection->quoteIdentifiers(Argument::cetera())
1496  ->willReturnArgument(0);
1497 
1498  $connectionBuilder = GeneralUtility::makeInstance(
1499  \Doctrine\DBAL\Query\QueryBuilder::class,
1500  $this->connection->reveal()
1501  );
1502 
1503  $expressionBuilder = GeneralUtility::makeInstance(ExpressionBuilder::class, $this->connection->reveal());
1504  $this->connection->getExpressionBuilder()->willReturn($expressionBuilder);
1505 
1507  $this->connection->reveal(),
1508  null,
1509  $connectionBuilder
1510  );
1512 
1513  ‪$subject->‪select('*')
1514  ->‪from('pages')
1515  ->‪leftJoin(
1516  'pages',
1517  'tt_content',
1518  'content',
1519  'pages.uid = content.pid'
1520  )
1521  ->‪where($expressionBuilder->eq('uid', 1));
1522 
1523  if (class_exists(Result::class)) {
1524  $this->connection->executeQuery(
1525  'SELECT * FROM pages LEFT JOIN tt_content content ON pages.uid = content.pid WHERE (uid = 1) AND ((pages.deleted = 0) AND (pages.hidden = 0))',
1526  Argument::cetera()
1527  )
1528  ->willReturn($this->prophesize(Result::class)->reveal());
1529  } else {
1530  $this->connection->executeQuery(
1531  'SELECT * FROM pages LEFT JOIN tt_content content ON pages.uid = content.pid WHERE (uid = 1) AND ((pages.deleted = 0) AND (pages.hidden = 0))',
1532  Argument::cetera()
1533  )->shouldBeCalled();
1534  }
1535 
1537  }
1543  {
1544  ‪$GLOBALS['TCA']['tt_content']['ctrl'] = ‪$GLOBALS['TCA']['pages']['ctrl'] = [
1545  'delete' => 'deleted',
1546  'enablecolumns' => [
1547  'disabled' => 'hidden',
1548  ],
1549  ];
1550 
1551  $this->connection->quoteIdentifier(Argument::cetera())
1552  ->willReturnArgument(0);
1553  $this->connection->quoteIdentifiers(Argument::cetera())
1554  ->willReturnArgument(0);
1555 
1556  $connectionBuilder = GeneralUtility::makeInstance(
1557  \Doctrine\DBAL\Query\QueryBuilder::class,
1558  $this->connection->reveal()
1559  );
1560 
1561  $expressionBuilder = GeneralUtility::makeInstance(ExpressionBuilder::class, $this->connection->reveal());
1562  $this->connection->getExpressionBuilder()->willReturn($expressionBuilder);
1563 
1565  $this->connection->reveal(),
1566  null,
1567  $connectionBuilder
1568  );
1570  ‪$subject->‪getRestrictions()->‪removeByType(DeletedRestriction::class);
1571 
1572  ‪$subject->‪select('*')
1573  ->‪from('pages')
1574  ->‪leftJoin(
1575  'pages',
1576  'tt_content',
1577  'content',
1578  'pages.uid = content.pid'
1579  )
1580  ->‪where($expressionBuilder->eq('uid', 1));
1581 
1582  if (class_exists(Result::class)) {
1583  $this->connection->executeQuery(
1584  'SELECT * FROM pages LEFT JOIN tt_content content ON pages.uid = content.pid WHERE (uid = 1) AND (pages.hidden = 0)',
1585  Argument::cetera()
1586  )->willReturn($this->prophesize(Result::class)->reveal());
1587  } else {
1588  $this->connection->executeQuery(
1589  'SELECT * FROM pages LEFT JOIN tt_content content ON pages.uid = content.pid WHERE (uid = 1) AND (pages.hidden = 0)',
1590  Argument::cetera()
1591  )->shouldBeCalled();
1592  }
1593 
1595  }
1601  {
1602  ‪$GLOBALS['TCA']['tt_content']['ctrl'] = ‪$GLOBALS['TCA']['pages']['ctrl'] = [
1603  'delete' => 'deleted',
1604  'enablecolumns' => [
1605  'disabled' => 'hidden',
1606  ],
1607  ];
1608 
1609  $this->connection->quoteIdentifier(Argument::cetera())
1610  ->willReturnArgument(0);
1611  $this->connection->quoteIdentifiers(Argument::cetera())
1612  ->willReturnArgument(0);
1613 
1614  $connectionBuilder = GeneralUtility::makeInstance(
1615  \Doctrine\DBAL\Query\QueryBuilder::class,
1616  $this->connection->reveal()
1617  );
1618 
1619  $expressionBuilder = GeneralUtility::makeInstance(ExpressionBuilder::class, $this->connection->reveal());
1620  $this->connection->getExpressionBuilder()->willReturn($expressionBuilder);
1621 
1623  $this->connection->reveal(),
1624  null,
1625  $connectionBuilder
1626  );
1627 
1628  ‪$subject->‪select('*')
1629  ->‪from('pages')
1630  ->‪leftJoin(
1631  'pages',
1632  'tt_content',
1633  'content',
1634  'pages.uid = content.pid'
1635  )
1636  ->‪where($expressionBuilder->eq('uid', 1));
1637 
1638  if (class_exists(Result::class)) {
1639  $this->connection->executeQuery(
1640  'SELECT * FROM pages LEFT JOIN tt_content content ON (pages.uid = content.pid) AND ((content.deleted = 0) AND (content.hidden = 0)) WHERE (uid = 1) AND ((pages.deleted = 0) AND (pages.hidden = 0))',
1641  Argument::cetera()
1642  )->willReturn($this->prophesize(Result::class)->reveal());
1643  } else {
1644  $this->connection->executeQuery(
1645  'SELECT * FROM pages LEFT JOIN tt_content content ON (pages.uid = content.pid) AND ((content.deleted = 0) AND (content.hidden = 0)) WHERE (uid = 1) AND ((pages.deleted = 0) AND (pages.hidden = 0))',
1646  Argument::cetera()
1647  )->shouldBeCalled();
1648  }
1649 
1651  }
1657  {
1658  ‪$GLOBALS['TCA']['tt_content']['ctrl'] = ‪$GLOBALS['TCA']['pages']['ctrl'] = [
1659  'delete' => 'deleted',
1660  'enablecolumns' => [
1661  'disabled' => 'hidden',
1662  ],
1663  ];
1664 
1665  $this->connection->quoteIdentifier(Argument::cetera())
1666  ->willReturnArgument(0);
1667  $this->connection->quoteIdentifiers(Argument::cetera())
1668  ->willReturnArgument(0);
1669 
1670  $connectionBuilder = GeneralUtility::makeInstance(
1671  \Doctrine\DBAL\Query\QueryBuilder::class,
1672  $this->connection->reveal()
1673  );
1674 
1675  $expressionBuilder = GeneralUtility::makeInstance(ExpressionBuilder::class, $this->connection->reveal());
1676  $this->connection->getExpressionBuilder()->willReturn($expressionBuilder);
1677 
1679  $this->connection->reveal(),
1680  null,
1681  $connectionBuilder
1682  );
1683 
1684  ‪$subject->‪select('*')
1685  ->‪from('tt_content')
1686  ->‪rightJoin(
1687  'tt_content',
1688  'pages',
1689  'pages',
1690  'pages.uid = tt_content.pid'
1691  )
1692  ->‪where($expressionBuilder->eq('uid', 1));
1693 
1694  if (class_exists(Result::class)) {
1695  $this->connection->executeQuery(
1696  'SELECT * FROM tt_content RIGHT JOIN pages pages ON (pages.uid = tt_content.pid) AND ((tt_content.deleted = 0) AND (tt_content.hidden = 0)) WHERE (uid = 1) AND ((pages.deleted = 0) AND (pages.hidden = 0))',
1697  Argument::cetera()
1698  )->willReturn($this->prophesize(Result::class)->reveal());
1699  } else {
1700  $this->connection->executeQuery(
1701  'SELECT * FROM tt_content RIGHT JOIN pages pages ON (pages.uid = tt_content.pid) AND ((tt_content.deleted = 0) AND (tt_content.hidden = 0)) WHERE (uid = 1) AND ((pages.deleted = 0) AND (pages.hidden = 0))',
1702  Argument::cetera()
1703  )->shouldBeCalled();
1704  }
1705 
1707  }
1708 }
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\queryRestrictionsAreAddedForSelectOnExecute
‪queryRestrictionsAreAddedForSelectOnExecute()
Definition: QueryBuilderTest.php:934
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\set
‪QueryBuilder set(string $key, $value, bool $createNamedParameter=true, int $type=\PDO::PARAM_STR)
Definition: QueryBuilder.php:660
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\valuesQuotesIdentifiersAndDelegatesToConcreteQueryBuilder
‪valuesQuotesIdentifiersAndDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:760
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\havingDelegatesToConcreteQueryBuilder
‪havingDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:796
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\resetRestrictions
‪resetRestrictions()
Definition: QueryBuilder.php:137
‪TYPO3\CMS\Core\Database\Query\Expression\ExpressionBuilder
Definition: ExpressionBuilder.php:35
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\queryRestrictionsAreReevaluatedOnSettingsChangeForGetSQL
‪queryRestrictionsAreReevaluatedOnSettingsChangeForGetSQL()
Definition: QueryBuilderTest.php:1039
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\select
‪QueryBuilder select(string ... $selects)
Definition: QueryBuilder.php:416
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\rightJoin
‪QueryBuilder rightJoin(string $fromAlias, string $join, string $alias, string $condition=null)
Definition: QueryBuilder.php:623
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\queryRestrictionsAreReevaluatedOnSettingsChangeForExecute
‪queryRestrictionsAreReevaluatedOnSettingsChangeForExecute()
Definition: QueryBuilderTest.php:1086
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\addOrderByQuotesIdentifierAndDelegatesToConcreteQueryBuilder
‪addOrderByQuotesIdentifierAndDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:847
‪TYPO3\CMS\Core\Database\Query\Restriction\QueryRestrictionInterface
Definition: QueryRestrictionInterface.php:27
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\getQueryPartsDelegatesToConcreteQueryBuilder
‪getQueryPartsDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:874
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\rightJoinQuotesIdentifiersAndDelegatesToConcreteQueryBuilder
‪rightJoinQuotesIdentifiersAndDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:601
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\castFieldToTextTypeDataProvider
‪castFieldToTextTypeDataProvider()
Definition: QueryBuilderTest.php:1427
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\quoteIdentifiersForSelectWithInvalidAlias
‪quoteIdentifiersForSelectWithInvalidAlias()
Definition: QueryBuilderTest.php:374
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\quoteIdentifiersForSelect
‪quoteIdentifiersForSelect($identifier, $expectedResult)
Definition: QueryBuilderTest.php:358
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\getQueryPartDelegatesToConcreteQueryBuilder
‪getQueryPartDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:862
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\castFieldToTextType
‪castFieldToTextType(AbstractPlatform $platform, string $expectation)
Definition: QueryBuilderTest.php:1460
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\createNamedParameterDelegatesToConcreteQueryBuilder
‪createNamedParameterDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:910
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\resetQueryPartDelegatesToConcreteQueryBuilder
‪resetQueryPartDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:898
‪TYPO3\CMS\Core\Database\Query\Restriction\QueryRestrictionContainerInterface\removeAll
‪QueryRestrictionContainerInterface removeAll()
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\restrictionsCanStillBeRemovedAfterTheyHaveBeenLimitedToTables
‪restrictionsCanStillBeRemovedAfterTheyHaveBeenLimitedToTables()
Definition: QueryBuilderTest.php:1538
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\createPositionalParameterDelegatesToConcreteQueryBuilder
‪createPositionalParameterDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:922
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\getMaxResultsDelegatesToConcreteQueryBuilder
‪getMaxResultsDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:240
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\settingRestrictionContainerWillAddAdditionalRestrictionsFromConfiguration
‪settingRestrictionContainerWillAddAdditionalRestrictionsFromConfiguration()
Definition: QueryBuilderTest.php:1331
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\getRestrictions
‪QueryRestrictionContainerInterface getRestrictions()
Definition: QueryBuilder.php:104
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\resettingToDefaultRestrictionContainerWillAddAdditionalRestrictionsFromConfiguration
‪resettingToDefaultRestrictionContainerWillAddAdditionalRestrictionsFromConfiguration()
Definition: QueryBuilderTest.php:1369
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\getSQLDelegatesToConcreteQueryBuilder
‪getSQLDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:118
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\selectLiteralDirectlyDelegatesToConcreteQueryBuilder
‪selectLiteralDirectlyDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:444
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\updateQuotesIdentifierAndDelegatesToConcreteQueryBuilder
‪updateQuotesIdentifierAndDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:489
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\$platform
‪AbstractPlatform $platform
Definition: QueryBuilderTest.php:50
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\innerJoinQuotesIdentifiersAndDelegatesToConcreteQueryBuilder
‪innerJoinQuotesIdentifiersAndDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:556
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest
Definition: QueryBuilderTest.php:43
‪TYPO3\CMS\Core\Database\Connection\PARAM_STR
‪const PARAM_STR
Definition: Connection.php:52
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\exprReturnsExpressionBuilderForConnection
‪exprReturnsExpressionBuilderForConnection()
Definition: QueryBuilderTest.php:82
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\setMaxResultsDelegatesToConcreteQueryBuilder
‪setMaxResultsDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:228
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\setValueQuotesIdentifierAndDelegatesToConcreteQueryBuilder
‪setValueQuotesIdentifierAndDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:727
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\setValueWithoutNamedParameterQuotesIdentifierAndDelegatesToConcreteQueryBuilder
‪setValueWithoutNamedParameterQuotesIdentifierAndDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:745
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\setParametersDelegatesToConcreteQueryBuilder
‪setParametersDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:144
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\joinQuotesIdentifiersAndDelegatesToConcreteQueryBuilder
‪joinQuotesIdentifiersAndDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:535
‪TYPO3\CMS\Core\Database\Query\Restriction\QueryRestrictionContainerInterface\removeByType
‪QueryRestrictionContainerInterface removeByType(string $restrictionType)
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\quoteIdentifiersForSelectDataProvider
‪array quoteIdentifiersForSelectDataProvider()
Definition: QueryBuilderTest.php:294
‪TYPO3\CMS\Core\Database\Query\QueryBuilder
Definition: QueryBuilder.php:52
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\from
‪QueryBuilder from(string $from, string $alias=null)
Definition: QueryBuilder.php:531
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\getSQL
‪string getSQL()
Definition: QueryBuilder.php:230
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\fromQuotesIdentifierAndDelegatesToConcreteQueryBuilder
‪fromQuotesIdentifierAndDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:520
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\settingRestrictionContainerWillAddAdditionalRestrictionsFromConstructor
‪settingRestrictionContainerWillAddAdditionalRestrictionsFromConstructor()
Definition: QueryBuilderTest.php:1310
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\getQueriedTablesReturnsSameTableTwiceForInnerJoin
‪getQueriedTablesReturnsSameTableTwiceForInnerJoin()
Definition: QueryBuilderTest.php:1152
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\unquoteSingleIdentifierUnquotesCorrectlyOnDifferentPlatforms
‪unquoteSingleIdentifierUnquotesCorrectlyOnDifferentPlatforms(string $platform, string $quoteChar, string $input, string $expected)
Definition: QueryBuilderTest.php:1226
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\cloningQueryBuilderClonesConcreteQueryBuilder
‪cloningQueryBuilderClonesConcreteQueryBuilder()
Definition: QueryBuilderTest.php:1240
‪TYPO3\CMS\Core\Tests\Unit\Database\Mocks\MockPlatform
Definition: MockPlatform.php:22
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\unquoteSingleIdentifierUnquotesCorrectlyOnDifferentPlatformsDataProvider
‪array unquoteSingleIdentifierUnquotesCorrectlyOnDifferentPlatformsDataProvider()
Definition: QueryBuilderTest.php:1188
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\execute
‪Statement Doctrine DBAL ForwardCompatibility Result Doctrine DBAL Driver ResultStatement int execute()
Definition: QueryBuilder.php:204
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\addSelectLiteralDirectlyDelegatesToConcreteQueryBuilder
‪addSelectLiteralDirectlyDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:458
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\getParameterDelegatesToConcreteQueryBuilder
‪getParameterDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:168
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\restrictionsAreAppliedInJoinConditionForRightJoins
‪restrictionsAreAppliedInJoinConditionForRightJoins()
Definition: QueryBuilderTest.php:1652
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\restrictionsAreAppliedInJoinConditionForLeftJoins
‪restrictionsAreAppliedInJoinConditionForLeftJoins()
Definition: QueryBuilderTest.php:1596
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\insertQuotesIdentifierAndDelegatesToConcreteQueryBuilder
‪insertQuotesIdentifierAndDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:504
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\setUp
‪setUp()
Definition: QueryBuilderTest.php:63
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\settingRestrictionContainerWillNotAddAdditionalRestrictionsFromConfigurationIfNotDisabled
‪settingRestrictionContainerWillNotAddAdditionalRestrictionsFromConfigurationIfNotDisabled()
Definition: QueryBuilderTest.php:1350
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\getParameterTypeDelegatesToConcreteQueryBuilder
‪getParameterTypeDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:192
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\andWhereDelegatesToConcreteQueryBuilder
‪andWhereDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:673
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\orderByQuotesIdentifierAndDelegatesToConcreteQueryBuilder
‪orderByQuotesIdentifierAndDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:832
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\addSelectQuotesIdentifiersAndDelegatesToConcreteQueryBuilder
‪addSelectQuotesIdentifiersAndDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:409
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\$connection
‪Connection Prophecy Prophecy ObjectProphecy $connection
Definition: QueryBuilderTest.php:46
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\createNamedParameterInput
‪createNamedParameterInput()
Definition: QueryBuilderTest.php:1405
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\addSelectDoesNotQuoteStarPlaceholder
‪addSelectDoesNotQuoteStarPlaceholder()
Definition: QueryBuilderTest.php:427
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\setParameterDelegatesToConcreteQueryBuilder
‪setParameterDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:132
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\orHavingDelegatesToConcreteQueryBuilder
‪orHavingDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:820
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\setFirstResultDelegatesToConcreteQueryBuilder
‪setFirstResultDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:204
‪$args
‪$args
Definition: validateRstFiles.php:214
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\selectDoesNotQuoteStarPlaceholder
‪selectDoesNotQuoteStarPlaceholder()
Definition: QueryBuilderTest.php:392
‪TYPO3\CMS\Core\Database\Connection
Definition: Connection.php:36
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\orWhereDelegatesToConcreteQueryBuilder
‪orWhereDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:685
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\changingClonedQueryBuilderDoesNotInfluenceSourceOne
‪changingClonedQueryBuilderDoesNotInfluenceSourceOne()
Definition: QueryBuilderTest.php:1249
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\limitRestrictionsToTablesLimitsRestrictionsInTheContainerToTheGivenTables
‪limitRestrictionsToTablesLimitsRestrictionsInTheContainerToTheGivenTables()
Definition: QueryBuilderTest.php:1480
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\getFirstResultDelegatesToConcreteQueryBuilder
‪getFirstResultDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:216
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\groupByQuotesIdentifierAndDelegatesToConcreteQueryBuilder
‪groupByQuotesIdentifierAndDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:697
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\limitRestrictionsToTables
‪limitRestrictionsToTables(array $tableAliases)
Definition: QueryBuilder.php:129
‪TYPO3\CMS\Core\Database\Query\Restriction\AbstractRestrictionContainer
Definition: AbstractRestrictionContainer.php:28
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\andHavingDelegatesToConcreteQueryBuilder
‪andHavingDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:808
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction
Definition: DeletedRestriction.php:28
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\getParameterType
‪mixed getParameterType($key)
Definition: QueryBuilder.php:318
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\addGroupByQuotesIdentifierAndDelegatesToConcreteQueryBuilder
‪addGroupByQuotesIdentifierAndDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:712
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\addDelegatesToConcreteQueryBuilder
‪addDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:252
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\selectQuotesIdentifiersAndDelegatesToConcreteQueryBuilder
‪selectQuotesIdentifiersAndDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:276
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\deleteQuotesIdentifierAndDelegatesToConcreteQueryBuilder
‪deleteQuotesIdentifierAndDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:473
‪TYPO3\CMS\Core\Database\Query\Restriction\QueryRestrictionContainerInterface\add
‪QueryRestrictionContainerInterface add(QueryRestrictionInterface $restriction)
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\whereDelegatesToConcreteQueryBuilder
‪whereDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:661
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:46
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\count
‪QueryBuilder count(string $item)
Definition: QueryBuilder.php:399
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\countBuildsExpressionAndCallsSelect
‪countBuildsExpressionAndCallsSelect()
Definition: QueryBuilderTest.php:264
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\leftJoinQuotesIdentifiersAndDelegatesToConcreteQueryBuilder
‪leftJoinQuotesIdentifiersAndDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:577
‪TYPO3\CMS\Core\Tests\Unit\Database\Query
Definition: BulkInsertTest.php:18
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\getParametersDelegatesToConcreteQueryBuilder
‪getParametersDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:156
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\$subject
‪QueryBuilder $subject
Definition: QueryBuilderTest.php:54
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\queryRestrictionsAreAddedForCountOnExecute
‪queryRestrictionsAreAddedForCountOnExecute()
Definition: QueryBuilderTest.php:986
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\$concreteQueryBuilder
‪Doctrine DBAL Query QueryBuilder Prophecy Prophecy ObjectProphecy $concreteQueryBuilder
Definition: QueryBuilderTest.php:58
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\where
‪QueryBuilder where(... $predicates)
Definition: QueryBuilder.php:677
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\getTypeDelegatesToConcreteQueryBuilder
‪getTypeDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:94
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\setWithoutNamedParameterQuotesIdentifierAndDelegatesToConcreteQueryBuilder
‪setWithoutNamedParameterQuotesIdentifierAndDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:645
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\resetQueryPartsDelegatesToConcreteQueryBuilder
‪resetQueryPartsDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:886
‪TYPO3\CMS\Core\Database\Query\Restriction\DefaultRestrictionContainer
Definition: DefaultRestrictionContainer.php:24
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\leftJoin
‪QueryBuilder leftJoin(string $fromAlias, string $join, string $alias, string $condition=null)
Definition: QueryBuilder.php:595
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\setQuotesIdentifierAndDelegatesToConcreteQueryBuilder
‪setQuotesIdentifierAndDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:627
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\castFieldToTextType
‪string castFieldToTextType(string $fieldName)
Definition: QueryBuilder.php:1089
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\getStateDelegatesToConcreteQueryBuilder
‪getStateDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:106
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\setWithNamedParameterPassesGivenTypeToCreateNamedParameter
‪setWithNamedParameterPassesGivenTypeToCreateNamedParameter($input, int $type)
Definition: QueryBuilderTest.php:1394
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\getParameterTypesDelegatesToConcreteQueryBuilder
‪getParameterTypesDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:180
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\valuesWithoutNamedParametersQuotesIdentifiersAndDelegatesToConcreteQueryBuilder
‪valuesWithoutNamedParametersQuotesIdentifiersAndDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:781