More sqlite tests
This commit is contained in:
parent
9d2ceb49e6
commit
4ee3c3ea43
@ -22,10 +22,18 @@ class SQLiteTest extends UnitTestCase {
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
}
|
||||
|
||||
function setUp()
|
||||
{
|
||||
$path = dirname(__FILE__)."/../test_dbs/test_sqlite.db";
|
||||
$this->db = new SQLite($path);
|
||||
}
|
||||
|
||||
function tearDown()
|
||||
{
|
||||
unset($this->db);
|
||||
}
|
||||
|
||||
function TestConnection()
|
||||
{
|
||||
@ -44,6 +52,12 @@ class SQLiteTest extends UnitTestCase {
|
||||
|
||||
$this->assertTrue(is_array($tables));
|
||||
}
|
||||
|
||||
function TestCreateTransaction()
|
||||
{
|
||||
$res = $this->db->beginTransaction();
|
||||
$this->assertTrue($res);
|
||||
}
|
||||
|
||||
function TestCreateTable()
|
||||
{
|
||||
@ -89,6 +103,28 @@ SQL;
|
||||
|
||||
}
|
||||
|
||||
function TestCommitTransaction()
|
||||
{
|
||||
$this->TestCreateTransaction();
|
||||
|
||||
$sql = 'INSERT INTO "create_test" ("id", "key", "val") VALUES (10, 12, 14)';
|
||||
$this->db->query($sql);
|
||||
|
||||
$res = $this->db->commit();
|
||||
$this->assertTrue($res);
|
||||
}
|
||||
|
||||
function TestRollbackTransaction()
|
||||
{
|
||||
$this->TestCreateTransaction();
|
||||
|
||||
$sql = 'INSERT INTO "create_test" ("id", "key", "val") VALUES (182, 96, 43)';
|
||||
$this->db->query($sql);
|
||||
|
||||
$res = $this->db->rollback();
|
||||
$this->assertTrue($res);
|
||||
}
|
||||
|
||||
function TestDeleteTable()
|
||||
{
|
||||
//Make sure the table exists to delete
|
||||
|
Binary file not shown.
Reference in New Issue
Block a user