From 2f4801fe27cac8b19eca2e8b7f7f975ad2e23363 Mon Sep 17 00:00:00 2001 From: zYne Date: Sun, 14 Jan 2007 22:44:23 +0000 Subject: [PATCH] added tests for sqlite import driver --- tests/Import/SqliteTestCase.php | 29 ++++++++++++++++++++++++++++- tests/UnitTestCase.php | 1 + 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/tests/Import/SqliteTestCase.php b/tests/Import/SqliteTestCase.php index a62b774ac..ca32d95da 100644 --- a/tests/Import/SqliteTestCase.php +++ b/tests/Import/SqliteTestCase.php @@ -30,5 +30,32 @@ * @since 1.0 * @version $Revision$ */ -class Doctrine_Import_Sqlite_TestCase extends Doctrine_UnitTestCase { +class Doctrine_Import_Sqlite_TestCase extends Doctrine_UnitTestCase +{ + public function testListSequencesExecutesSql() + { + $this->import->listSequences('table'); + + $this->assertEqual($this->adapter->pop(), "SELECT name FROM sqlite_master WHERE type='table' AND sql NOT NULL ORDER BY name"); + } + public function testListTableColumnsExecutesSql() + { + $this->import->listTableColumns('table'); + + $this->assertEqual($this->adapter->pop(), "PRAGMA table_info(table)"); + } + public function testListTableIndexesExecutesSql() + { + $this->import->listTableIndexes('table'); + + $this->assertEqual($this->adapter->pop(), "PRAGMA index_list(table)"); + } + public function testListTablesExecutesSql() + { + $this->import->listTables(); + + $q = "SELECT name FROM sqlite_master WHERE type = 'table' UNION ALL SELECT name FROM sqlite_temp_master WHERE type = 'table' ORDER BY name"; + + $this->assertEqual($this->adapter->pop(), $q); + } } diff --git a/tests/UnitTestCase.php b/tests/UnitTestCase.php index b4772025d..597275cc5 100644 --- a/tests/UnitTestCase.php +++ b/tests/UnitTestCase.php @@ -115,6 +115,7 @@ class Doctrine_UnitTestCase extends UnitTestCase { $this->dataDict = $this->connection->dataDict; $this->expr = $this->connection->expression; $this->sequence = $this->connection->sequence; + $this->import = $this->connection->import; } $this->unitOfWork = $this->connection->unitOfWork; $this->connection->setListener(new Doctrine_EventListener());