[core] add a test suite for SQL features
This commit is contained in:
parent
61f13c6794
commit
8cb87b2469
2 changed files with 24 additions and 0 deletions
|
@ -44,6 +44,7 @@ class MySQL extends DBEngine
|
|||
public function init(PDO $db): void
|
||||
{
|
||||
$db->exec("SET NAMES utf8;");
|
||||
$db->exec("SET SESSION sql_mode='ANSI,TRADITIONAL';");
|
||||
}
|
||||
|
||||
public function scoreql_to_sql(string $data): string
|
||||
|
|
23
core/tests/SQLTest.php
Normal file
23
core/tests/SQLTest.php
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Shimmie2;
|
||||
|
||||
/**
|
||||
* Because various SQL engines have wildly different support for
|
||||
* various SQL features, and sometimes they are silently incompatible,
|
||||
* here's a test suite to ensure that certain features give predictable
|
||||
* results on all engines and thus can be considered safe to use.
|
||||
*/
|
||||
class SQLTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testConcatPipes(): void
|
||||
{
|
||||
global $database;
|
||||
$this->assertEquals(
|
||||
"foobar",
|
||||
$database->get_one("SELECT 'foo' || 'bar'")
|
||||
);
|
||||
}
|
||||
}
|
Reference in a new issue