‪TYPO3CMS  9.5
QueryBuilderTest.php
Go to the documentation of this file.
1 <?php
2 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 
18 use Doctrine\DBAL\Platforms\AbstractPlatform;
19 use Doctrine\DBAL\Platforms\MySqlPlatform;
20 use Doctrine\DBAL\Platforms\OraclePlatform;
21 use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
22 use Doctrine\DBAL\Platforms\SqlitePlatform;
23 use Doctrine\DBAL\Platforms\SQLServerPlatform;
24 use Prophecy\Argument;
34 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
35 
39 class ‪QueryBuilderTest extends UnitTestCase
40 {
44  protected ‪$connection;
45 
49  protected ‪$platform;
50 
54  protected ‪$subject;
55 
59  protected ‪$concreteQueryBuilder;
60 
64  protected function ‪setUp(): void
65  {
66  parent::setUp();
67 
68  $this->concreteQueryBuilder = $this->prophesize(\Doctrine\DBAL\Query\QueryBuilder::class);
69 
70  $this->connection = $this->prophesize(Connection::class);
71  $this->connection->getDatabasePlatform()->willReturn(new ‪MockPlatform());
72 
73  $this->subject = new ‪QueryBuilder(
74  $this->connection->reveal(),
75  null,
76  $this->concreteQueryBuilder->reveal()
77  );
78  }
79 
83  public function ‪exprReturnsExpressionBuilderForConnection(): void
84  {
85  $this->connection->getExpressionBuilder()
86  ->shouldBeCalled()
87  ->willReturn(GeneralUtility::makeInstance(ExpressionBuilder::class, $this->connection->reveal()));
88 
89  $this->subject->expr();
90  }
91 
95  public function ‪getTypeDelegatesToConcreteQueryBuilder(): void
96  {
97  $this->concreteQueryBuilder->getType()
98  ->shouldBeCalled()
99  ->willReturn(\Doctrine\DBAL\Query\QueryBuilder::INSERT);
100 
101  $this->subject->getType();
102  }
103 
107  public function ‪getStateDelegatesToConcreteQueryBuilder(): void
108  {
109  $this->concreteQueryBuilder->getState()
110  ->shouldBeCalled()
111  ->willReturn(\Doctrine\DBAL\Query\QueryBuilder::STATE_CLEAN);
112 
113  $this->subject->getState();
114  }
115 
119  public function ‪getSQLDelegatesToConcreteQueryBuilder(): void
120  {
121  $this->concreteQueryBuilder->getSQL()
122  ->shouldBeCalled()
123  ->willReturn('UPDATE aTable SET pid = 7');
124  $this->concreteQueryBuilder->getType()
125  ->willReturn(2); // Update Type
126 
127  $this->subject->getSQL();
128  }
129 
133  public function ‪setParameterDelegatesToConcreteQueryBuilder(): void
134  {
135  $this->concreteQueryBuilder->setParameter(Argument::exact('aField'), Argument::exact(5), Argument::cetera())
136  ->shouldBeCalled()
137  ->willReturn($this->subject);
138 
139  $this->subject->setParameter('aField', 5);
140  }
141 
146  {
147  $this->concreteQueryBuilder->setParameters(Argument::exact(['aField' => 'aValue']), Argument::exact([]))
148  ->shouldBeCalled()
149  ->willReturn($this->subject);
150 
151  $this->subject->setParameters(['aField' => 'aValue']);
152  }
153 
158  {
159  $this->concreteQueryBuilder->getParameters()
160  ->shouldBeCalled()
161  ->willReturn(['aField' => 'aValue']);
162 
163  $this->subject->getParameters();
164  }
165 
169  public function ‪getParameterDelegatesToConcreteQueryBuilder(): void
170  {
171  $this->concreteQueryBuilder->getParameter(Argument::exact('aField'))
172  ->shouldBeCalled()
173  ->willReturn('aValue');
174 
175  $this->subject->getParameter('aField');
176  }
177 
182  {
183  $this->concreteQueryBuilder->getParameterTypes()
184  ->shouldBeCalled()
185  ->willReturn([]);
186 
187  $this->subject->getParameterTypes();
188  }
189 
194  {
195  $this->concreteQueryBuilder->getParameterType(Argument::exact('aField'))
196  ->shouldBeCalled()
197  ->willReturn(‪Connection::PARAM_STR);
198 
199  $this->subject->getParameterType('aField');
200  }
201 
206  {
207  $this->concreteQueryBuilder->setFirstResult(Argument::cetera())
208  ->shouldBeCalled()
209  ->willReturn($this->subject);
210 
211  $this->subject->setFirstResult(1);
212  }
213 
218  {
219  $this->concreteQueryBuilder->getFirstResult()
220  ->shouldBeCalled()
221  ->willReturn(1);
222 
223  $this->subject->getFirstResult();
224  }
225 
230  {
231  $this->concreteQueryBuilder->setMaxResults(Argument::cetera())
232  ->shouldBeCalled()
233  ->willReturn($this->subject);
234 
235  $this->subject->setMaxResults(1);
236  }
237 
242  {
243  $this->concreteQueryBuilder->getMaxResults()
244  ->shouldBeCalled()
245  ->willReturn(1);
246 
247  $this->subject->getMaxResults();
248  }
249 
253  public function ‪addDelegatesToConcreteQueryBuilder(): void
254  {
255  $this->concreteQueryBuilder->add(Argument::exact('select'), Argument::exact('aField'), Argument::cetera())
256  ->shouldBeCalled()
257  ->willReturn($this->subject);
258 
259  $this->subject->add('select', 'aField');
260  }
261 
265  public function ‪countBuildsExpressionAndCallsSelect(): void
266  {
267  $this->concreteQueryBuilder->select(Argument::exact('COUNT(*)'))
268  ->shouldBeCalled()
269  ->willReturn($this->subject);
270 
271  $this->subject->count('*');
272  }
273 
278  {
279  $this->connection->quoteIdentifier('aField')
280  ->shouldBeCalled()
281  ->willReturnArgument(0);
282  $this->connection->quoteIdentifier('anotherField')
283  ->shouldBeCalled()
284  ->willReturnArgument(0);
285  $this->concreteQueryBuilder->select(Argument::exact('aField'), Argument::exact('anotherField'))
286  ->shouldBeCalled()
287  ->willReturn($this->subject);
288 
289  $this->subject->select('aField', 'anotherField');
290  }
291 
295  public function ‪quoteIdentifiersForSelectDataProvider(): array
296  {
297  return [
298  'fieldName' => [
299  'fieldName',
300  '"fieldName"',
301  ],
302  'tableName.fieldName' => [
303  'tableName.fieldName',
304  '"tableName"."fieldName"',
305  ],
306  'tableName.*' => [
307  'tableName.*',
308  '"tableName".*',
309  ],
310  '*' => [
311  '*',
312  '*',
313  ],
314  'fieldName AS anotherFieldName' => [
315  'fieldName AS anotherFieldName',
316  '"fieldName" AS "anotherFieldName"',
317  ],
318  'tableName.fieldName AS anotherFieldName' => [
319  'tableName.fieldName AS anotherFieldName',
320  '"tableName"."fieldName" AS "anotherFieldName"',
321  ],
322  'tableName.fieldName AS anotherTable.anotherFieldName' => [
323  'tableName.fieldName AS anotherTable.anotherFieldName',
324  '"tableName"."fieldName" AS "anotherTable"."anotherFieldName"',
325  ],
326  'fieldName as anotherFieldName' => [
327  'fieldName as anotherFieldName',
328  '"fieldName" AS "anotherFieldName"',
329  ],
330  'tableName.fieldName as anotherFieldName' => [
331  'tableName.fieldName as anotherFieldName',
332  '"tableName"."fieldName" AS "anotherFieldName"',
333  ],
334  'tableName.fieldName as anotherTable.anotherFieldName' => [
335  'tableName.fieldName as anotherTable.anotherFieldName',
336  '"tableName"."fieldName" AS "anotherTable"."anotherFieldName"',
337  ],
338  'fieldName aS anotherFieldName' => [
339  'fieldName aS anotherFieldName',
340  '"fieldName" AS "anotherFieldName"',
341  ],
342  'tableName.fieldName aS anotherFieldName' => [
343  'tableName.fieldName aS anotherFieldName',
344  '"tableName"."fieldName" AS "anotherFieldName"',
345  ],
346  'tableName.fieldName aS anotherTable.anotherFieldName' => [
347  'tableName.fieldName aS anotherTable.anotherFieldName',
348  '"tableName"."fieldName" AS "anotherTable"."anotherFieldName"',
349  ],
350  ];
351  }
352 
359  public function ‪quoteIdentifiersForSelect($identifier, $expectedResult): void
360  {
361  $this->connection->quoteIdentifier(Argument::cetera())->will(
362  function (‪$args) {
364 
365  return ‪$platform->quoteIdentifier(‪$args[0]);
366  }
367  );
368 
369  $this->assertSame([$expectedResult], $this->subject->quoteIdentifiersForSelect([$identifier]));
370  }
371 
375  public function ‪quoteIdentifiersForSelectWithInvalidAlias(): void
376  {
377  $this->expectException(\InvalidArgumentException::class);
378  $this->expectExceptionCode(1461170686);
379 
380  $this->connection->quoteIdentifier(Argument::cetera())->will(
381  function (‪$args) {
383 
384  return ‪$platform->quoteIdentifier(‪$args[0]);
385  }
386  );
387  $this->subject->quoteIdentifiersForSelect(['aField AS anotherField,someField AS someThing']);
388  }
389 
393  public function ‪selectDoesNotQuoteStarPlaceholder(): void
394  {
395  $this->connection->quoteIdentifier('aField')
396  ->shouldBeCalled()
397  ->willReturnArgument(0);
398  $this->connection->quoteIdentifier('*')
399  ->shouldNotBeCalled();
400  $this->concreteQueryBuilder->select(Argument::exact('aField'), Argument::exact('*'))
401  ->shouldBeCalled()
402  ->willReturn($this->subject);
403 
404  $this->subject->select('aField', '*');
405  }
406 
411  {
412  $this->connection->quoteIdentifier('aField')
413  ->shouldBeCalled()
414  ->willReturnArgument(0);
415  $this->connection->quoteIdentifier('anotherField')
416  ->shouldBeCalled()
417  ->willReturnArgument(0);
418  $this->concreteQueryBuilder->addSelect(Argument::exact('aField'), Argument::exact('anotherField'))
419  ->shouldBeCalled()
420  ->willReturn($this->subject);
421 
422  $this->subject->addSelect('aField', 'anotherField');
423  }
424 
428  public function ‪addSelectDoesNotQuoteStarPlaceholder(): void
429  {
430  $this->connection->quoteIdentifier('aField')
431  ->shouldBeCalled()
432  ->willReturnArgument(0);
433  $this->connection->quoteIdentifier('*')
434  ->shouldNotBeCalled();
435  $this->concreteQueryBuilder->addSelect(Argument::exact('aField'), Argument::exact('*'))
436  ->shouldBeCalled()
437  ->willReturn($this->subject);
438 
439  $this->subject->addSelect('aField', '*');
440  }
441 
446  {
447  $this->connection->quoteIdentifier(Argument::cetera())
448  ->shouldNotBeCalled();
449  $this->concreteQueryBuilder->select(Argument::exact('MAX(aField) AS anAlias'))
450  ->shouldBeCalled()
451  ->willReturn($this->subject);
452 
453  $this->subject->selectLiteral('MAX(aField) AS anAlias');
454  }
455 
460  {
461  $this->connection->quoteIdentifier(Argument::cetera())
462  ->shouldNotBeCalled();
463  $this->concreteQueryBuilder->addSelect(Argument::exact('MAX(aField) AS anAlias'))
464  ->shouldBeCalled()
465  ->willReturn($this->subject);
466 
467  $this->subject->addSelectLiteral('MAX(aField) AS anAlias');
468  }
469 
475  {
476  $this->connection->quoteIdentifier('aTable')
477  ->shouldBeCalled()
478  ->willReturnArgument(0);
479  $this->concreteQueryBuilder->delete(Argument::exact('aTable'), Argument::cetera())
480  ->shouldBeCalled()
481  ->willReturn($this->subject);
482 
483  $this->subject->delete('aTable');
484  }
485 
491  {
492  $this->connection->quoteIdentifier('aTable')
493  ->shouldBeCalled()
494  ->willReturnArgument(0);
495  $this->concreteQueryBuilder->update(Argument::exact('aTable'), Argument::cetera())
496  ->shouldBeCalled()
497  ->willReturn($this->subject);
498 
499  $this->subject->update('aTable');
500  }
501 
506  {
507  $this->connection->quoteIdentifier('aTable')
508  ->shouldBeCalled()
509  ->willReturnArgument(0);
510  $this->concreteQueryBuilder->insert(Argument::exact('aTable'))
511  ->shouldBeCalled()
512  ->willReturn($this->subject);
513 
514  $this->subject->insert('aTable');
515  }
516 
522  {
523  $this->connection->quoteIdentifier('aTable')
524  ->shouldBeCalled()
525  ->willReturnArgument(0);
526  $this->concreteQueryBuilder->from(Argument::exact('aTable'), Argument::cetera())
527  ->shouldBeCalled()
528  ->willReturn($this->subject);
529 
530  $this->subject->from('aTable');
531  }
532 
537  {
538  $this->connection->quoteIdentifier('fromAlias')
539  ->shouldBeCalled()
540  ->willReturnArgument(0);
541  $this->connection->quoteIdentifier('join')
542  ->shouldBeCalled()
543  ->willReturnArgument(0);
544  $this->connection->quoteIdentifier('alias')
545  ->shouldBeCalled()
546  ->willReturnArgument(0);
547  $this->concreteQueryBuilder->innerJoin('fromAlias', 'join', 'alias', null)
548  ->shouldBeCalled()
549  ->willReturn($this->subject);
550 
551  $this->subject->join('fromAlias', 'join', 'alias');
552  }
553 
558  {
559  $this->connection->quoteIdentifier('fromAlias')
560  ->shouldBeCalled()
561  ->willReturnArgument(0);
562  $this->connection->quoteIdentifier('join')
563  ->shouldBeCalled()
564  ->willReturnArgument(0);
565  $this->connection->quoteIdentifier('alias')
566  ->shouldBeCalled()
567  ->willReturnArgument(0);
568  $this->concreteQueryBuilder->innerJoin('fromAlias', 'join', 'alias', null)
569  ->shouldBeCalled()
570  ->willReturn($this->subject);
571 
572  $this->subject->innerJoin('fromAlias', 'join', 'alias');
573  }
574 
579  {
580  $this->connection->quoteIdentifier('fromAlias')
581  ->shouldBeCalled()
582  ->willReturnArgument(0);
583  $this->connection->quoteIdentifier('join')
584  ->shouldBeCalled()
585  ->willReturnArgument(0);
586  $this->connection->quoteIdentifier('alias')
587  ->shouldBeCalled()
588  ->willReturnArgument(0);
589  $this->concreteQueryBuilder->leftJoin('fromAlias', 'join', 'alias', null)
590  ->shouldBeCalled()
591  ->willReturn($this->subject);
592 
593  $this->subject->leftJoin('fromAlias', 'join', 'alias');
594  }
595 
600  {
601  $this->connection->quoteIdentifier('fromAlias')
602  ->shouldBeCalled()
603  ->willReturnArgument(0);
604  $this->connection->quoteIdentifier('join')
605  ->shouldBeCalled()
606  ->willReturnArgument(0);
607  $this->connection->quoteIdentifier('alias')
608  ->shouldBeCalled()
609  ->willReturnArgument(0);
610  $this->concreteQueryBuilder->rightJoin('fromAlias', 'join', 'alias', null)
611  ->shouldBeCalled()
612  ->willReturn($this->subject);
613 
614  $this->subject->rightJoin('fromAlias', 'join', 'alias');
615  }
616 
621  {
622  $this->connection->quoteIdentifier('aField')
623  ->shouldBeCalled()
624  ->willReturnArgument(0);
625  $this->concreteQueryBuilder->createNamedParameter('aValue', Argument::cetera())
626  ->shouldBeCalled()
627  ->willReturn(':dcValue1');
628  $this->concreteQueryBuilder->set('aField', ':dcValue1')
629  ->shouldBeCalled()
630  ->willReturn($this->subject);
631 
632  $this->subject->set('aField', 'aValue');
633  }
634 
639  {
640  $this->connection->quoteIdentifier('aField')
641  ->shouldBeCalled()
642  ->willReturnArgument(0);
643  $this->concreteQueryBuilder->createNamedParameter(Argument::cetera())->shouldNotBeCalled();
644  $this->concreteQueryBuilder->set('aField', 'aValue')
645  ->shouldBeCalled()
646  ->willReturn($this->subject);
647 
648  $this->subject->set('aField', 'aValue', false);
649  }
650 
654  public function ‪whereDelegatesToConcreteQueryBuilder(): void
655  {
656  $this->concreteQueryBuilder->where('uid=1', 'type=9')
657  ->shouldBeCalled()
658  ->willReturn($this->subject);
659 
660  $this->subject->where('uid=1', 'type=9');
661  }
662 
666  public function ‪andWhereDelegatesToConcreteQueryBuilder(): void
667  {
668  $this->concreteQueryBuilder->andWhere('uid=1', 'type=9')
669  ->shouldBeCalled()
670  ->willReturn($this->subject);
671 
672  $this->subject->andWhere('uid=1', 'type=9');
673  }
674 
678  public function ‪orWhereDelegatesToConcreteQueryBuilder(): void
679  {
680  $this->concreteQueryBuilder->orWhere('uid=1', 'type=9')
681  ->shouldBeCalled()
682  ->willReturn($this->subject);
683 
684  $this->subject->orWhere('uid=1', 'type=9');
685  }
686 
691  {
692  $this->connection->quoteIdentifiers(['aField', 'anotherField'])
693  ->shouldBeCalled()
694  ->willReturnArgument(0);
695  $this->concreteQueryBuilder->groupBy('aField', 'anotherField')
696  ->shouldBeCalled()
697  ->willReturn($this->subject);
698 
699  $this->subject->groupBy('aField', 'anotherField');
700  }
701 
706  {
707  $this->connection->quoteIdentifiers(['aField', 'anotherField'])
708  ->shouldBeCalled()
709  ->willReturnArgument(0);
710  $this->concreteQueryBuilder->addGroupBy('aField', 'anotherField')
711  ->shouldBeCalled()
712  ->willReturn($this->subject);
713 
714  $this->subject->addGroupBy('aField', 'anotherField');
715  }
716 
721  {
722  $this->connection->quoteIdentifier('aField')
723  ->shouldBeCalled()
724  ->willReturnArgument(0);
725  $this->concreteQueryBuilder->createNamedParameter('aValue', Argument::cetera())
726  ->shouldBeCalled()
727  ->willReturn(':dcValue1');
728  $this->concreteQueryBuilder->setValue('aField', ':dcValue1')
729  ->shouldBeCalled()
730  ->willReturn($this->subject);
731 
732  $this->subject->setValue('aField', 'aValue');
733  }
734 
739  {
740  $this->connection->quoteIdentifier('aField')
741  ->shouldBeCalled()
742  ->willReturnArgument(0);
743  $this->concreteQueryBuilder->setValue('aField', 'aValue')
744  ->shouldBeCalled()
745  ->willReturn($this->subject);
746 
747  $this->subject->setValue('aField', 'aValue', false);
748  }
749 
754  {
755  $this->connection->quoteColumnValuePairs(['aField' => ':dcValue1', 'aValue' => ':dcValue2'])
756  ->shouldBeCalled()
757  ->willReturnArgument(0);
758  $this->concreteQueryBuilder->createNamedParameter(1, Argument::cetera())
759  ->shouldBeCalled()
760  ->willReturn(':dcValue1');
761  $this->concreteQueryBuilder->createNamedParameter(2, Argument::cetera())
762  ->shouldBeCalled()
763  ->willReturn(':dcValue2');
764  $this->concreteQueryBuilder->values(['aField' => ':dcValue1', 'aValue' => ':dcValue2'])
765  ->shouldBeCalled()
766  ->willReturn($this->subject);
767 
768  $this->subject->values(['aField' => 1, 'aValue' => 2]);
769  }
770 
775  {
776  $this->connection->quoteColumnValuePairs(['aField' => 1, 'aValue' => 2])
777  ->shouldBeCalled()
778  ->willReturnArgument(0);
779  $this->concreteQueryBuilder->values(['aField' => 1, 'aValue' => 2])
780  ->shouldBeCalled()
781  ->willReturn($this->subject);
782 
783  $this->subject->values(['aField' => 1, 'aValue' => 2], false);
784  }
785 
789  public function ‪havingDelegatesToConcreteQueryBuilder(): void
790  {
791  $this->concreteQueryBuilder->having('uid=1', 'type=9')
792  ->shouldBeCalled()
793  ->willReturn($this->subject);
794 
795  $this->subject->having('uid=1', 'type=9');
796  }
797 
801  public function ‪andHavingDelegatesToConcreteQueryBuilder(): void
802  {
803  $this->concreteQueryBuilder->andHaving('uid=1', 'type=9')
804  ->shouldBeCalled()
805  ->willReturn($this->subject);
806 
807  $this->subject->andHaving('uid=1', 'type=9');
808  }
809 
813  public function ‪orHavingDelegatesToConcreteQueryBuilder(): void
814  {
815  $this->concreteQueryBuilder->orHaving('uid=1', 'type=9')
816  ->shouldBeCalled()
817  ->willReturn($this->subject);
818 
819  $this->subject->orHaving('uid=1', 'type=9');
820  }
821 
826  {
827  $this->connection->quoteIdentifier('aField')
828  ->shouldBeCalled()
829  ->willReturnArgument(0);
830  $this->concreteQueryBuilder->orderBy('aField', null)
831  ->shouldBeCalled()
832  ->willReturn($this->subject);
833 
834  $this->subject->orderBy('aField');
835  }
836 
841  {
842  $this->connection->quoteIdentifier('aField')
843  ->shouldBeCalled()
844  ->willReturnArgument(0);
845  $this->concreteQueryBuilder->addOrderBy('aField', 'DESC')
846  ->shouldBeCalled()
847  ->willReturn($this->subject);
848 
849  $this->subject->addOrderBy('aField', 'DESC');
850  }
851 
855  public function ‪getQueryPartDelegatesToConcreteQueryBuilder(): void
856  {
857  $this->concreteQueryBuilder->getQueryPart('from')
858  ->shouldBeCalled()
859  ->willReturn('aTable');
860 
861  $this->subject->getQueryPart('from');
862  }
863 
868  {
869  $this->concreteQueryBuilder->getQueryParts()
870  ->shouldBeCalled()
871  ->willReturn([]);
872 
873  $this->subject->getQueryParts();
874  }
875 
880  {
881  $this->concreteQueryBuilder->resetQueryParts(['select', 'from'])
882  ->shouldBeCalled()
883  ->willReturn($this->subject);
884 
885  $this->subject->resetQueryParts(['select', 'from']);
886  }
887 
892  {
893  $this->concreteQueryBuilder->resetQueryPart('select')
894  ->shouldBeCalled()
895  ->willReturn($this->subject);
896 
897  $this->subject->resetQueryPart('select');
898  }
899 
904  {
905  $this->concreteQueryBuilder->createNamedParameter(5, Argument::cetera())
906  ->shouldBeCalled()
907  ->willReturn(':dcValue1');
908 
909  $this->subject->createNamedParameter(5);
910  }
911 
916  {
917  $this->concreteQueryBuilder->createPositionalParameter(5, Argument::cetera())
918  ->shouldBeCalled()
919  ->willReturn('?');
920 
921  $this->subject->createPositionalParameter(5);
922  }
923 
927  public function ‪queryRestrictionsAreAddedForSelectOnExecute(): void
928  {
929  ‪$GLOBALS['TCA']['pages']['ctrl'] = [
930  'tstamp' => 'tstamp',
931  'versioningWS' => true,
932  'delete' => 'deleted',
933  'crdate' => 'crdate',
934  'enablecolumns' => [
935  'disabled' => 'hidden',
936  ],
937  ];
938 
939  $this->connection->quoteIdentifier(Argument::cetera())
940  ->willReturnArgument(0);
941  $this->connection->quoteIdentifiers(Argument::cetera())
942  ->willReturnArgument(0);
943 
944  $connectionBuilder = GeneralUtility::makeInstance(
945  \Doctrine\DBAL\Query\QueryBuilder::class,
946  $this->connection->reveal()
947  );
948 
949  $expressionBuilder = GeneralUtility::makeInstance(ExpressionBuilder::class, $this->connection->reveal());
950  $this->connection->getExpressionBuilder()
951  ->willReturn($expressionBuilder);
952 
953  ‪$subject = GeneralUtility::makeInstance(
954  QueryBuilder::class,
955  $this->connection->reveal(),
956  null,
957  $connectionBuilder
958  );
959 
960  ‪$subject->‪select('*')
961  ->‪from('pages')
962  ->‪where('uid=1');
963 
964  $expectedSQL = 'SELECT * FROM pages WHERE (uid=1) AND ((pages.deleted = 0) AND (pages.hidden = 0))';
965  $this->connection->executeQuery($expectedSQL, Argument::cetera())
966  ->shouldBeCalled();
967 
969  }
970 
974  public function ‪queryRestrictionsAreAddedForCountOnExecute(): void
975  {
976  ‪$GLOBALS['TCA']['pages']['ctrl'] = [
977  'tstamp' => 'tstamp',
978  'versioningWS' => true,
979  'delete' => 'deleted',
980  'crdate' => 'crdate',
981  'enablecolumns' => [
982  'disabled' => 'hidden',
983  ],
984  ];
985 
986  $this->connection->quoteIdentifier(Argument::cetera())
987  ->willReturnArgument(0);
988  $this->connection->quoteIdentifiers(Argument::cetera())
989  ->willReturnArgument(0);
990 
991  $connectionBuilder = GeneralUtility::makeInstance(
992  \Doctrine\DBAL\Query\QueryBuilder::class,
993  $this->connection->reveal()
994  );
995 
996  $expressionBuilder = GeneralUtility::makeInstance(ExpressionBuilder::class, $this->connection->reveal());
997  $this->connection->getExpressionBuilder()
998  ->willReturn($expressionBuilder);
999 
1000  ‪$subject = GeneralUtility::makeInstance(
1001  QueryBuilder::class,
1002  $this->connection->reveal(),
1003  null,
1004  $connectionBuilder
1005  );
1006 
1007  ‪$subject->‪count('uid')
1008  ->‪from('pages')
1009  ->‪where('uid=1');
1010 
1011  $expectedSQL = 'SELECT COUNT(uid) FROM pages WHERE (uid=1) AND ((pages.deleted = 0) AND (pages.hidden = 0))';
1012  $this->connection->executeQuery($expectedSQL, Argument::cetera())
1013  ->shouldBeCalled();
1014 
1016  }
1022  {
1023  ‪$GLOBALS['TCA']['pages']['ctrl'] = [
1024  'tstamp' => 'tstamp',
1025  'versioningWS' => true,
1026  'delete' => 'deleted',
1027  'crdate' => 'crdate',
1028  'enablecolumns' => [
1029  'disabled' => 'hidden',
1030  ],
1031  ];
1032 
1033  $this->connection->quoteIdentifier(Argument::cetera())
1034  ->willReturnArgument(0);
1035  $this->connection->quoteIdentifiers(Argument::cetera())
1036  ->willReturnArgument(0);
1037  $this->connection->getExpressionBuilder()
1038  ->willReturn(GeneralUtility::makeInstance(ExpressionBuilder::class, $this->connection->reveal()));
1039 
1040  ‪$concreteQueryBuilder = GeneralUtility::makeInstance(
1041  \Doctrine\DBAL\Query\QueryBuilder::class,
1042  $this->connection->reveal()
1043  );
1044 
1045  ‪$subject = GeneralUtility::makeInstance(
1046  QueryBuilder::class,
1047  $this->connection->reveal(),
1048  null,
1050  );
1051 
1052  ‪$subject->‪select('*')
1053  ->‪from('pages')
1054  ->‪where('uid=1');
1055 
1056  $expectedSQL = 'SELECT * FROM pages WHERE (uid=1) AND ((pages.deleted = 0) AND (pages.hidden = 0))';
1057  $this->assertSame($expectedSQL, ‪$subject->‪getSQL());
1058 
1060 
1061  $expectedSQL = 'SELECT * FROM pages WHERE (uid=1) AND (pages.deleted = 0)';
1062  $this->assertSame($expectedSQL, ‪$subject->‪getSQL());
1063  }
1069  {
1070  ‪$GLOBALS['TCA']['pages']['ctrl'] = [
1071  'tstamp' => 'tstamp',
1072  'versioningWS' => true,
1073  'delete' => 'deleted',
1074  'crdate' => 'crdate',
1075  'enablecolumns' => [
1076  'disabled' => 'hidden',
1077  ],
1078  ];
1079 
1080  $this->connection->quoteIdentifier(Argument::cetera())
1081  ->willReturnArgument(0);
1082  $this->connection->quoteIdentifiers(Argument::cetera())
1083  ->willReturnArgument(0);
1084  $this->connection->getExpressionBuilder()
1085  ->willReturn(GeneralUtility::makeInstance(ExpressionBuilder::class, $this->connection->reveal()));
1086 
1087  ‪$concreteQueryBuilder = GeneralUtility::makeInstance(
1088  \Doctrine\DBAL\Query\QueryBuilder::class,
1089  $this->connection->reveal()
1090  );
1091 
1092  ‪$subject = GeneralUtility::makeInstance(
1093  QueryBuilder::class,
1094  $this->connection->reveal(),
1095  null,
1097  );
1098 
1099  ‪$subject->‪select('*')
1100  ->‪from('pages')
1101  ->‪where('uid=1');
1102 
1104 
1105  $expectedSQL = 'SELECT * FROM pages WHERE (uid=1) AND (pages.deleted = 0)';
1106  $this->connection->executeQuery($expectedSQL, Argument::cetera())
1107  ->shouldBeCalled();
1108 
1110 
1112 
1113  $expectedSQL = 'SELECT * FROM pages WHERE (uid=1) AND ((pages.deleted = 0) AND (pages.hidden = 0))';
1114  $this->connection->executeQuery($expectedSQL, Argument::cetera())
1115  ->shouldBeCalled();
1116 
1118  }
1124  {
1125  $this->concreteQueryBuilder->getQueryPart('from')
1126  ->shouldBeCalled()
1127  ->willReturn([
1128  [
1129  'table' => 'aTable',
1130  ],
1131  ]);
1132  $this->concreteQueryBuilder->getQueryPart('join')
1133  ->shouldBeCalled()
1134  ->willReturn([
1135  'aTable' => [
1136  [
1137  'joinType' => 'inner',
1138  'joinTable' => 'aTable',
1139  'joinAlias' => 'aTable_alias'
1140  ]
1141  ]
1142  ]);
1143  $result = $this->callInaccessibleMethod($this->subject, 'getQueriedTables');
1144 
1145  $expected = [
1146  'aTable' => 'aTable',
1147  'aTable_alias' => 'aTable'
1148  ];
1149  $this->assertEquals($expected, $result);
1150  }
1156  {
1157  return [
1158  'mysql' => [
1159  'platform' => MySqlPlatform::class,
1160  'quoteChar' => '`',
1161  'input' => '`anIdentifier`',
1162  'expected' => 'anIdentifier',
1163  ],
1164  'mysql with spaces' => [
1165  'platform' => MySqlPlatform::class,
1166  'quoteChar' => '`',
1167  'input' => ' `anIdentifier` ',
1168  'expected' => 'anIdentifier',
1169  ],
1170  'postgres' => [
1171  'platform' => PostgreSqlPlatform::class,
1172  'quoteChar' => '"',
1173  'input' => '"anIdentifier"',
1174  'expected' => 'anIdentifier',
1175  ],
1176  'mssql' => [
1177  'platform' => SQLServerPlatform::class,
1178  'quoteChar' => '', // no single quote character, but [ and ]
1179  'input' => '[anIdentifier]',
1180  'expected' => 'anIdentifier',
1181  ],
1182  ];
1183  }
1184 
1193  public function ‪unquoteSingleIdentifierUnquotesCorrectlyOnDifferentPlatforms(string ‪$platform, string $quoteChar, string $input, string $expected): void
1194  {
1195  $connectionProphecy = $this->prophesize(Connection::class);
1196  $databasePlatformProphecy = $this->prophesize(‪$platform);
1197  $databasePlatformProphecy->getIdentifierQuoteCharacter()->willReturn($quoteChar);
1198  $connectionProphecy->getDatabasePlatform()->willReturn($databasePlatformProphecy);
1199  ‪$subject = GeneralUtility::makeInstance(QueryBuilder::class, $connectionProphecy->reveal());
1200  $result = $this->callInaccessibleMethod(‪$subject, 'unquoteSingleIdentifier', $input);
1201  $this->assertEquals($expected, $result);
1202  }
1207  public function ‪cloningQueryBuilderClonesConcreteQueryBuilder(): void
1208  {
1209  $clonedQueryBuilder = clone ‪$this->subject;
1210  self::assertNotSame($this->subject->getConcreteQueryBuilder(), $clonedQueryBuilder->getConcreteQueryBuilder());
1211  }
1217  {
1218  ‪$GLOBALS['TCA']['pages']['ctrl'] = [
1219  'tstamp' => 'tstamp',
1220  'versioningWS' => true,
1221  'delete' => 'deleted',
1222  'crdate' => 'crdate',
1223  'enablecolumns' => [
1224  'disabled' => 'hidden',
1225  ],
1226  ];
1227 
1228  $this->connection->quoteIdentifier(Argument::cetera())
1229  ->willReturnArgument(0);
1230  $this->connection->quoteIdentifiers(Argument::cetera())
1231  ->willReturnArgument(0);
1232  $this->connection->getExpressionBuilder()
1233  ->willReturn(GeneralUtility::makeInstance(ExpressionBuilder::class, $this->connection->reveal()));
1234 
1235  ‪$concreteQueryBuilder = GeneralUtility::makeInstance(
1236  \Doctrine\DBAL\Query\QueryBuilder::class,
1237  $this->connection->reveal()
1238  );
1239 
1240  ‪$subject = GeneralUtility::makeInstance(
1241  QueryBuilder::class,
1242  $this->connection->reveal(),
1243  null,
1245  );
1246 
1247  ‪$subject->‪select('*')
1248  ->‪from('pages')
1249  ->‪where('uid=1');
1250 
1251  $expectedSQL = 'SELECT * FROM pages WHERE (uid=1) AND ((pages.deleted = 0) AND (pages.hidden = 0))';
1252  $this->assertSame($expectedSQL, ‪$subject->‪getSQL());
1253 
1254  $clonedQueryBuilder = clone ‪$subject;
1255  //just after cloning both query builders should return the same sql
1256  $this->assertSame($expectedSQL, $clonedQueryBuilder->getSQL());
1257 
1258  //change cloned QueryBuilder
1259  $clonedQueryBuilder->count('*');
1260  $expectedCountSQL = 'SELECT COUNT(*) FROM pages WHERE (uid=1) AND ((pages.deleted = 0) AND (pages.hidden = 0))';
1261  $this->assertSame($expectedCountSQL, $clonedQueryBuilder->getSQL());
1262 
1263  //check if the original QueryBuilder has not changed
1264  $this->assertSame($expectedSQL, ‪$subject->‪getSQL());
1265 
1266  //change restrictions in the original QueryBuilder and check if cloned has changed
1268  $expectedSQL = 'SELECT * FROM pages WHERE (uid=1) AND (pages.deleted = 0)';
1269  $this->assertSame($expectedSQL, ‪$subject->‪getSQL());
1270 
1271  $this->assertSame($expectedCountSQL, $clonedQueryBuilder->getSQL());
1272  }
1278  {
1279  $restrictionClass = get_class($this->prophesize(QueryRestrictionInterface::class)->reveal());
1280  $queryBuilder = new ‪QueryBuilder(
1281  $this->connection->reveal(),
1282  null,
1283  $this->concreteQueryBuilder->reveal(),
1284  [
1285  $restrictionClass => [],
1286  ]
1287  );
1288 
1289  $container = $this->prophesize(AbstractRestrictionContainer::class);
1290  $container->add(new $restrictionClass())->shouldBeCalled();
1291 
1292  $queryBuilder->setRestrictions($container->reveal());
1293  }
1299  {
1300  $restrictionClass = get_class($this->prophesize(QueryRestrictionInterface::class)->reveal());
1301  ‪$GLOBALS['TYPO3_CONF_VARS']['DB']['additionalQueryRestrictions'][$restrictionClass] = [];
1302  $queryBuilder = new ‪QueryBuilder(
1303  $this->connection->reveal(),
1304  null,
1305  $this->concreteQueryBuilder->reveal()
1306  );
1307 
1308  $container = $this->prophesize(AbstractRestrictionContainer::class);
1309  $container->add(new $restrictionClass())->shouldBeCalled();
1310 
1311  $queryBuilder->setRestrictions($container->reveal());
1312  }
1318  {
1319  $restrictionClass = get_class($this->prophesize(QueryRestrictionInterface::class)->reveal());
1320  ‪$GLOBALS['TYPO3_CONF_VARS']['DB']['additionalQueryRestrictions'][$restrictionClass] = ['disabled' => true];
1321  $queryBuilder = new ‪QueryBuilder(
1322  $this->connection->reveal(),
1323  null,
1324  $this->concreteQueryBuilder->reveal()
1325  );
1326 
1327  $container = $this->prophesize(AbstractRestrictionContainer::class);
1328  $container->add(new $restrictionClass())->shouldNotBeCalled();
1329 
1330  $queryBuilder->setRestrictions($container->reveal());
1331  }
1337  {
1338  $restrictionClass = get_class($this->prophesize(QueryRestrictionInterface::class)->reveal());
1339  $queryBuilder = new ‪QueryBuilder(
1340  $this->connection->reveal(),
1341  null,
1342  $this->concreteQueryBuilder->reveal(),
1343  [
1344  $restrictionClass => [],
1345  ]
1346  );
1347 
1348  $container = $this->prophesize(DefaultRestrictionContainer::class);
1349  $container->add(new $restrictionClass())->shouldBeCalled();
1350  GeneralUtility::addInstance(DefaultRestrictionContainer::class, $container->reveal());
1352  $queryBuilder->resetRestrictions();
1353  }
1354 
1355  public function ‪castFieldToTextTypeDataProvider(): array
1356  {
1357  return [
1358  'Test cast for MySqlPlatform' => [
1359  new MySqlPlatform(),
1360  'CONVERT(aField, CHAR)'
1361  ],
1362  'Test cast for PostgreSqlPlatform' => [
1363  new PostgreSqlPlatform(),
1364  'aField::text'
1365  ],
1366  'Test cast for SqlitePlatform' => [
1367  new SqlitePlatform(),
1368  'CAST(aField as TEXT)'
1369  ],
1370  'Test cast for SQLServerPlatform' => [
1371  new SQLServerPlatform(),
1372  'CAST(aField as VARCHAR)'
1373  ],
1374  'Test cast for OraclePlatform' => [
1375  new OraclePlatform(),
1376  'CAST(aField as VARCHAR)'
1377  ],
1378  ];
1379  }
1380 
1388  public function ‪castFieldToTextType(AbstractPlatform ‪$platform, string $expectation): void
1389  {
1390  $this->connection->quoteIdentifier('aField')
1391  ->shouldBeCalled()
1392  ->willReturnArgument(0);
1393 
1394  $this->connection->getDatabasePlatform()->willReturn(‪$platform);
1395 
1396  ‪$concreteQueryBuilder = new \Doctrine\DBAL\Query\QueryBuilder($this->connection->reveal());
1397 
1398  ‪$subject = new ‪QueryBuilder($this->connection->reveal(), null, ‪$concreteQueryBuilder);
1399  $result = ‪$subject->‪castFieldToTextType('aField');
1400 
1401  $this->connection->quoteIdentifier('aField')->shouldHaveBeenCalled();
1402  self::assertSame($expectation, $result);
1403  }
1404 }
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\queryRestrictionsAreAddedForSelectOnExecute
‪queryRestrictionsAreAddedForSelectOnExecute()
Definition: QueryBuilderTest.php:923
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\valuesQuotesIdentifiersAndDelegatesToConcreteQueryBuilder
‪valuesQuotesIdentifiersAndDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:749
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\havingDelegatesToConcreteQueryBuilder
‪havingDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:785
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\resetRestrictions
‪resetRestrictions()
Definition: QueryBuilder.php:111
‪TYPO3\CMS\Core\Database\Query\Expression\ExpressionBuilder
Definition: ExpressionBuilder.php:33
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\queryRestrictionsAreReevaluatedOnSettingsChangeForGetSQL
‪queryRestrictionsAreReevaluatedOnSettingsChangeForGetSQL()
Definition: QueryBuilderTest.php:1017
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\select
‪QueryBuilder select(string ... $selects)
Definition: QueryBuilder.php:390
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\queryRestrictionsAreReevaluatedOnSettingsChangeForExecute
‪queryRestrictionsAreReevaluatedOnSettingsChangeForExecute()
Definition: QueryBuilderTest.php:1064
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\addOrderByQuotesIdentifierAndDelegatesToConcreteQueryBuilder
‪addOrderByQuotesIdentifierAndDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:836
‪$args
‪$args
Definition: checkIntegrityCsvFixtures.php:230
‪TYPO3\CMS\Core\Database\Query\Restriction\QueryRestrictionInterface
Definition: QueryRestrictionInterface.php:25
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\getQueryPartsDelegatesToConcreteQueryBuilder
‪getQueryPartsDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:863
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\rightJoinQuotesIdentifiersAndDelegatesToConcreteQueryBuilder
‪rightJoinQuotesIdentifiersAndDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:595
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\castFieldToTextTypeDataProvider
‪castFieldToTextTypeDataProvider()
Definition: QueryBuilderTest.php:1351
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\quoteIdentifiersForSelectWithInvalidAlias
‪quoteIdentifiersForSelectWithInvalidAlias()
Definition: QueryBuilderTest.php:371
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\quoteIdentifiersForSelect
‪quoteIdentifiersForSelect($identifier, $expectedResult)
Definition: QueryBuilderTest.php:355
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\getQueryPartDelegatesToConcreteQueryBuilder
‪getQueryPartDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:851
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\castFieldToTextType
‪castFieldToTextType(AbstractPlatform $platform, string $expectation)
Definition: QueryBuilderTest.php:1384
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\createNamedParameterDelegatesToConcreteQueryBuilder
‪createNamedParameterDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:899
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\resetQueryPartDelegatesToConcreteQueryBuilder
‪resetQueryPartDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:887
‪TYPO3\CMS\Core\Database\Query\Restriction\QueryRestrictionContainerInterface\removeAll
‪QueryRestrictionContainerInterface removeAll()
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\setValueWithoudNamedParameterQuotesIdentifierAndDelegatesToConcreteQueryBuilder
‪setValueWithoudNamedParameterQuotesIdentifierAndDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:734
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\createPositionalParameterDelegatesToConcreteQueryBuilder
‪createPositionalParameterDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:911
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\getMaxResultsDelegatesToConcreteQueryBuilder
‪getMaxResultsDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:237
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\settingRestrictionContainerWillAddAdditionalRestrictionsFromConfiguration
‪settingRestrictionContainerWillAddAdditionalRestrictionsFromConfiguration()
Definition: QueryBuilderTest.php:1294
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\getRestrictions
‪QueryRestrictionContainerInterface getRestrictions()
Definition: QueryBuilder.php:89
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\resettingToDefaultRestrictionContainerWillAddAdditionalRestrictionsFromConfiguration
‪resettingToDefaultRestrictionContainerWillAddAdditionalRestrictionsFromConfiguration()
Definition: QueryBuilderTest.php:1332
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\getSQLDelegatesToConcreteQueryBuilder
‪getSQLDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:115
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\selectLiteralDirectlyDelegatesToConcreteQueryBuilder
‪selectLiteralDirectlyDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:441
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\updateQuotesIdentifierAndDelegatesToConcreteQueryBuilder
‪updateQuotesIdentifierAndDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:486
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\$platform
‪AbstractPlatform $platform
Definition: QueryBuilderTest.php:47
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\innerJoinQuotesIdentifiersAndDelegatesToConcreteQueryBuilder
‪innerJoinQuotesIdentifiersAndDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:553
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest
Definition: QueryBuilderTest.php:40
‪TYPO3\CMS\Core\Database\Connection\PARAM_STR
‪const PARAM_STR
Definition: Connection.php:47
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\exprReturnsExpressionBuilderForConnection
‪exprReturnsExpressionBuilderForConnection()
Definition: QueryBuilderTest.php:79
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\setMaxResultsDelegatesToConcreteQueryBuilder
‪setMaxResultsDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:225
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\setValueQuotesIdentifierAndDelegatesToConcreteQueryBuilder
‪setValueQuotesIdentifierAndDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:716
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\setParametersDelegatesToConcreteQueryBuilder
‪setParametersDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:141
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\joinQuotesIdentifiersAndDelegatesToConcreteQueryBuilder
‪joinQuotesIdentifiersAndDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:532
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\quoteIdentifiersForSelectDataProvider
‪array quoteIdentifiersForSelectDataProvider()
Definition: QueryBuilderTest.php:291
‪TYPO3\CMS\Core\Database\Query\QueryBuilder
Definition: QueryBuilder.php:47
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\from
‪QueryBuilder from(string $from, string $alias=null)
Definition: QueryBuilder.php:506
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\getSQL
‪string getSQL()
Definition: QueryBuilder.php:204
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\fromQuotesIdentifierAndDelegatesToConcreteQueryBuilder
‪fromQuotesIdentifierAndDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:517
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\settingRestrictionContainerWillAddAdditionalRestrictionsFromConstructor
‪settingRestrictionContainerWillAddAdditionalRestrictionsFromConstructor()
Definition: QueryBuilderTest.php:1273
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\getQueriedTablesReturnsSameTableTwiceForInnerJoin
‪getQueriedTablesReturnsSameTableTwiceForInnerJoin()
Definition: QueryBuilderTest.php:1119
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\unquoteSingleIdentifierUnquotesCorrectlyOnDifferentPlatforms
‪unquoteSingleIdentifierUnquotesCorrectlyOnDifferentPlatforms(string $platform, string $quoteChar, string $input, string $expected)
Definition: QueryBuilderTest.php:1189
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\cloningQueryBuilderClonesConcreteQueryBuilder
‪cloningQueryBuilderClonesConcreteQueryBuilder()
Definition: QueryBuilderTest.php:1203
‪TYPO3\CMS\Core\Tests\Unit\Database\Mocks\MockPlatform
Definition: MockPlatform.php:21
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\unquoteSingleIdentifierUnquotesCorrectlyOnDifferentPlatformsDataProvider
‪array unquoteSingleIdentifierUnquotesCorrectlyOnDifferentPlatformsDataProvider()
Definition: QueryBuilderTest.php:1151
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\addSelectLiteralDirectlyDelegatesToConcreteQueryBuilder
‪addSelectLiteralDirectlyDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:455
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\getParameterDelegatesToConcreteQueryBuilder
‪getParameterDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:165
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\insertQuotesIdentifierAndDelegatesToConcreteQueryBuilder
‪insertQuotesIdentifierAndDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:501
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\setUp
‪setUp()
Definition: QueryBuilderTest.php:60
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\settingRestrictionContainerWillNotAddAdditionalRestrictionsFromConfigurationIfNotDisabled
‪settingRestrictionContainerWillNotAddAdditionalRestrictionsFromConfigurationIfNotDisabled()
Definition: QueryBuilderTest.php:1313
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\getParameterTypeDelegatesToConcreteQueryBuilder
‪getParameterTypeDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:189
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\andWhereDelegatesToConcreteQueryBuilder
‪andWhereDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:662
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\orderByQuotesIdentifierAndDelegatesToConcreteQueryBuilder
‪orderByQuotesIdentifierAndDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:821
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\addSelectQuotesIdentifiersAndDelegatesToConcreteQueryBuilder
‪addSelectQuotesIdentifiersAndDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:406
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\$connection
‪Connection Prophecy Prophecy ObjectProphecy $connection
Definition: QueryBuilderTest.php:43
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\addSelectDoesNotQuoteStarPlaceholder
‪addSelectDoesNotQuoteStarPlaceholder()
Definition: QueryBuilderTest.php:424
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\setParameterDelegatesToConcreteQueryBuilder
‪setParameterDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:129
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\orHavingDelegatesToConcreteQueryBuilder
‪orHavingDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:809
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\execute
‪Doctrine DBAL Driver Statement int execute()
Definition: QueryBuilder.php:178
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\setFirstResultDelegatesToConcreteQueryBuilder
‪setFirstResultDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:201
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\selectDoesNotQuoteStarPlaceholder
‪selectDoesNotQuoteStarPlaceholder()
Definition: QueryBuilderTest.php:389
‪TYPO3\CMS\Core\Database\Connection
Definition: Connection.php:31
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\orWhereDelegatesToConcreteQueryBuilder
‪orWhereDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:674
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\changingClonedQueryBuilderDoesNotInfluenceSourceOne
‪changingClonedQueryBuilderDoesNotInfluenceSourceOne()
Definition: QueryBuilderTest.php:1212
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\getFirstResultDelegatesToConcreteQueryBuilder
‪getFirstResultDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:213
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\groupByQuotesIdentifierAndDelegatesToConcreteQueryBuilder
‪groupByQuotesIdentifierAndDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:686
‪TYPO3\CMS\Core\Database\Query\Restriction\AbstractRestrictionContainer
Definition: AbstractRestrictionContainer.php:26
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\andHavingDelegatesToConcreteQueryBuilder
‪andHavingDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:797
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction
Definition: DeletedRestriction.php:26
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\addGroupByQuotesIdentifierAndDelegatesToConcreteQueryBuilder
‪addGroupByQuotesIdentifierAndDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:701
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\addDelegatesToConcreteQueryBuilder
‪addDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:249
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\selectQuotesIdentifiersAndDelegatesToConcreteQueryBuilder
‪selectQuotesIdentifiersAndDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:273
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\deleteQuotesIdentifierAndDelegatesToConcreteQueryBuilder
‪deleteQuotesIdentifierAndDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:470
‪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:650
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\count
‪QueryBuilder count(string $item)
Definition: QueryBuilder.php:373
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\countBuildsExpressionAndCallsSelect
‪countBuildsExpressionAndCallsSelect()
Definition: QueryBuilderTest.php:261
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\leftJoinQuotesIdentifiersAndDelegatesToConcreteQueryBuilder
‪leftJoinQuotesIdentifiersAndDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:574
‪TYPO3\CMS\Core\Tests\Unit\Database\Query
Definition: BulkInsertTest.php:3
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\getParametersDelegatesToConcreteQueryBuilder
‪getParametersDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:153
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\$subject
‪QueryBuilder $subject
Definition: QueryBuilderTest.php:51
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\queryRestrictionsAreAddedForCountOnExecute
‪queryRestrictionsAreAddedForCountOnExecute()
Definition: QueryBuilderTest.php:970
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\$concreteQueryBuilder
‪Doctrine DBAL Query QueryBuilder Prophecy Prophecy ObjectProphecy $concreteQueryBuilder
Definition: QueryBuilderTest.php:55
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\where
‪QueryBuilder where(... $predicates)
Definition: QueryBuilder.php:630
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\getTypeDelegatesToConcreteQueryBuilder
‪getTypeDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:91
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\setWithoutNamedParameterQuotesIdentifierAndDelegatesToConcreteQueryBuilder
‪setWithoutNamedParameterQuotesIdentifierAndDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:634
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\resetQueryPartsDelegatesToConcreteQueryBuilder
‪resetQueryPartsDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:875
‪TYPO3\CMS\Core\Database\Query\Restriction\DefaultRestrictionContainer
Definition: DefaultRestrictionContainer.php:22
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\setQuotesIdentifierAndDelegatesToConcreteQueryBuilder
‪setQuotesIdentifierAndDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:616
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\castFieldToTextType
‪string castFieldToTextType(string $fieldName)
Definition: QueryBuilder.php:1042
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\getStateDelegatesToConcreteQueryBuilder
‪getStateDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:103
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\getParameterTypesDelegatesToConcreteQueryBuilder
‪getParameterTypesDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:177
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\QueryBuilderTest\valuesWithoutNamedParametersQuotesIdentifiersAndDelegatesToConcreteQueryBuilder
‪valuesWithoutNamedParametersQuotesIdentifiersAndDelegatesToConcreteQueryBuilder()
Definition: QueryBuilderTest.php:770