‪TYPO3CMS  10.4
AbstractDataTypeBaseTestCase.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 
23 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
24 
28 abstract class ‪AbstractDataTypeBaseTestCase extends UnitTestCase
29 {
33  const ‪CREATE_TABLE_STATEMENT = 'CREATE TABLE `aTable`(`aField` %s);';
34 
41  protected function ‪createTableStatement(string $columnDefinition): string
42  {
43  return sprintf(static::CREATE_TABLE_STATEMENT, $columnDefinition);
44  }
45 
52  protected function ‪createSubject(string $statement): ‪CreateColumnDefinitionItem
53  {
54  ‪$parser = new ‪Parser($this->‪createTableStatement($statement));
56  $createTableStatement = ‪$parser->getAST();
57 
58  return $createTableStatement->createDefinition->items[0];
59  }
60 }
‪TYPO3\CMS\Core\Database\Schema\Parser\AST\CreateTableStatement
Definition: CreateTableStatement.php:24
‪TYPO3\CMS\Core\Tests\Unit\Database\Schema\Parser\AbstractDataTypeBaseTestCase\CREATE_TABLE_STATEMENT
‪const CREATE_TABLE_STATEMENT
Definition: AbstractDataTypeBaseTestCase.php:33
‪TYPO3\CMS\Core\Database\Schema\Parser\AST\CreateColumnDefinitionItem
Definition: CreateColumnDefinitionItem.php:27
‪TYPO3\CMS\Core\Tests\Unit\Database\Schema\Parser\AbstractDataTypeBaseTestCase\createTableStatement
‪string createTableStatement(string $columnDefinition)
Definition: AbstractDataTypeBaseTestCase.php:41
‪$parser
‪$parser
Definition: annotationChecker.php:108
‪TYPO3\CMS\Core\Database\Schema\Parser\Parser
Definition: Parser.php:71
‪TYPO3\CMS\Core\Tests\Unit\Database\Schema\Parser\AbstractDataTypeBaseTestCase\createSubject
‪TYPO3 CMS Core Database Schema Parser AST CreateColumnDefinitionItem createSubject(string $statement)
Definition: AbstractDataTypeBaseTestCase.php:52
‪TYPO3\CMS\Core\Tests\Unit\Database\Schema\Parser\AbstractDataTypeBaseTestCase
Definition: AbstractDataTypeBaseTestCase.php:29
‪TYPO3\CMS\Core\Tests\Unit\Database\Schema\Parser
Definition: AbstractDataTypeBaseTestCase.php:18