|
6 | 6 | namespace Magento\Framework\DB\Adapter\Pdo;
|
7 | 7 |
|
8 | 8 | use Magento\Framework\App\ResourceConnection;
|
9 |
| -use Magento\Framework\DB\Ddl\Table; |
10 | 9 | use Magento\TestFramework\Helper\Bootstrap;
|
11 | 10 |
|
12 | 11 | class MysqlTest extends \PHPUnit_Framework_TestCase
|
@@ -131,70 +130,4 @@ public function testDescribeTable()
|
131 | 130 | $this->getDbAdapter()->describeTable($tableName)
|
132 | 131 | );
|
133 | 132 | }
|
134 |
| - |
135 |
| - /** |
136 |
| - * Test that Zend_Db_Expr can be used as a column default value. |
137 |
| - * @see https://github.com/magento/magento2/pull/9131 |
138 |
| - */ |
139 |
| - public function testCreateTableColumnWithExpressionAsColumnDefaultValue() |
140 |
| - { |
141 |
| - $adapter = $this->getDbAdapter(); |
142 |
| - $tableName = 'table_column_with_expression_as_column_default_value'; |
143 |
| - |
144 |
| - $table = $adapter |
145 |
| - ->newTable($tableName) |
146 |
| - ->addColumn( |
147 |
| - 'row_id', |
148 |
| - Table::TYPE_INTEGER, |
149 |
| - null, |
150 |
| - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], |
151 |
| - 'Row Id' |
152 |
| - ) |
153 |
| - ->addColumn( |
154 |
| - 'created_at', |
155 |
| - Table::TYPE_DATETIME, |
156 |
| - null, |
157 |
| - ['default' => new \Zend_Db_Expr('CURRENT_TIMESTAMP')] |
158 |
| - ) |
159 |
| - ->addColumn( |
160 |
| - 'integer_column', |
161 |
| - Table::TYPE_INTEGER, |
162 |
| - 11, |
163 |
| - ['default' => 123456] |
164 |
| - )->addColumn( |
165 |
| - 'string_column', |
166 |
| - Table::TYPE_TEXT, |
167 |
| - 255, |
168 |
| - ['default' => 'default test text'] |
169 |
| - ) |
170 |
| - ->setComment('Test table column with expression as column default value'); |
171 |
| - $adapter->createTable($table); |
172 |
| - |
173 |
| - $tableDescription = $adapter->describeTable($tableName); |
174 |
| - |
175 |
| - //clean up database from test table |
176 |
| - $adapter->dropTable($tableName); |
177 |
| - |
178 |
| - $this->assertArrayHasKey('created_at', $tableDescription, 'Column created_at does not exists'); |
179 |
| - $this->assertArrayHasKey('integer_column', $tableDescription, 'Column integer_column does not exists'); |
180 |
| - $this->assertArrayHasKey('string_column', $tableDescription, 'Column string_column does not exists'); |
181 |
| - $dateColumn = $tableDescription['created_at']; |
182 |
| - $intColumn = $tableDescription['integer_column']; |
183 |
| - $stringColumn = $tableDescription['string_column']; |
184 |
| - |
185 |
| - //Test default value with expression |
186 |
| - $this->assertEquals('created_at', $dateColumn['COLUMN_NAME'], 'Incorrect column name'); |
187 |
| - $this->assertEquals(Table::TYPE_DATETIME, $dateColumn['DATA_TYPE'], 'Incorrect column type'); |
188 |
| - $this->assertEquals('CURRENT_TIMESTAMP', $dateColumn['DEFAULT'], 'Incorrect column default expression value'); |
189 |
| - |
190 |
| - //Test default value with integer value |
191 |
| - $this->assertEquals('integer_column', $intColumn['COLUMN_NAME'], 'Incorrect column name'); |
192 |
| - $this->assertEquals('int', $intColumn['DATA_TYPE'], 'Incorrect column type'); |
193 |
| - $this->assertEquals(123456, $intColumn['DEFAULT'], 'Incorrect column default integer value'); |
194 |
| - |
195 |
| - //Test default value with string value |
196 |
| - $this->assertEquals('string_column', $stringColumn['COLUMN_NAME'], 'Incorrect column name'); |
197 |
| - $this->assertEquals('varchar', $stringColumn['DATA_TYPE'], 'Incorrect column type'); |
198 |
| - $this->assertEquals('default test text', $stringColumn['DEFAULT'], 'Incorrect column default string value'); |
199 |
| - } |
200 | 133 | }
|
0 commit comments