diff options
author | Nils Adermann <naderman@naderman.de> | 2013-04-24 09:45:34 -0700 |
---|---|---|
committer | Nils Adermann <naderman@naderman.de> | 2013-04-24 09:45:34 -0700 |
commit | 3e32655c7f22ce9aff7bafdbab6d556879b5fcf9 (patch) | |
tree | 20853ed2664b6e28d5a2f42ee94ab8418b689629 /tests/extension/finder_test.php | |
parent | ab628cbdb99eda1c3efbbca7e374f64876800428 (diff) | |
parent | 16e70fa08610227d96e149eba2019803ad37c85f (diff) | |
download | forums-3e32655c7f22ce9aff7bafdbab6d556879b5fcf9.tar forums-3e32655c7f22ce9aff7bafdbab6d556879b5fcf9.tar.gz forums-3e32655c7f22ce9aff7bafdbab6d556879b5fcf9.tar.bz2 forums-3e32655c7f22ce9aff7bafdbab6d556879b5fcf9.tar.xz forums-3e32655c7f22ce9aff7bafdbab6d556879b5fcf9.zip |
Merge pull request #1290 from nickvergessen/ticket/11362
Correctly sanitise the directory path in finder
Diffstat (limited to 'tests/extension/finder_test.php')
-rw-r--r-- | tests/extension/finder_test.php | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/tests/extension/finder_test.php b/tests/extension/finder_test.php index c96b11a73c..73c07ef79a 100644 --- a/tests/extension/finder_test.php +++ b/tests/extension/finder_test.php @@ -6,6 +6,7 @@ * @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_finder_test extends phpbb_test_case { @@ -142,13 +143,28 @@ class phpbb_extension_finder_test extends phpbb_test_case ); } + public function test_uncleansub_directory_get_classes() + { + $classes = $this->finder + ->directory('/sub/../sub/type') + ->get_classes(); + + sort($classes); + $this->assertEquals( + array( + 'phpbb_ext_foo_sub_type_alternative', + ), + $classes + ); + } + /** * These do not work because of changes with PHPBB3-11386 * They do not seem neccessary to me, so I am commenting them out for now public function test_get_classes_create_cache() { $cache = new phpbb_mock_cache; - $finder = new phpbb_extension_finder($this->extension_manager, dirname(__FILE__) . '/', $cache, '.php', '_custom_cache_name'); + $finder = new phpbb_extension_finder($this->extension_manager, new phpbb_filesystem(), dirname(__FILE__) . '/', $cache, '.php', '_custom_cache_name'); $files = $finder->suffix('_class.php')->get_files(); $expected_files = array( @@ -188,6 +204,7 @@ class phpbb_extension_finder_test extends phpbb_test_case $finder = new phpbb_extension_finder( $this->extension_manager, + new phpbb_filesystem(), dirname(__FILE__) . '/', new phpbb_mock_cache(array( '_ext_finder' => array( |