[ticket/10875] Test for null cache driver and sql cache.

PHPBB3-10875
This commit is contained in:
Oleg Pudeyev 2012-11-30 12:28:13 -05:00
parent 7bba09811c
commit 0c06ac466f

View file

@ -112,4 +112,33 @@ class phpbb_cache_test extends phpbb_database_test_case
$db->sql_close();
}
public function test_null_cache_sql()
{
$driver = new phpbb_cache_driver_null($this->cache_dir);
global $db, $cache;
$db = $this->new_dbal();
$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);
$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);
// As null cache driver does not actually cache,
// this should return no results
$sql = "SELECT * FROM phpbb_config
WHERE config_name = 'foo'";
$result = $db->sql_query($sql, 300);
$this->assertSame(false, $db->sql_fetchrow($result));
$db->sql_close();
}
}