From: Chuck Hagenbuch Date: Sun, 4 Jan 2009 17:41:36 +0000 (-0500) Subject: add tests for index cache X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=1efa32ee2a60e36d6fba4221c5aaca3e2137c96f;p=horde.git add tests for index cache --- 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', '');