Fix unit tests

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
This commit is contained in:
Kamil Tekiela 2024-04-22 22:56:33 +02:00
parent d381057f0b
commit bb37e649b9
2 changed files with 47 additions and 3 deletions

View File

@ -850,9 +850,8 @@ class Table implements Stringable
}
// tested also for a view, in MySQL 5.0.92, 5.1.55 and 5.5.13
$GLOBALS['sql_query'] = '
RENAME TABLE ' . $this->getFullName(true) . '
TO ' . $newTable->getFullName(true) . ';';
$GLOBALS['sql_query'] = 'RENAME TABLE ' . $this->getFullName(true) . ' TO '
. $newTable->getFullName(true) . ';';
// I don't think a specific error message for views is necessary
if ($this->dbi->tryQuery($GLOBALS['sql_query']) === false) {
$this->errors[] = $this->dbi->getError();

View File

@ -203,6 +203,37 @@ class TableTest extends AbstractTestCase
],
],
],
[
'SELECT TRIGGER_SCHEMA, TRIGGER_NAME, EVENT_MANIPULATION, EVENT_OBJECT_TABLE, ACTION_TIMING, '
. 'ACTION_STATEMENT, EVENT_OBJECT_SCHEMA, EVENT_OBJECT_TABLE, DEFINER FROM '
. "information_schema.TRIGGERS WHERE EVENT_OBJECT_SCHEMA COLLATE utf8_bin= 'PMA' "
. "AND EVENT_OBJECT_TABLE COLLATE utf8_bin = 'PMA_BookMark';",
null,
null,
ConnectionType::User,
[
[],
],
],
[
'SELECT TRIGGER_SCHEMA, TRIGGER_NAME, EVENT_MANIPULATION, EVENT_OBJECT_TABLE, ACTION_TIMING, '
. 'ACTION_STATEMENT, EVENT_OBJECT_SCHEMA, EVENT_OBJECT_TABLE, DEFINER FROM '
. "information_schema.TRIGGERS WHERE EVENT_OBJECT_SCHEMA COLLATE utf8_bin= 'aa' "
. "AND EVENT_OBJECT_TABLE COLLATE utf8_bin = 'ad';",
null,
null,
ConnectionType::User,
[
[],
],
],
[
'SHOW COLUMNS FROM `aa`.`ad`',
null,
null,
ConnectionType::User,
[],
],
];
$fetchValue = [
@ -1382,6 +1413,20 @@ class TableTest extends AbstractTestCase
$resultStub,
],
['USE `aa`', ConnectionType::User, DatabaseInterface::QUERY_BUFFERED, true, $resultStub],
[
'RENAME TABLE `PMA`.`PMA_BookMark` TO `PMA`.`PMA_.BookMark`;',
ConnectionType::User,
DatabaseInterface::QUERY_BUFFERED,
true,
false,
],
[
'RENAME TABLE `aa`.`ad` TO `bb`.`ad`;',
ConnectionType::User,
DatabaseInterface::QUERY_BUFFERED,
true,
false,
],
]);
$resultStub->expects(self::any())
->method('fetchRow')