Update tests
This commit is contained in:
parent
834c4e39df
commit
675e6eff66
@ -90,9 +90,12 @@ abstract class BaseDriverTest extends TestCase {
|
||||
public function testGetViews(): void
|
||||
{
|
||||
$views = self::$db->getViews();
|
||||
$expected = ['numbersview', 'testview'];
|
||||
$this->assertEqual($expected, array_values($views));
|
||||
|
||||
$this->assertTrue(\is_array($views));
|
||||
foreach (['numbersview', 'testview'] as $searchView)
|
||||
{
|
||||
$this->assertTrue(in_array($searchView, $views, TRUE));
|
||||
}
|
||||
}
|
||||
|
||||
public function testGetTriggers(): void
|
||||
|
@ -22,6 +22,7 @@ use TypeError;
|
||||
/**
|
||||
* MySQLTest class.
|
||||
*
|
||||
* @covers \Query\Drivers\Mysql\Driver
|
||||
* @requires extension pdo_mysql
|
||||
*/
|
||||
class MySQLDriverTest extends BaseDriverTest {
|
||||
@ -153,7 +154,7 @@ SQL;
|
||||
|
||||
public function testCommitTransaction(): void
|
||||
{
|
||||
$res = self::$db->beginTransaction();
|
||||
$this->assertTrue(self::$db->beginTransaction());
|
||||
|
||||
$sql = 'INSERT INTO `create_test` (`id`, `key`, `val`) VALUES (10, 12, 14)';
|
||||
self::$db->query($sql);
|
||||
@ -164,7 +165,7 @@ SQL;
|
||||
|
||||
public function testRollbackTransaction(): void
|
||||
{
|
||||
$res = self::$db->beginTransaction();
|
||||
$this->assertTrue(self::$db->beginTransaction());
|
||||
|
||||
$sql = 'INSERT INTO `create_test` (`id`, `key`, `val`) VALUES (182, 96, 43)';
|
||||
self::$db->query($sql);
|
||||
@ -175,7 +176,7 @@ SQL;
|
||||
|
||||
public function testGetSchemas(): void
|
||||
{
|
||||
$this->assertNull(self::$db->getSchemas());
|
||||
$this->assertEqual(['test'], self::$db->getSchemas());
|
||||
}
|
||||
|
||||
public function testGetSequences(): void
|
||||
|
@ -24,6 +24,7 @@ use TypeError;
|
||||
*
|
||||
* @extends DBTest
|
||||
* @requires extension pdo_pgsql
|
||||
* @covers \Query\Drivers\Pgsql\Driver
|
||||
*/
|
||||
class PgSQLDriverTest extends BaseDriverTest {
|
||||
|
||||
|
@ -24,6 +24,7 @@ use Query\Tests\BaseDriverTest;
|
||||
*
|
||||
* @extends DBTest
|
||||
* @requires extension pdo_sqlite
|
||||
* @covers \Query\Drivers\Sqlite\Driver
|
||||
*/
|
||||
class SQLiteDriverTest extends BaseDriverTest {
|
||||
|
||||
@ -177,7 +178,6 @@ SQL;
|
||||
$db = new $class(QTEST_DIR.QDS.'db_files'.QDS.'test_sqlite.db');
|
||||
|
||||
$this->assertIsA($db, $class);
|
||||
$this->assertIsA(self::$db->driver, $class);
|
||||
|
||||
unset($db);
|
||||
}
|
||||
@ -194,7 +194,7 @@ SQL;
|
||||
INSERT INTO "create_test" ("id", "key", "val")
|
||||
VALUES (?,?,?)
|
||||
SQL;
|
||||
$statement = self::$db->prepareQuery($sql, [1,"boogers", "Gross"]);
|
||||
$statement = self::$db->prepareQuery($sql, [1, 'boogers', 'Gross']);
|
||||
|
||||
$statement->execute();
|
||||
|
||||
@ -215,7 +215,7 @@ SQL;
|
||||
VALUES (?,?,?)
|
||||
SQL;
|
||||
self::$db->prepareExecute($sql, [
|
||||
2, "works", 'also?'
|
||||
2, 'works', 'also?'
|
||||
]);
|
||||
|
||||
$res = self::$db->query('SELECT * FROM "create_test" WHERE "id"=2')
|
||||
@ -252,7 +252,7 @@ SQL;
|
||||
|
||||
public function testGetDBs(): void
|
||||
{
|
||||
$this->assertTrue(\is_array(self::$db->getDbs()));
|
||||
$this->assertNull(self::$db->getDbs());
|
||||
}
|
||||
|
||||
public function testGetSchemas(): void
|
||||
|
@ -16,9 +16,9 @@ namespace {
|
||||
/**
|
||||
* Unit test bootstrap - Using php simpletest
|
||||
*/
|
||||
\define('QTEST_DIR', __DIR__);
|
||||
\define('QBASE_DIR', realpath(__DIR__ . '/../') . '/');
|
||||
\define('QDS', DIRECTORY_SEPARATOR);
|
||||
define('QTEST_DIR', __DIR__);
|
||||
define('QBASE_DIR', realpath(__DIR__ . '/../') . '/');
|
||||
define('QDS', DIRECTORY_SEPARATOR);
|
||||
|
||||
require_once QBASE_DIR . 'vendor/simpletest/simpletest/autorun.php';
|
||||
require_once QBASE_DIR . 'vendor/autoload.php';
|
||||
@ -29,8 +29,7 @@ namespace Query\Tests {
|
||||
/**
|
||||
* Base class for TestCases
|
||||
*/
|
||||
abstract class TestCase extends \UnitTestCase
|
||||
{
|
||||
abstract class TestCase extends \UnitTestCase {
|
||||
public function __construct()
|
||||
{
|
||||
$class = \get_class($this);
|
||||
@ -102,7 +101,6 @@ namespace Query\Tests {
|
||||
// noop
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user