aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2014-05-09 09:41:49 +0200
committerJoas Schilling <nickvergessen@gmx.de>2014-06-10 11:47:42 +0200
commitfb3c6b94aeaf77b40e815c65e0982f38aebd7384 (patch)
tree0c73324b2964b7cf15b73fc809266b82543d5d4b
parent6980fbd27bd57dc01d7265cc742ab01a4bd9f93a (diff)
downloadforums-fb3c6b94aeaf77b40e815c65e0982f38aebd7384.tar
forums-fb3c6b94aeaf77b40e815c65e0982f38aebd7384.tar.gz
forums-fb3c6b94aeaf77b40e815c65e0982f38aebd7384.tar.bz2
forums-fb3c6b94aeaf77b40e815c65e0982f38aebd7384.tar.xz
forums-fb3c6b94aeaf77b40e815c65e0982f38aebd7384.zip
[ticket/12508] Add a unit test for set_extensions()
PHPBB3-12508
-rw-r--r--tests/extension/finder_test.php43
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/extension/finder_test.php b/tests/extension/finder_test.php
index 5ff4c59722..2116cc057b 100644
--- a/tests/extension/finder_test.php
+++ b/tests/extension/finder_test.php
@@ -14,7 +14,9 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
class phpbb_extension_finder_test extends phpbb_test_case
{
+ /** @var \phpbb\extension\manager */
protected $extension_manager;
+ /** @var \phpbb\finder */
protected $finder;
public function setUp()
@@ -56,6 +58,47 @@ class phpbb_extension_finder_test extends phpbb_test_case
);
}
+ public function set_extensions_data()
+ {
+ return array(
+ array(
+ array(),
+ array('\phpbb\default\implementation'),
+ ),
+ array(
+ array('vendor3/bar'),
+ array(
+ '\phpbb\default\implementation',
+ '\vendor3\bar\my\hidden_class',
+ ),
+ ),
+ array(
+ array('vendor2/foo', 'vendor3/bar'),
+ array(
+ '\phpbb\default\implementation',
+ '\vendor2\foo\a_class',
+ '\vendor2\foo\b_class',
+ '\vendor3\bar\my\hidden_class',
+ ),
+ ),
+ );
+ }
+
+ /**
+ * @dataProvider set_extensions_data
+ */
+ public function test_set_extensions($extensions, $expected)
+ {
+ $classes = $this->finder
+ ->set_extensions($extensions)
+ ->core_path('phpbb/default/')
+ ->extension_suffix('_class')
+ ->get_classes();
+
+ sort($classes);
+ $this->assertEquals($expected, $classes);
+ }
+
public function test_get_directories()
{
$dirs = $this->finder