aboutsummaryrefslogtreecommitdiffstats
path: root/tests/cache/cache_test.php
diff options
context:
space:
mode:
authorIgor Wiedler <igor@wiedler.ch>2012-11-12 10:33:40 +0100
committerIgor Wiedler <igor@wiedler.ch>2012-11-12 10:33:40 +0100
commit5e52216b5e14ced69326813e748fc56be6e28a69 (patch)
tree4e47bd9290da80da48aaf30308e7d03965a904f6 /tests/cache/cache_test.php
parent0971d3f975ebaa8c2874115bd82b308b244783f2 (diff)
parent504158ceaba18bb8bc61d54504a2c870d0eb0407 (diff)
downloadforums-5e52216b5e14ced69326813e748fc56be6e28a69.tar
forums-5e52216b5e14ced69326813e748fc56be6e28a69.tar.gz
forums-5e52216b5e14ced69326813e748fc56be6e28a69.tar.bz2
forums-5e52216b5e14ced69326813e748fc56be6e28a69.tar.xz
forums-5e52216b5e14ced69326813e748fc56be6e28a69.zip
Merge remote-tracking branch 'upstream/develop' into ticket/11015
* upstream/develop: (666 commits) [ticket/11077] Remove code from old global announcements system [ticket/11189] Replace DEBUG_EXTRA with DEBUG [ticket/11189] Always log critical errors when in cron or in image output [ticket/11187] Added a blank array to fix errors in functional tests [ticket/10780] Make L_COLON available in the installer. [ticket/11183] Remove $load_extensions and weird dl() calls [ticket/10970] Added extra documentation to parse_dynamic_path. [ticket/10939] Added documentation for phpbb_request::file [ticket/10865] Use code tags for install/database_update.php. [ticket/10865] Should have been a slash. [ticket/10780] Use L_COLON on LDAP page. [ticket/10780] Use L_COLON on search backend ACP pages. [ticket/10780] Use L_COLON for "download all attachments". [ticket/10780] Use colon from language in ucp_pm_compose.php where possible. [ticket/10780] Replace colons in phpBB/adm/style/acp_ext_details.html. [ticket/10780] Replace colon usage in adm template output with {L_COLON} [ticket/10780] Replace colon usage in template output with {L_COLON} [ticket/11181] Bump PHP requirement to 5.3.3 (from 5.3.2) [develop-olympus] [ticket/11181] Bump PHP requirement to 5.3.3 (from 5.3.2) [ticket/10172] Show prosilver birthday list even if there are no birthdays. ... Conflicts: phpBB/common.php phpBB/download/file.php phpBB/includes/db/dbal.php phpBB/includes/db/firebird.php phpBB/includes/db/mssql.php phpBB/includes/db/mssql_odbc.php phpBB/includes/db/mssqlnative.php phpBB/includes/db/mysql.php phpBB/includes/db/mysqli.php phpBB/includes/db/oracle.php phpBB/includes/db/postgres.php phpBB/includes/db/sqlite.php phpBB/includes/extension/manager.php phpBB/install/database_update.php
Diffstat (limited to 'tests/cache/cache_test.php')
-rw-r--r--tests/cache/cache_test.php42
1 files changed, 41 insertions, 1 deletions
diff --git a/tests/cache/cache_test.php b/tests/cache/cache_test.php
index 564bd35863..4b077d5417 100644
--- a/tests/cache/cache_test.php
+++ b/tests/cache/cache_test.php
@@ -9,7 +9,7 @@
require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
-class phpbb_cache_test extends phpbb_test_case
+class phpbb_cache_test extends phpbb_database_test_case
{
private $cache_dir;
@@ -18,8 +18,15 @@ class phpbb_cache_test extends phpbb_test_case
$this->cache_dir = dirname(__FILE__) . '/../tmp/cache/';
}
+ public function getDataSet()
+ {
+ return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/config.xml');
+ }
+
protected function setUp()
{
+ parent::setUp();
+
if (file_exists($this->cache_dir))
{
// cache directory possibly left after aborted
@@ -35,6 +42,8 @@ class phpbb_cache_test extends phpbb_test_case
{
$this->remove_cache_dir();
}
+
+ parent::tearDown();
}
private function create_cache_dir()
@@ -67,4 +76,35 @@ class phpbb_cache_test extends phpbb_test_case
'File ACM put and get'
);
}
+
+ public function test_cache_sql()
+ {
+ global $db, $cache;
+
+ $db = $this->new_dbal();
+
+ $driver = new phpbb_cache_driver_file($this->cache_dir);
+ $cache = new phpbb_cache_service($driver);
+
+ $sql = "SELECT * FROM phpbb_config
+ WHERE config_name = 'foo'";
+ $result = $db->sql_query($sql, 300);
+ $first_result = $db->sql_fetchrow($result);
+
+ $this->assertFileExists($this->cache_dir . 'sql_' . md5(preg_replace('/[\n\r\s\t]+/', ' ', $sql)) . '.php');
+
+ $sql = "SELECT * FROM phpbb_config
+ WHERE config_name = 'foo'";
+ $result = $db->sql_query($sql, 300);
+
+ $this->assertEquals($first_result, $db->sql_fetchrow($result));
+
+ $sql = "SELECT * FROM phpbb_config
+ WHERE config_name = 'bar'";
+ $result = $db->sql_query($sql, 300);
+
+ $this->assertNotEquals($first_result, $db->sql_fetchrow($result));
+
+ $db->sql_close();
+ }
}