aboutsummaryrefslogtreecommitdiffstats
path: root/tests/mock/cache.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/mock/cache.php')
-rw-r--r--tests/mock/cache.php79
1 files changed, 58 insertions, 21 deletions
diff --git a/tests/mock/cache.php b/tests/mock/cache.php
index 738d1eaaba..7589c9908e 100644
--- a/tests/mock/cache.php
+++ b/tests/mock/cache.php
@@ -2,21 +2,18 @@
/**
*
* @package testing
-* @copyright (c) 2008 phpBB Group
+* @copyright (c) 2011 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
-class phpbb_mock_cache
+class phpbb_mock_cache implements phpbb_cache_driver_interface
{
+ protected $data;
+
public function __construct($data = array())
{
$this->data = $data;
-
- if (!isset($this->data['_bots']))
- {
- $this->data['_bots'] = array();
- }
}
public function get($var_name)
@@ -34,25 +31,17 @@ class phpbb_mock_cache
$this->data[$var_name] = $var;
}
- /**
- * Obtain active bots
- */
- public function obtain_bots()
- {
- return $this->data['_bots'];
- }
-
- public function set_bots($bots)
- {
- $this->data['_bots'] = $bots;
- }
-
public function checkVar(PHPUnit_Framework_Assert $test, $var_name, $data)
{
$test->assertTrue(isset($this->data[$var_name]));
$test->assertEquals($data, $this->data[$var_name]);
}
+ public function checkVarUnset(PHPUnit_Framework_Assert $test, $var_name)
+ {
+ $test->assertFalse(isset($this->data[$var_name]));
+ }
+
public function check(PHPUnit_Framework_Assert $test, $data, $ignore_db_info = true)
{
$cache_data = $this->data;
@@ -64,5 +53,53 @@ class phpbb_mock_cache
$test->assertEquals($data, $cache_data);
}
-}
+ function load()
+ {
+ }
+ function unload()
+ {
+ }
+ function save()
+ {
+ }
+ function tidy()
+ {
+ }
+ function purge()
+ {
+ }
+ function destroy($var_name, $table = '')
+ {
+ unset($this->data[$var_name]);
+ }
+ public function _exists($var_name)
+ {
+ }
+ public function sql_load($query)
+ {
+ }
+ public function sql_save($query, &$query_result, $ttl)
+ {
+ }
+ public function sql_exists($query_id)
+ {
+ }
+ public function sql_fetchrow($query_id)
+ {
+ }
+ public function sql_fetchfield($query_id, $field)
+ {
+ }
+ public function sql_rowseek($rownum, $query_id)
+ {
+ }
+ public function sql_freeresult($query_id)
+ {
+ }
+
+ public function obtain_bots()
+ {
+ return isset($this->data['_bots']) ? $this->data['_bots'] : array();
+ }
+}