‪TYPO3CMS  10.4
ColumnDefinitionItemTest.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 class ‪ColumnDefinitionItemTest extends UnitTestCase
29 {
34  {
35  $subject = $this->‪createSubject('CREATE TABLE `aTable`(checksum VARCHAR(64));');
36 
37  self::assertInstanceOf(CreateColumnDefinitionItem::class, $subject);
38  self::assertSame($subject->columnName->schemaObjectName, 'checksum');
39  }
40 
49  {
50  $subject = $this->‪createSubject('CREATE TABLE `aTable`(aField VARCHAR(64), );');
51 
52  self::assertInstanceOf(CreateColumnDefinitionItem::class, $subject);
53  }
54 
61  protected function ‪createSubject(string $statement): ‪CreateColumnDefinitionItem
62  {
63  ‪$parser = new ‪Parser($statement);
65  $createTableStatement = ‪$parser->getAST();
66 
67  return $createTableStatement->createDefinition->items[0];
68  }
69 }
‪TYPO3\CMS\Core\Tests\Unit\Database\Schema\Parser\ColumnDefinitionItemTest
Definition: ColumnDefinitionItemTest.php:29
‪TYPO3\CMS\Core\Database\Schema\Parser\AST\CreateTableStatement
Definition: CreateTableStatement.php:24
‪TYPO3\CMS\Core\Database\Schema\Parser\AST\CreateColumnDefinitionItem
Definition: CreateColumnDefinitionItem.php:27
‪TYPO3\CMS\Core\Tests\Unit\Database\Schema\Parser\ColumnDefinitionItemTest\createSubject
‪TYPO3 CMS Core Database Schema Parser AST CreateColumnDefinitionItem createSubject(string $statement)
Definition: ColumnDefinitionItemTest.php:61
‪$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\ColumnDefinitionItemTest\canParseCreateDefinitionWithTrailingComma
‪canParseCreateDefinitionWithTrailingComma()
Definition: ColumnDefinitionItemTest.php:48
‪TYPO3\CMS\Core\Tests\Unit\Database\Schema\Parser\ColumnDefinitionItemTest\canParseUnquotedMysqlKeywordAsTableName
‪canParseUnquotedMysqlKeywordAsTableName()
Definition: ColumnDefinitionItemTest.php:33
‪TYPO3\CMS\Core\Tests\Unit\Database\Schema\Parser
Definition: AbstractDataTypeBaseTestCase.php:18