TYPO3 CMS  TYPO3_7-6
DatabaseSpecificsTest.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
19 
24 {
28  protected $subject;
29 
33  protected function setUp()
34  {
35  $GLOBALS['TYPO3_LOADED_EXT'] = [];
36 
38  $this->subject = GeneralUtility::makeInstance(\TYPO3\CMS\Dbal\Database\Specifics\NullSpecifics::class);
39  }
40 
47  public function determineMetaTypeFromNativeType($nativeType, $expected)
48  {
49  $result = $this->subject->getMetaFieldType($nativeType);
50  $this->assertSame($expected, $result);
51  }
52 
59  public function determineNativeTypeFromMetaType($metaType, $expected)
60  {
61  $result = $this->subject->getNativeFieldType($metaType);
62  $this->assertSame($expected, $result);
63  }
64 
72  public function determineNativeFieldLength($fieldType, $maxLength, $expected)
73  {
74  $result = $this->subject->getNativeFieldLength($fieldType, $maxLength);
75  $this->assertSame($expected, $result);
76  }
77 
81  public function determineMetaTypeProvider()
82  {
83  return [
84  ['INT', 'I8'],
85  ['INTEGER', 'I8'],
86  ['TINYINT', 'I8'],
87  ['SMALLINT', 'I8'],
88  ['MEDIUMINT', 'I8'],
89  ['BIGINT', 'I8'],
90  ['DOUBLE', 'F'],
91  ['FLOAT', 'F'],
92  ['TIME', 'T'],
93  ['TIMESTAMP', 'T'],
94  ['DATETIME', 'T'],
95  ['DATE', 'D'],
96  ['YEAR', 'D'],
97  ['IMAGE', 'B'],
98  ['BLOB', 'B'],
99  ['MEDIUMBLOB', 'B'],
100  ['LONGBLOB', 'B'],
101  ['IMAGE', 'B'],
102  ['TEXT', 'XL'],
103  ['MEDIUMTEXT', 'XL'],
104  ['LONGTEXT', 'XL'],
105  ['STRING', 'C'],
106  ['CHAR', 'C'],
107  ['VARCHAR', 'C'],
108  ['TINYBLOB', 'C'],
109  ['TINYTEXT', 'C'],
110  ['ENUM', 'C'],
111  ['SET', 'C']
112  ];
113  }
114 
118  public function determineNativeTypeProvider()
119  {
120  return [
121  ['C', 'VARCHAR'],
122  ['C2', 'VARCHAR'],
123  ['X', 'LONGTEXT'],
124  ['X2', 'LONGTEXT'],
125  ['XL', 'LONGTEXT'],
126  ['B', 'LONGBLOB'],
127  ['D', 'DATE'],
128  ['T', 'DATETIME'],
129  ['L', 'TINYINT'],
130  ['I', 'BIGINT'],
131  ['I1', 'BIGINT'],
132  ['I2', 'BIGINT'],
133  ['I4', 'BIGINT'],
134  ['I8', 'BIGINT'],
135  ['F', 'DOUBLE'],
136  ['N', 'NUMERIC'],
137  ['U', 'U']
138  ];
139  }
140 
145  {
146  return [
147  ['INT', '4', '(11)'],
148  ['VARCHAR', -1, ''],
149  ['VARCHAR', 30, '(30)']
150  ];
151  }
152 }
if(TYPO3_MODE==='BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']