Merge pull request #14423 from williamdes/issue-14422-table-comment

Fix tests for regression #14422
This commit is contained in:
Maurício Meneghini Fauth 2018-08-15 23:08:23 -03:00 committed by GitHub
commit 6e2fd70e30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 176 additions and 18 deletions

View File

@ -1267,6 +1267,164 @@ class DbiDummy implements DbiExtension
'query' => "SHOW TABLE STATUS FROM `db` WHERE `Name` LIKE 'table%'",
'result' => [],
],
[
'query' => "SELECT *, `TABLE_SCHEMA` AS `Db`, `TABLE_NAME` AS `Name`,"
. " `TABLE_TYPE` AS `TABLE_TYPE`, `ENGINE` AS `Engine`,"
. " `ENGINE` AS `Type`, `VERSION` AS `Version`, `ROW_FORMAT` AS `Row_format`,"
. " `TABLE_ROWS` AS `Rows`, `AVG_ROW_LENGTH` AS `Avg_row_length`,"
. " `DATA_LENGTH` AS `Data_length`, `MAX_DATA_LENGTH` AS `Max_data_length`,"
. " `INDEX_LENGTH` AS `Index_length`, `DATA_FREE` AS `Data_free`,"
. " `AUTO_INCREMENT` AS `Auto_increment`, `CREATE_TIME` AS `Create_time`,"
. " `UPDATE_TIME` AS `Update_time`, `CHECK_TIME` AS `Check_time`,"
. " `TABLE_COLLATION` AS `Collation`, `CHECKSUM` AS `Checksum`,"
. " `CREATE_OPTIONS` AS `Create_options`, `TABLE_COMMENT` AS `Comment`"
. " FROM `information_schema`.`TABLES` t WHERE `TABLE_SCHEMA` IN ('table1')"
. " AND t.`TABLE_NAME` = 'pma_test' ORDER BY Name ASC",
'columns' => [
'TABLE_CATALOG',
'TABLE_SCHEMA',
'TABLE_NAME',
'TABLE_TYPE',
'ENGINE',
'VERSION',
'ROW_FORMAT',
'TABLE_ROWS',
'AVG_ROW_LENGTH',
'DATA_LENGTH',
'MAX_DATA_LENGTH',
'INDEX_LENGTH',
'DATA_FREE',
'AUTO_INCREMENT',
'CREATE_TIME',
'UPDATE_TIME',
'CHECK_TIME',
'TABLE_COLLATION',
'CHECKSUM',
'CREATE_OPTIONS',
'TABLE_COMMENT',
'Db',
'Name',
'TABLE_TYPE',
'Engine',
'Type',
'Version',
'Row_format',
'Rows',
'Avg_row_length',
'Data_length',
'Max_data_length',
'Index_length',
'Data_free',
'Auto_increment',
'Create_time',
'Update_time',
'Check_time',
'Collation',
'Checksum',
'Create_options',
'Comment',
],
'result' => [
[
'ref',
'pma_test',
'table1',
'BASE TABLE',
'DBIdummy',
'11',
'Redundant',
'123456',
'42',
'21708991',
'281474976710655',// MyISAM
'2048',// MyISAM
'2547',
'5',
'2014-06-24 17:30:00',
'2018-06-25 18:35:12',
'2015-04-24 19:30:59',
'utf8mb4_general_ci',
'3844432963',
'row_format=REDUNDANT',
'Test comment for "table1" in \'pma_test\'',
'table1',
'DBIdummy',
'11',
'Redundant',
'123456',
'42',
'21708991',
'281474976710655',// MyISAM
'2048',// MyISAM
'2547',
'5',
'2014-06-24 17:30:00',
'2018-06-25 18:35:12',
'2015-04-24 19:30:59',
'utf8mb4_general_ci',
'3844432963',
'row_format=REDUNDANT',
'Test comment for "table1" in \'pma_test\'',
]
],
],
[
'query' => "SHOW TABLE STATUS FROM `table1` WHERE `Name` LIKE 'pma\_test%'",
'columns' => [
'Name',
'TABLE_TYPE',
'Engine',
'Type',
'Version',
'Row_format',
'Rows',
'Avg_row_length',
'Data_length',
'Max_data_length',
'Index_length',
'Data_free',
'Auto_increment',
'Create_time',
'Update_time',
'Check_time',
'Collation',
'Checksum',
'Create_options',
'Comment',
],
'result' => [
[
'table1',
'DBIdummy',
'11',
'Redundant',
'123456',
'42',
'21708991',
'281474976710655',// MyISAM
'2048',// MyISAM
'2547',
'5',
'2014-06-24 17:30:00',
'2018-06-25 18:35:12',
'2015-04-24 19:30:59',
'utf8mb4_general_ci',
'3844432963',
'row_format=REDUNDANT',
'Test comment for "table1" in \'pma_test\'',
]
],
],
[
'query' => "SELECT *, CAST(BIN_NAME AS CHAR CHARACTER SET utf8) AS SCHEMA_NAME FROM (SELECT BINARY s.SCHEMA_NAME AS BIN_NAME, s.DEFAULT_COLLATION_NAME FROM `information_schema`.SCHEMATA s WHERE `SCHEMA_NAME` LIKE 'pma_test' GROUP BY BINARY s.SCHEMA_NAME, s.DEFAULT_COLLATION_NAME ORDER BY BINARY `SCHEMA_NAME` ASC) a",
'result' => [
[
'BIN_NAME' => 'pma_test',
'DEFAULT_COLLATION_NAME' => 'utf8mb4_general_ci',
'SCHEMA_NAME' => 'pma_test',
]
],
],
[
'query' => "SELECT @@have_partitioning;",
'result' => [],

View File

@ -1341,11 +1341,11 @@ class TableTest extends PmaTestCase
{
$target_table = 'table1';
$target_db = 'pma_test';
$tbl_object = new Table($target_db, $target_table);
$tbl_object->getStatusInfo(null, true);
$extension = new DbiDummy();
$dbi = new DatabaseInterface($extension);
$expect = '';
$tbl_object = new Table($target_db, $target_table, $dbi);
$tbl_object->getStatusInfo(null, true);
$expect = 'DBIDUMMY';
$tbl_storage_engine = $dbi->getTable(
$target_db,
$target_table
@ -1365,11 +1365,11 @@ class TableTest extends PmaTestCase
{
$target_table = 'table1';
$target_db = 'pma_test';
$tbl_object = new Table($target_db, $target_table);
$tbl_object->getStatusInfo(null, true);
$extension = new DbiDummy();
$dbi = new DatabaseInterface($extension);
$expect = '';
$tbl_object = new Table($target_db, $target_table, $dbi);
$tbl_object->getStatusInfo(null, true);
$expect = 'Test comment for "table1" in \'pma_test\'';
$show_comment = $dbi->getTable(
$target_db,
$target_table
@ -1389,11 +1389,11 @@ class TableTest extends PmaTestCase
{
$target_table = 'table1';
$target_db = 'pma_test';
$tbl_object = new Table($target_db, $target_table);
$tbl_object->getStatusInfo(null, true);
$extension = new DbiDummy();
$dbi = new DatabaseInterface($extension);
$expect = '';
$tbl_object = new Table($target_db, $target_table, $dbi);
$tbl_object->getStatusInfo(null, true);
$expect = 'utf8mb4_general_ci';
$tbl_collation = $dbi->getTable(
$target_db,
$target_table
@ -1413,11 +1413,11 @@ class TableTest extends PmaTestCase
{
$target_table = 'table1';
$target_db = 'pma_test';
$tbl_object = new Table($target_db, $target_table);
$tbl_object->getStatusInfo(null, true);
$extension = new DbiDummy();
$dbi = new DatabaseInterface($extension);
$expect = '';
$tbl_object = new Table($target_db, $target_table, $dbi);
$tbl_object->getStatusInfo(null, true);
$expect = 'Redundant';
$row_format = $dbi->getTable(
$target_db,
$target_table
@ -1437,11 +1437,11 @@ class TableTest extends PmaTestCase
{
$target_table = 'table1';
$target_db = 'pma_test';
$tbl_object = new Table($target_db, $target_table);
$tbl_object->getStatusInfo(null, true);
$extension = new DbiDummy();
$dbi = new DatabaseInterface($extension);
$expect = '';
$tbl_object = new Table($target_db, $target_table, $dbi);
$tbl_object->getStatusInfo(null, true);
$expect = '5';
$auto_increment = $dbi->getTable(
$target_db,
$target_table
@ -1461,11 +1461,11 @@ class TableTest extends PmaTestCase
{
$target_table = 'table1';
$target_db = 'pma_test';
$tbl_object = new Table($target_db, $target_table);
$tbl_object->getStatusInfo(null, true);
$extension = new DbiDummy();
$dbi = new DatabaseInterface($extension);
$expect = ['pack_keys' => 'DEFAULT'];
$tbl_object = new Table($target_db, $target_table, $dbi);
$tbl_object->getStatusInfo(null, true);
$expect = ['pack_keys' => 'DEFAULT', 'row_format' => 'REDUNDANT'];
$create_options = $dbi->getTable(
$target_db,
$target_table