‪TYPO3CMS  11.5
AbstractRestrictionTestCase.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 Prophecy\Argument;
21 use Prophecy\PhpUnit\ProphecyTrait;
26 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
27 
28 class ‪AbstractRestrictionTestCase extends UnitTestCase
29 {
30  use ProphecyTrait;
31 
35  protected ‪$expressionBuilder;
36 
40  protected function ‪setUp(): void
41  {
42  parent::setUp();
43  $connection = $this->prophesize(Connection::class);
44  $connection->quoteIdentifier(Argument::cetera())->will(static function (‪$args) {
45  return '"' . implode('"."', explode('.', ‪$args[0])) . '"';
46  });
47  $connection->quote(Argument::cetera())->will(static function (‪$args) {
48  return '\'' . ‪$args[0] . '\'';
49  });
50  $connection->getDatabasePlatform()->willReturn(new ‪MockPlatform());
51 
52  $this->expressionBuilder = GeneralUtility::makeInstance(ExpressionBuilder::class, $connection->reveal());
53  }
54 }
‪TYPO3\CMS\Core\Database\Query\Expression\ExpressionBuilder
Definition: ExpressionBuilder.php:36
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\Restriction
Definition: AbstractRestrictionContainerTest.php:18
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\Restriction\AbstractRestrictionTestCase\$expressionBuilder
‪ExpressionBuilder $expressionBuilder
Definition: AbstractRestrictionTestCase.php:33
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\Restriction\AbstractRestrictionTestCase
Definition: AbstractRestrictionTestCase.php:29
‪TYPO3\CMS\Core\Tests\Unit\Database\Mocks\MockPlatform
Definition: MockPlatform.php:24
‪$args
‪$args
Definition: validateRstFiles.php:214
‪TYPO3\CMS\Core\Database\Connection
Definition: Connection.php:38
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:50
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\Restriction\AbstractRestrictionTestCase\setUp
‪setUp()
Definition: AbstractRestrictionTestCase.php:38