From 1efa32ee2a60e36d6fba4221c5aaca3e2137c96f Mon Sep 17 00:00:00 2001 From: Chuck Hagenbuch Date: Sun, 4 Jan 2009 12:41:36 -0500 Subject: [PATCH] add tests for index cache --- framework/Db/test/Horde/Db/Adapter/MysqliTest.php | 16 ++++++++++++++-- framework/Db/test/Horde/Db/Adapter/Pdo/MysqlTest.php | 16 ++++++++++++++-- framework/Db/test/Horde/Db/Adapter/Pdo/PgsqlTest.php | 16 ++++++++++++++-- framework/Db/test/Horde/Db/Adapter/Pdo/SqliteTest.php | 17 +++++++++++++++-- 4 files changed, 57 insertions(+), 8 deletions(-) diff --git a/framework/Db/test/Horde/Db/Adapter/MysqliTest.php b/framework/Db/test/Horde/Db/Adapter/MysqliTest.php index 0a31f0b89..006e8e050 100644 --- a/framework/Db/test/Horde/Db/Adapter/MysqliTest.php +++ b/framework/Db/test/Horde/Db/Adapter/MysqliTest.php @@ -809,10 +809,22 @@ class Horde_Db_Adapter_MysqliTest extends PHPUnit_Framework_TestCase /*########################################################################## - # Test Cached table descriptions + # Test table cache ##########################################################################*/ - public function testCachedTableDescription() + public function testCachedTableIndexes() + { + // remove any current cache. + $this->_cache->set('tables/indexes/cache_table', ''); + $this->assertEquals('', $this->_cache->get('tables/indexes/cache_table')); + + $this->_createTestTable('cache_table'); + $idxs = $this->_conn->indexes('cache_table'); + + $this->assertNotEquals('', $this->_cache->get('tables/indexes/cache_table')); + } + + public function testCachedTableColumns() { // remove any current cache. $this->_cache->set('tables/columns/cache_table', ''); diff --git a/framework/Db/test/Horde/Db/Adapter/Pdo/MysqlTest.php b/framework/Db/test/Horde/Db/Adapter/Pdo/MysqlTest.php index 7f3652b14..212b55a4e 100644 --- a/framework/Db/test/Horde/Db/Adapter/Pdo/MysqlTest.php +++ b/framework/Db/test/Horde/Db/Adapter/Pdo/MysqlTest.php @@ -809,10 +809,22 @@ class Horde_Db_Adapter_Pdo_MysqlTest extends PHPUnit_Framework_TestCase /*########################################################################## - # Test Cached table descriptions + # Test table cache ##########################################################################*/ - public function testCachedTableDescription() + public function testCachedTableIndexes() + { + // remove any current cache. + $this->_cache->set('tables/indexes/cache_table', ''); + $this->assertEquals('', $this->_cache->get('tables/indexes/cache_table')); + + $this->_createTestTable('cache_table'); + $idxs = $this->_conn->indexes('cache_table'); + + $this->assertNotEquals('', $this->_cache->get('tables/indexes/cache_table')); + } + + public function testCachedTableColumns() { // remove any current cache. $this->_cache->set('tables/columns/cache_table', ''); diff --git a/framework/Db/test/Horde/Db/Adapter/Pdo/PgsqlTest.php b/framework/Db/test/Horde/Db/Adapter/Pdo/PgsqlTest.php index f0331e0c0..6744842c4 100644 --- a/framework/Db/test/Horde/Db/Adapter/Pdo/PgsqlTest.php +++ b/framework/Db/test/Horde/Db/Adapter/Pdo/PgsqlTest.php @@ -781,10 +781,22 @@ class Horde_Db_Adapter_Pdo_PgsqlTest extends PHPUnit_Framework_TestCase /*########################################################################## - # Test Cached table descriptions + # Test table cache ##########################################################################*/ - public function testCachedTableDescription() + public function testCachedTableIndexes() + { + // remove any current cache. + $this->_cache->set('tables/indexes/cache_table', ''); + $this->assertEquals('', $this->_cache->get('tables/indexes/cache_table')); + + $this->_createTestTable('cache_table'); + $idxs = $this->_conn->indexes('cache_table'); + + $this->assertNotEquals('', $this->_cache->get('tables/indexes/cache_table')); + } + + public function testCachedTableColumns() { // remove any current cache. $this->_cache->set('tables/columns/cache_table', ''); diff --git a/framework/Db/test/Horde/Db/Adapter/Pdo/SqliteTest.php b/framework/Db/test/Horde/Db/Adapter/Pdo/SqliteTest.php index a89bcc2df..04d763c68 100644 --- a/framework/Db/test/Horde/Db/Adapter/Pdo/SqliteTest.php +++ b/framework/Db/test/Horde/Db/Adapter/Pdo/SqliteTest.php @@ -825,11 +825,24 @@ class Horde_Db_Adapter_Pdo_SqliteTest extends PHPUnit_Framework_TestCase $this->assertEquals('SELECT * FROM documents ORDER BY name DESC', $result); } + /*########################################################################## - # Test Cached table descriptions + # Test table cache ##########################################################################*/ - public function testCachedTableDescription() + public function testCachedTableIndexes() + { + // remove any current cache. + $this->_cache->set('tables/indexes/cache_table', ''); + $this->assertEquals('', $this->_cache->get('tables/indexes/cache_table')); + + $this->_createTestTable('cache_table'); + $idxs = $this->_conn->indexes('cache_table'); + + $this->assertNotEquals('', $this->_cache->get('tables/indexes/cache_table')); + } + + public function testCachedTableColumns() { // remove any current cache. $this->_cache->set('tables/columns/cache_table', ''); -- 2.11.0