diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2013-04-12 21:20:34 +0200 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2013-04-12 21:35:08 +0200 |
commit | 06e32e36dff55dffcb60c19e768656db237ee836 (patch) | |
tree | 69c528be52f3a9c08791b48162d783f68dcd4ea2 /tests | |
parent | bbaa3411b04c06c519e8dd215a0251c97263eac4 (diff) | |
download | forums-06e32e36dff55dffcb60c19e768656db237ee836.tar forums-06e32e36dff55dffcb60c19e768656db237ee836.tar.gz forums-06e32e36dff55dffcb60c19e768656db237ee836.tar.bz2 forums-06e32e36dff55dffcb60c19e768656db237ee836.tar.xz forums-06e32e36dff55dffcb60c19e768656db237ee836.zip |
[ticket/10844] Add unit tests for different root_paths
PHPBB3-10844
Diffstat (limited to 'tests')
-rw-r--r-- | tests/extension/style_path_provider_test.php | 50 | ||||
-rw-r--r-- | tests/extension/subdir/style_path_provider_test.php | 18 |
2 files changed, 68 insertions, 0 deletions
diff --git a/tests/extension/style_path_provider_test.php b/tests/extension/style_path_provider_test.php new file mode 100644 index 0000000000..e1021c20ac --- /dev/null +++ b/tests/extension/style_path_provider_test.php @@ -0,0 +1,50 @@ +<?php +/** +* +* @package testing +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; + +class phpbb_extension_style_path_provider_test extends phpbb_test_case +{ + protected $relative_root_path; + protected $root_path; + + public function setUp() + { + $this->relative_root_path = './'; + $this->root_path = dirname(__FILE__) . '/'; + } + + public function test_find() + { + $phpbb_style_path_provider = new phpbb_style_path_provider(); + $phpbb_style_path_provider->set_styles(array($this->relative_root_path . 'styles/prosilver')); + $phpbb_style_extension_path_provider = new phpbb_style_extension_path_provider(new phpbb_mock_extension_manager( + $this->root_path, + array( + 'foo' => array( + 'ext_name' => 'foo', + 'ext_active' => '1', + 'ext_path' => 'ext/foo/', + ), + 'bar' => array( + 'ext_name' => 'bar', + 'ext_active' => '1', + 'ext_path' => 'ext/bar/', + ), + )), $phpbb_style_path_provider, $this->relative_root_path); + + $this->assertEquals(array( + 'style' => array( + $this->relative_root_path . 'styles/prosilver', + ), + 'bar' => array( + $this->root_path . 'ext/bar/styles/prosilver', + ), + ), $phpbb_style_extension_path_provider->find()); + } +} diff --git a/tests/extension/subdir/style_path_provider_test.php b/tests/extension/subdir/style_path_provider_test.php new file mode 100644 index 0000000000..1b5ce62e5f --- /dev/null +++ b/tests/extension/subdir/style_path_provider_test.php @@ -0,0 +1,18 @@ +<?php +/** +* +* @package testing +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ +require_once dirname(__FILE__) . '/../style_path_provider_test.php'; + +class phpbb_extension_subdir_style_path_provider_test extends phpbb_extension_style_path_provider_test +{ + public function setUp() + { + $this->relative_root_path = '../'; + $this->root_path = dirname(__FILE__) . '/../'; + } +} |