Skip to content

Commit

Permalink
Add tests for #16837
Browse files Browse the repository at this point in the history
Signed-off-by: William Desportes <williamdes@wdes.fr>
  • Loading branch information
williamdes committed Apr 19, 2021
1 parent 2b8468c commit bfb40ce
Showing 1 changed file with 29 additions and 7 deletions.
36 changes: 29 additions & 7 deletions test/classes/TrackerTest.php
Expand Up @@ -676,20 +676,20 @@ public function getTrackedDataProvider(): array
/**
* Test for Tracker::parseQuery
*
* @param string $query Query to parse
* @param string $type Expected type
* @param string $identifier Expected identifier
* @param string $tablename Expected tablename
* @param string $db Expected dbname
* @param string $tablename_after_rename Expected name after rename
* @param string $query Query to parse
* @param string $type Expected type
* @param string $identifier Expected identifier
* @param string|null $tablename Expected tablename
* @param string|null $db Expected dbname
* @param string|null $tablename_after_rename Expected name after rename
*
* @dataProvider parseQueryData
*/
public function testParseQuery(
string $query,
string $type,
string $identifier,
string $tablename,
?string $tablename,
?string $db = null,
?string $tablename_after_rename = null
): void {
Expand Down Expand Up @@ -734,6 +734,12 @@ public function testParseQuery(
*/
public function parseQueryData(): array
{
// query
// type
// identifier
// table name
// db (optional)
// table name after rename (optional)
$query = [];
/** TODO: Should test fail when USE is in conjunction with * identifiers?
$query[] = array(
Expand Down Expand Up @@ -868,6 +874,22 @@ public function parseQueryData(): array
'TRUNCATE',
't1',
];
$query[] = [
'create table event(' . "\n"
. 'eventID varchar(10) not null,' . "\n"
. 'b char(30),' . "\n"
. 'c varchar(20),' . "\n"
. 'd TIME,' . "\n"
. 'e Date,' . "\n"
. 'f int,' . "\n"
. 'g char(70),' . "\n"
. 'h char(90),' . "\n"
. 'primary key(eventID)' . "\n"
. ')' . "\n",
'DDL',
'CREATE TABLE',
null,// switch this to 'event' when sql-parse is fixed
];

return $query;
}
Expand Down

0 comments on commit bfb40ce

Please sign in to comment.