Skip to content

Commit

Permalink
[update] query test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
catfan committed Dec 4, 2024
1 parent f5a77ca commit 54b3402
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions tests/QueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ public function testQueryWithPrefix()
'prefix' => 'PREFIX_'
]);

$database->type = "sqlite";

$database->query("SELECT <account.name> FROM <account>");

$this->assertQuery(
Expand All @@ -68,8 +66,6 @@ public function testQueryTableWithPrefix()
'prefix' => 'PREFIX_'
]);

$database->type = "sqlite";

$database->query("DROP TABLE IF EXISTS <account>");

$this->assertQuery(
Expand All @@ -80,6 +76,28 @@ public function testQueryTableWithPrefix()
);
}

/**
* @covers ::query()
* @covers ::isRaw()
* @covers ::buildRaw()
*/
public function testQueryShowTableWithPrefix()
{
$database = new Medoo([
'testMode' => true,
'prefix' => 'PREFIX_'
]);

$database->query("SHOW TABLES LIKE <account>");

$this->assertQuery(
<<<EOD
SHOW TABLES LIKE "PREFIX_account"
EOD,
$database->queryString
);
}

/**
* @covers ::query()
* @covers ::isRaw()
Expand Down Expand Up @@ -120,8 +138,6 @@ public function testQueryEscape()
'prefix' => 'PREFIX_'
]);

$database->type = "sqlite";

$database->query("SELECT * FROM <account> WHERE <name> = '<John>'");

$this->assertQuery(
Expand Down

0 comments on commit 54b3402

Please sign in to comment.