TYPO3 CMS  TYPO3_7-6
DatabaseSpecificsPostgresqlTest.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 
18 
23 {
27  protected function setUp()
28  {
29  $GLOBALS['TYPO3_LOADED_EXT'] = [];
30 
32  $this->subject = GeneralUtility::makeInstance($this->buildAccessibleProxy(\TYPO3\CMS\Dbal\Database\Specifics\PostgresSpecifics::class));
33  }
34 
41  public function getNativeDefaultValueStripsPostgresqlCharacterClasses($fieldDefinition, $expected)
42  {
43  $actual = $this->subject->_call('getNativeDefaultValue', $fieldDefinition);
44  $this->assertSame($expected, $actual);
45  }
46 
53  public function getNativeExtraFieldAttributeSetsAutoIncrement($fieldDefinition, $expected)
54  {
55  $actual = $this->subject->_call('getNativeExtraFieldAttributes', $fieldDefinition);
56  $this->assertSame($expected, $actual);
57  }
58 
65  public function getNativeKeyForFieldProviderIdentifiesIndexes($fieldDefinition, $expected)
66  {
67  $actual = $this->subject->_call('getNativeKeyForField', $fieldDefinition);
68  $this->assertSame($expected, $actual);
69  }
70 
74  public function determineMetaTypeProvider()
75  {
76  return [
77  ['INT', 'I4'],
78  ['INTEGER', 'I4'],
79  ['TINYINT', 'I2'],
80  ['SMALLINT', 'I2'],
81  ['MEDIUMINT', 'I4'],
82  ['BIGINT', 'I8'],
83  ['DOUBLE', 'F'],
84  ['FLOAT', 'F'],
85  ['TIME', 'T'],
86  ['TIMESTAMP', 'T'],
87  ['DATETIME', 'T'],
88  ['DATE', 'D'],
89  ['YEAR', 'D'],
90  ['IMAGE', 'B'],
91  ['BLOB', 'B'],
92  ['MEDIUMBLOB', 'B'],
93  ['LONGBLOB', 'B'],
94  ['IMAGE', 'B'],
95  ['TEXT', 'XL'],
96  ['MEDIUMTEXT', 'XL'],
97  ['LONGTEXT', 'XL'],
98  ['STRING', 'C'],
99  ['CHAR', 'C'],
100  ['VARCHAR', 'C'],
101  ['TINYBLOB', 'B'],
102  ['TINYTEXT', 'C'],
103  ['ENUM', 'C'],
104  ['SET', 'C']
105  ];
106  }
107 
111  public function determineNativeTypeProvider()
112  {
113  return [
114  ['C', 'VARCHAR'],
115  ['C2', 'VARCHAR'],
116  ['X', 'LONGTEXT'],
117  ['X2', 'LONGTEXT'],
118  ['XL', 'LONGTEXT'],
119  ['B', 'LONGBLOB'],
120  ['D', 'DATE'],
121  ['T', 'DATETIME'],
122  ['L', 'TINYINT'],
123  ['I', 'INT'],
124  ['I1', 'SMALLINT'],
125  ['I2', 'SMALLINT'],
126  ['I4', 'INT'],
127  ['I8', 'BIGINT'],
128  ['R', 'INT'],
129  ['F', 'DOUBLE'],
130  ['N', 'NUMERIC'],
131  ['U', 'U']
132  ];
133  }
134 
139  {
140  return [
141  ['SMALLINT', '2', '(6)'],
142  ['INT', '4', '(11)'],
143  ['BIGINT', '8', '(20)'],
144  ['VARCHAR', -1, ''],
145  ['VARCHAR', 30, '(30)'],
146  ['DOUBLE', 8, '']
147  ];
148  }
149 
154  {
155  return [
156  [['type' => 'SERIAL', 'has_default' => 1, 'default_value' => "nextval('tx_extensionmanager_domain_model_repository_uid_seq'::regclass)"], null],
157  [['type' => 'int4', 'has_default' => true, 'default_value' => 0], 0],
158  [['type' => 'int4', 'has_default' => true, 'default_value' => '(-1)'], -1],
159  [['type' => 'text', 'has_default' => false, 'default_value' => null], null],
160  [['type' => 'varchar', 'has_default' => true, 'default_value' => "''::character varying"], ''],
161  [['type' => 'varchar', 'has_default' => true, 'default_value' => 'NULL::character varying'], null],
162  [['type' => 'varchar', 'has_default' => true, 'default_value' => "'something'::character varying"], 'something'],
163  [['type' => 'varchar', 'has_default' => true, 'default_value' => "'some''thing'::character varying"], "some''thing"],
164  ];
165  }
166 
171  {
172  return [
173  [['type' => 'SERIAL'], 'auto_increment'],
174  [['type' => 'int4', 'default_value' => 'nextval(\'somesequence_seq\''], 'auto_increment'],
175  [['type' => 'int4', 'default_value' => 0], '']
176  ];
177  }
178 
183  {
184  return [
185  [['primary_key' => true], 'PRI'],
186  [['unique' => true], 'UNI'],
187  [[], '']
188  ];
189  }
190 }
if(TYPO3_MODE==='BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']