‪TYPO3CMS  ‪main
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 
24 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
25 
29 abstract class ‪AbstractDataTypeBaseTestCase extends UnitTestCase
30 {
34  protected const ‪CREATE_TABLE_STATEMENT = 'CREATE TABLE `aTable`(`aField` %s);';
35 
39  protected function ‪createSubject(string $statement): ‪CreateColumnDefinitionItem
40  {
41  $statement = sprintf(static::CREATE_TABLE_STATEMENT, $statement);
42  ‪$parser = new ‪Parser(new ‪Lexer());
44  $createTableStatement = ‪$parser->getAST($statement);
46  $item = $createTableStatement->createDefinition->items[0];
47  return $item;
48  }
49 }
‪TYPO3\CMS\Core\Database\Schema\Parser\AST\CreateTableStatement
Definition: CreateTableStatement.php:26
‪TYPO3\CMS\Core\Tests\Unit\Database\Schema\Parser\AbstractDataTypeBaseTestCase\CREATE_TABLE_STATEMENT
‪const CREATE_TABLE_STATEMENT
Definition: AbstractDataTypeBaseTestCase.php:34
‪TYPO3\CMS\Core\Database\Schema\Parser\AST\CreateColumnDefinitionItem
Definition: CreateColumnDefinitionItem.php:29
‪$parser
‪$parser
Definition: annotationChecker.php:103
‪TYPO3\CMS\Core\Database\Schema\Parser\Parser
Definition: Parser.php:75
‪TYPO3\CMS\Core\Tests\Unit\Database\Schema\Parser\AbstractDataTypeBaseTestCase\createSubject
‪createSubject(string $statement)
Definition: AbstractDataTypeBaseTestCase.php:39
‪TYPO3\CMS\Core\Tests\Unit\Database\Schema\Parser\AbstractDataTypeBaseTestCase
Definition: AbstractDataTypeBaseTestCase.php:30
‪TYPO3\CMS\Core\Tests\Unit\Database\Schema\Parser
Definition: AbstractDataTypeBaseTestCase.php:18
‪TYPO3\CMS\Core\Database\Schema\Parser\Lexer
Definition: Lexer.php:26