‪TYPO3CMS  ‪main
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 
24 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
25 
26 class ‪AbstractRestrictionTestCase extends UnitTestCase
27 {
29 
33  protected function ‪setUp(): void
34  {
35  parent::setUp();
36  $connection = $this->createMock(Connection::class);
37  $connection->method('quoteIdentifier')->willReturnCallback(static function (string ‪$identifier): string {
38  return '"' . implode('"."', explode('.', ‪$identifier)) . '"';
39  });
40  $connection->method('quote')->willReturnCallback(static function (string $value): string {
41  return '\'' . $value . '\'';
42  });
43  $connection->method('getDatabasePlatform')->willReturn(new ‪MockMySQLPlatform());
44 
45  $this->expressionBuilder = GeneralUtility::makeInstance(ExpressionBuilder::class, $connection);
46  }
47 }
‪TYPO3\CMS\Core\Database\Query\Expression\ExpressionBuilder
Definition: ExpressionBuilder.php:40
‪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:28
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\Restriction\AbstractRestrictionTestCase
Definition: AbstractRestrictionTestCase.php:27
‪TYPO3\CMS\Core\Database\Connection
Definition: Connection.php:41
‪TYPO3\CMS\Core\Tests\Unit\Database\Mocks\MockPlatform\MockMySQLPlatform
Definition: MockMySQLPlatform.php:24
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:52
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\Restriction\AbstractRestrictionTestCase\setUp
‪setUp()
Definition: AbstractRestrictionTestCase.php:33
‪TYPO3\CMS\Webhooks\Message\$identifier
‪identifier readonly string $identifier
Definition: FileAddedMessage.php:37