diff --git a/tests/databases/sqlite.php b/tests/databases/sqlite.php index 4a8d92f..ced9686 100644 --- a/tests/databases/sqlite.php +++ b/tests/databases/sqlite.php @@ -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 diff --git a/tests/test_dbs/FB_TEST_DB.FDB b/tests/test_dbs/FB_TEST_DB.FDB index 7e44e4f..b79c428 100755 Binary files a/tests/test_dbs/FB_TEST_DB.FDB and b/tests/test_dbs/FB_TEST_DB.FDB differ