diff options
author | Oleg Pudeyev <oleg@bsdpower.com> | 2012-11-06 11:11:27 -0500 |
---|---|---|
committer | Oleg Pudeyev <oleg@bsdpower.com> | 2012-11-06 11:11:27 -0500 |
commit | 87ea50948ea53c0d1beab5b44badebeae4292d1a (patch) | |
tree | dbc99fde4dfc62b84bae60c7e4ab5c02ddbe8a3c /tests/class_loader/class_loader_test.php | |
parent | 5b48df41685da785b082612318ebe7a8012c4149 (diff) | |
parent | 44ff9d020fd218cbdb2f07a0d7f85a630367e3c2 (diff) | |
download | forums-87ea50948ea53c0d1beab5b44badebeae4292d1a.tar forums-87ea50948ea53c0d1beab5b44badebeae4292d1a.tar.gz forums-87ea50948ea53c0d1beab5b44badebeae4292d1a.tar.bz2 forums-87ea50948ea53c0d1beab5b44badebeae4292d1a.tar.xz forums-87ea50948ea53c0d1beab5b44badebeae4292d1a.zip |
Merge remote-tracking branch 'upstream/develop' into feature/prune-users
* upstream/develop: (2171 commits)
[ticket/11164] Update composer.phar
[ticket/10933] Use inheritDoc, eliminate copy pasted docblocks.
[ticket/10933] Dependency inject template context.
[ticket/10933] Expanded prose documentation for phpbb_extension_provider.
[ticket/10933] Specify empty template path for absolute includephp test.
[ticket/10933] Useful documentation for template locate function
[ticket/10933] Typo fixes
[ticket/10933] Initialize template context when template is constructed.
[ticket/11099] Mark acp_ban::display_ban_options() as static.
[ticket/11158] Require acl_u_sig for ucp signature module.
[ticket/11158] Revert old fix in PHPBB3-10186.
[ticket/11159] static public is the currently approved order.
[ticket/11157] static public is the currently approved order.
[ticket/11157] Fix remaining captcha spam.
[ticket/11157] get_captcha_types is an instance method.
[ticket/11156] Delete "Misc" tab of forum based permissions + move items
[ticket/10848] Move include up.
[ticket/11014] Fix old pagination assignment
[ticket/11018] Fix several paginations in ACP
[ticket/11014] Fix IF statements for new template pagination
...
Conflicts:
phpBB/includes/functions_user.php
Diffstat (limited to 'tests/class_loader/class_loader_test.php')
-rw-r--r-- | tests/class_loader/class_loader_test.php | 45 |
1 files changed, 31 insertions, 14 deletions
diff --git a/tests/class_loader/class_loader_test.php b/tests/class_loader/class_loader_test.php index 0c7fe3f97a..76af4dde37 100644 --- a/tests/class_loader/class_loader_test.php +++ b/tests/class_loader/class_loader_test.php @@ -3,30 +3,34 @@ * * @package testing * @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ -require_once dirname(__FILE__) . '/../mock/cache.php'; - class phpbb_class_loader_test extends PHPUnit_Framework_TestCase { public function setUp() { - global $class_loader; - $class_loader->unregister(); + global $phpbb_class_loader; + $phpbb_class_loader->unregister(); + + global $phpbb_class_loader_ext; + $phpbb_class_loader_ext->unregister(); } public function tearDown() { - global $class_loader; - $class_loader->register(); + global $phpbb_class_loader_ext; + $phpbb_class_loader_ext->register(); + + global $phpbb_class_loader; + $phpbb_class_loader->register(); } public function test_resolve_path() { $prefix = dirname(__FILE__) . '/'; - $class_loader = new phpbb_class_loader($prefix); + $class_loader = new phpbb_class_loader('phpbb_', $prefix . 'includes/'); $prefix .= 'includes/'; @@ -60,11 +64,15 @@ 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 = new phpbb_mock_cache($cacheMap); + $cache_map = array( + 'class_loader_phpbb_' => array('phpbb_a_cached_name' => 'a/cached_name'), + 'class_loader_phpbb_ext_' => array('phpbb_ext_foo' => 'foo'), + ); + $cache = new phpbb_mock_cache($cache_map); $prefix = dirname(__FILE__) . '/'; - $class_loader = new phpbb_class_loader($prefix, '.php', $cache); + $class_loader = new phpbb_class_loader('phpbb_', $prefix . 'includes/', '.php', $cache); + $class_loader_ext = new phpbb_class_loader('phpbb_ext_', $prefix . 'includes/', '.php', $cache); $prefix .= 'includes/'; @@ -74,13 +82,22 @@ class phpbb_class_loader_test extends PHPUnit_Framework_TestCase 'Class in a directory' ); + $this->assertFalse($class_loader->resolve_path('phpbb_ext_foo')); + $this->assertFalse($class_loader_ext->resolve_path('phpbb_a_cached_name')); + $this->assertEquals( $prefix . 'a/cached_name.php', $class_loader->resolve_path('phpbb_a_cached_name'), - 'Class in a directory' + 'Cached class found' + ); + + $this->assertEquals( + $prefix . 'foo.php', + $class_loader_ext->resolve_path('phpbb_ext_foo'), + 'Cached class found in alternative loader' ); - $cacheMap['class_loader']['phpbb_dir_class_name'] = 'dir/class_name'; - $cache->check($this, $cacheMap); + $cache_map['class_loader_phpbb_']['phpbb_dir_class_name'] = 'dir/class_name'; + $cache->check($this, $cache_map); } } |