‪TYPO3CMS  ‪main
MockPlatform.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\Connection;
21 use Doctrine\DBAL\Platforms\AbstractPlatform as DoctrineAbstractPlatform;
22 
23 use Doctrine\DBAL\Platforms\DateIntervalUnit;
24 use Doctrine\DBAL\Platforms\Exception\NotSupported;
25 use Doctrine\DBAL\Platforms\Keywords\KeywordList;
26 use Doctrine\DBAL\Schema\AbstractSchemaManager;
27 use Doctrine\DBAL\Schema\TableDiff;
28 use Doctrine\DBAL\TransactionIsolationLevel;
30 
31 class ‪MockPlatform extends DoctrineAbstractPlatform
32 {
36  public string ‪$stringLiteralQuoteChar = '"';
37 
41  public function ‪getBlobTypeDeclarationSQL(array $field): string
42  {
43  return '';
44  }
45 
49  public function ‪getBooleanTypeDeclarationSQL(array $columnDef): string
50  {
51  return '';
52  }
53 
57  public function ‪getIntegerTypeDeclarationSQL(array $columnDef): string
58  {
59  return '';
60  }
61 
65  public function ‪getBigIntTypeDeclarationSQL(array $columnDef): string
66  {
67  return '';
68  }
69 
73  public function ‪getSmallIntTypeDeclarationSQL(array $columnDef): string
74  {
75  return '';
76  }
77 
81  public function ‪_getCommonIntegerTypeDeclarationSQL(array $columnDef): string
82  {
83  return '';
84  }
85 
89  public function ‪getVarcharTypeDeclarationSQL(array $field): string
90  {
91  return 'DUMMYVARCHAR()';
92  }
93 
97  public function ‪getClobTypeDeclarationSQL(array $field): string
98  {
99  return 'DUMMYCLOB';
100  }
101 
110  public function ‪getJsonTypeDeclarationSQL(array $field): string
111  {
112  return 'DUMMYJSON';
113  }
114 
120  public function ‪getBinaryTypeDeclarationSQL(array $field): string
121  {
122  return 'DUMMYBINARY';
123  }
124 
128  protected function ‪initializeDoctrineTypeMappings(): void {}
129 
137  protected function ‪getVarcharTypeDeclarationSQLSnippet($length): string
138  {
139  return '';
140  }
141 
148  protected function ‪getReservedKeywordsClass(): string
149  {
150  return MockKeywordList::class;
151  }
152 
153  public function ‪getCurrentDatabaseExpression(): string
154  {
155  return "''";
156  }
157 
158  public function ‪getLocateExpression(string $string, string $substring, ?string $start = null): string
159  {
160  return '';
161  }
162 
163  public function ‪getDateDiffExpression(string $date1, string $date2): string
164  {
165  return '';
166  }
167 
169  string $date,
170  string $operator,
171  string $interval,
172  DateIntervalUnit $unit,
173  ): string {
174  return '';
175  }
176 
180  public function getAlterTableSQL(TableDiff $diff): array
181  {
182  return [];
183  }
184 
185  public function getListViewsSQL(string $database): string
186  {
187  return '';
188  }
189 
190  public function getSetTransactionIsolationSQL(TransactionIsolationLevel $level): string
191  {
192  return '';
193  }
194 
195  public function getDateTimeTypeDeclarationSQL(array $column): string
196  {
197  return '';
198  }
199 
200  public function getDateTypeDeclarationSQL(array $column): string
201  {
202  return '';
203  }
204 
205  public function getTimeTypeDeclarationSQL(array $column): string
206  {
207  return '';
208  }
209 
210  protected function createReservedKeywordsList(): KeywordList
211  {
212  return new class () extends KeywordList {
213  protected function getKeywords(): array
214  {
215  return [];
216  }
217  };
218  }
219 
220  public function createSchemaManager(Connection $connection): AbstractSchemaManager
221  {
222  throw NotSupported::new(__METHOD__);
223  }
224 
228  public function quoteStringLiteral(string $str): string
229  {
231  if ($quoteChar === '') {
232  return $str;
233  }
234  return $quoteChar . str_replace($quoteChar, $quoteChar . $quoteChar, $str) . $quoteChar;
235  }
236 }
‪TYPO3\CMS\Core\Tests\Unit\Database\Mocks\MockPlatform\MockPlatform\getBlobTypeDeclarationSQL
‪getBlobTypeDeclarationSQL(array $field)
Definition: MockPlatform.php:41
‪TYPO3\CMS\Core\Tests\Unit\Database\Mocks\MockPlatform\MockPlatform\getBigIntTypeDeclarationSQL
‪getBigIntTypeDeclarationSQL(array $columnDef)
Definition: MockPlatform.php:65
‪TYPO3\CMS\Core\Tests\Unit\Database\Mocks\MockKeywordList
Definition: MockKeywordList.php:23
‪TYPO3\CMS\Core\Tests\Unit\Database\Mocks\MockPlatform\MockPlatform\getJsonTypeDeclarationSQL
‪getJsonTypeDeclarationSQL(array $field)
Definition: MockPlatform.php:110
‪TYPO3\CMS\Core\Tests\Unit\Database\Mocks\MockPlatform\MockPlatform\getBinaryTypeDeclarationSQL
‪getBinaryTypeDeclarationSQL(array $field)
Definition: MockPlatform.php:120
‪TYPO3\CMS\Core\Tests\Unit\Database\Mocks\MockPlatform\MockPlatform\getDateDiffExpression
‪getDateDiffExpression(string $date1, string $date2)
Definition: MockPlatform.php:163
‪TYPO3\CMS\Core\Tests\Unit\Database\Mocks\MockPlatform\MockPlatform\$stringLiteralQuoteChar
‪string $stringLiteralQuoteChar
Definition: MockPlatform.php:36
‪TYPO3\CMS\Core\Tests\Unit\Database\Mocks\MockPlatform\MockPlatform\getVarcharTypeDeclarationSQL
‪getVarcharTypeDeclarationSQL(array $field)
Definition: MockPlatform.php:89
‪TYPO3\CMS\Core\Tests\Unit\Database\Mocks\MockPlatform\MockPlatform\getBooleanTypeDeclarationSQL
‪getBooleanTypeDeclarationSQL(array $columnDef)
Definition: MockPlatform.php:49
‪TYPO3\CMS\Core\Tests\Unit\Database\Mocks\MockPlatform\MockPlatform\getClobTypeDeclarationSQL
‪getClobTypeDeclarationSQL(array $field)
Definition: MockPlatform.php:97
‪TYPO3\CMS\Core\Tests\Unit\Database\Mocks\MockPlatform\MockPlatform\getReservedKeywordsClass
‪getReservedKeywordsClass()
Definition: MockPlatform.php:148
‪TYPO3\CMS\Core\Tests\Unit\Database\Mocks\MockPlatform\MockPlatform\getIntegerTypeDeclarationSQL
‪getIntegerTypeDeclarationSQL(array $columnDef)
Definition: MockPlatform.php:57
‪TYPO3\CMS\Core\Tests\Unit\Database\Mocks\MockPlatform
Definition: MockMariaDBPlatform.php:18
‪TYPO3\CMS\Core\Tests\Unit\Database\Mocks\MockPlatform\MockPlatform\getSmallIntTypeDeclarationSQL
‪getSmallIntTypeDeclarationSQL(array $columnDef)
Definition: MockPlatform.php:73
‪TYPO3\CMS\Core\Tests\Unit\Database\Mocks\MockPlatform\MockPlatform\getVarcharTypeDeclarationSQLSnippet
‪string getVarcharTypeDeclarationSQLSnippet($length)
Definition: MockPlatform.php:137
‪TYPO3\CMS\Core\Tests\Unit\Database\Mocks\MockPlatform\MockPlatform\getCurrentDatabaseExpression
‪getCurrentDatabaseExpression()
Definition: MockPlatform.php:153
‪TYPO3\CMS\Core\Tests\Unit\Database\Mocks\MockPlatform\MockPlatform\getDateArithmeticIntervalExpression
‪getDateArithmeticIntervalExpression(string $date, string $operator, string $interval, DateIntervalUnit $unit,)
Definition: MockPlatform.php:168
‪TYPO3\CMS\Core\Tests\Unit\Database\Mocks\MockPlatform\MockPlatform\initializeDoctrineTypeMappings
‪initializeDoctrineTypeMappings()
Definition: MockPlatform.php:128
‪TYPO3\CMS\Core\Tests\Unit\Database\Mocks\MockPlatform\MockPlatform\_getCommonIntegerTypeDeclarationSQL
‪_getCommonIntegerTypeDeclarationSQL(array $columnDef)
Definition: MockPlatform.php:81
‪TYPO3\CMS\Core\Tests\Unit\Database\Mocks\MockPlatform\MockPlatform\getLocateExpression
‪getLocateExpression(string $string, string $substring, ?string $start=null)
Definition: MockPlatform.php:158
‪TYPO3\CMS\Core\Tests\Unit\Database\Mocks\MockPlatform\MockPlatform
Definition: MockPlatform.php:32