diff options
Diffstat (limited to 'tests/class_loader')
| -rw-r--r-- | tests/class_loader/cache_mock.php | 29 | ||||
| -rw-r--r-- | tests/class_loader/class_loader_test.php | 14 |
2 files changed, 7 insertions, 36 deletions
diff --git a/tests/class_loader/cache_mock.php b/tests/class_loader/cache_mock.php deleted file mode 100644 index b254978fcc..0000000000 --- a/tests/class_loader/cache_mock.php +++ /dev/null @@ -1,29 +0,0 @@ -<?php -/** -* -* @package testing -* @version $Id$ -* @copyright (c) 2008 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License -* -*/ - -class phpbb_cache_mock -{ - private $variables = array(); - - function get($var_name) - { - if (isset($this->variables[$var_name])) - { - return $this->variables[$var_name]; - } - - return false; - } - - function put($var_name, $value) - { - $this->variables[$var_name] = $value; - } -} diff --git a/tests/class_loader/class_loader_test.php b/tests/class_loader/class_loader_test.php index 3eb3c915a1..cc6862dc70 100644 --- a/tests/class_loader/class_loader_test.php +++ b/tests/class_loader/class_loader_test.php @@ -2,15 +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__ . '/../../phpBB/includes/class_loader.php'; +require_once __DIR__ . '/../mock/cache.php'; class phpbb_class_loader_test extends PHPUnit_Framework_TestCase { @@ -63,8 +60,8 @@ class phpbb_class_loader_test extends PHPUnit_Framework_TestCase public function test_resolve_cached() { - $cache = new phpbb_cache_mock; - $cache->put('class_loader', array('phpbb_a_cached_name' => 'a/cached_name')); + $cacheMap = array('class_loader' => array('phpbb_a_cached_name' => 'a/cached_name')); + $cache = new phpbb_mock_cache($cacheMap); $prefix = __DIR__ . '/'; $class_loader = new phpbb_class_loader($prefix, '.php', $cache); @@ -82,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); } } |
