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