aboutsummaryrefslogtreecommitdiffstats
path: root/tests/cache/common_test_case.php
diff options
context:
space:
mode:
authorOleg Pudeyev <oleg@bsdpower.com>2012-12-03 21:47:29 -0500
committerOleg Pudeyev <oleg@bsdpower.com>2012-12-03 21:47:29 -0500
commitd93f582b04d2e6d0738cd6a2ffee739b8c987276 (patch)
treecf45a17aa9a18194b2e360d7bea741c38020dc96 /tests/cache/common_test_case.php
parent49f29259003da180c008a6bb6e0d5605c3a79bd9 (diff)
downloadforums-d93f582b04d2e6d0738cd6a2ffee739b8c987276.tar
forums-d93f582b04d2e6d0738cd6a2ffee739b8c987276.tar.gz
forums-d93f582b04d2e6d0738cd6a2ffee739b8c987276.tar.bz2
forums-d93f582b04d2e6d0738cd6a2ffee739b8c987276.tar.xz
forums-d93f582b04d2e6d0738cd6a2ffee739b8c987276.zip
[ticket/9983] Make sql cache test into a black box.
This makes it non-driver-specific and also makes it possible to make prefix variable private on drivers. PHPBB3-9983
Diffstat (limited to 'tests/cache/common_test_case.php')
-rw-r--r--tests/cache/common_test_case.php33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/cache/common_test_case.php b/tests/cache/common_test_case.php
index 45cf80e424..fa298ec9ae 100644
--- a/tests/cache/common_test_case.php
+++ b/tests/cache/common_test_case.php
@@ -61,4 +61,37 @@ abstract class phpbb_cache_common_test_case extends phpbb_database_test_case
$this->driver->get('second_key')
);
}
+
+ public function test_cache_sql()
+ {
+ global $db, $cache;
+ $db = $this->new_dbal();
+ $cache = new phpbb_cache_service($this->driver);
+
+ $sql = "SELECT * FROM phpbb_config
+ WHERE config_name = 'foo'";
+
+ $result = $db->sql_query($sql, 300);
+ $first_result = $db->sql_fetchrow($result);
+ $expected = array('config_name' => 'foo', 'config_value' => '23', 'is_dynamic' => 0);
+ $this->assertEquals($expected, $first_result);
+
+ $sql = 'DELETE FROM phpbb_config';
+ $result = $db->sql_query($sql);
+
+ $sql = "SELECT * FROM phpbb_config
+ WHERE config_name = 'foo'";
+ $result = $db->sql_query($sql, 300);
+
+ $this->assertEquals($expected, $db->sql_fetchrow($result));
+
+ $sql = "SELECT * FROM phpbb_config
+ WHERE config_name = 'foo'";
+ $result = $db->sql_query($sql);
+
+ $no_cache_result = $db->sql_fetchrow($result);
+ $this->assertSame(false, $no_cache_result);
+
+ $db->sql_close();
+ }
}