From 1aef7eb20ee195c7f21d6c5b78653b7c43e669ec Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sun, 9 Jan 2011 21:09:56 +0100 Subject: [task/acm-refactor] Cleaning up left over mentions of ACM and fixing tests. PHPBB3-9983 --- tests/class_loader/cache_mock.php | 74 -------------------------------- tests/class_loader/class_loader_test.php | 18 +++----- 2 files changed, 6 insertions(+), 86 deletions(-) delete mode 100644 tests/class_loader/cache_mock.php (limited to 'tests/class_loader') diff --git a/tests/class_loader/cache_mock.php b/tests/class_loader/cache_mock.php deleted file mode 100644 index 73d1e64cf5..0000000000 --- a/tests/class_loader/cache_mock.php +++ /dev/null @@ -1,74 +0,0 @@ -variables[$var_name])) - { - return $this->variables[$var_name]; - } - - return false; - } - - function put($var_name, $value, $ttl = 0) - { - $this->variables[$var_name] = $value; - } - - function load() - { - } - function unload() - { - } - function save() - { - } - function tidy() - { - } - function purge() - { - } - function destroy($var_name, $table = '') - { - } - 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) - { - } -} diff --git a/tests/class_loader/class_loader_test.php b/tests/class_loader/class_loader_test.php index c01278f914..cc6862dc70 100644 --- a/tests/class_loader/class_loader_test.php +++ b/tests/class_loader/class_loader_test.php @@ -2,13 +2,12 @@ /** * * @package testing -* @version $Id$ -* @copyright (c) 2008 phpBB Group +* @copyright (c) 2011 phpBB Group * @license http://opensource.org/licenses/gpl-license.php GNU Public License * */ -require_once __DIR__ . '/cache_mock.php'; +require_once __DIR__ . '/../mock/cache.php'; class phpbb_class_loader_test extends PHPUnit_Framework_TestCase { @@ -62,15 +61,7 @@ class phpbb_class_loader_test extends PHPUnit_Framework_TestCase public function test_resolve_cached() { $cacheMap = array('class_loader' => array('phpbb_a_cached_name' => 'a/cached_name')); - - $cache = $this->getMock('phpbb_cache_driver_interface', - array('get', 'put', 'load', 'unload', 'save', 'tidy', 'purge', 'destroy', '_exists', - 'sql_load', 'sql_save', 'sql_exists', 'sql_fetchrow', 'sql_fetchfield', 'sql_rowseek', 'sql_freeresult')); - $cache->expects($this->any()) - ->method('get') - ->will($this->returnCallback(function($var_name) use ($cacheMap) { - return $cacheMap[$var_name]; - })); + $cache = new phpbb_mock_cache($cacheMap); $prefix = __DIR__ . '/'; $class_loader = new phpbb_class_loader($prefix, '.php', $cache); @@ -88,5 +79,8 @@ class phpbb_class_loader_test extends PHPUnit_Framework_TestCase $class_loader->resolve_path('phpbb_a_cached_name'), 'Class in a directory' ); + + $cacheMap['class_loader']['phpbb_dir_class_name'] = 'dir/class_name'; + $cache->check($this, $cacheMap); } } -- cgit v1.2.1