aboutsummaryrefslogtreecommitdiffstats
path: root/tests/extension
diff options
context:
space:
mode:
authorNathan Guse <nathaniel.guse@gmail.com>2013-12-30 12:32:48 -0600
committerNathan Guse <nathaniel.guse@gmail.com>2013-12-30 12:32:48 -0600
commit6ab12c17790033366a05f765a4a03b14a2d3d3b6 (patch)
tree1640385266c6cf8bec650c984a74d5ac872a7432 /tests/extension
parent05cf83aca7a8f3ddacff932419508a65cfe48455 (diff)
downloadforums-6ab12c17790033366a05f765a4a03b14a2d3d3b6.tar
forums-6ab12c17790033366a05f765a4a03b14a2d3d3b6.tar.gz
forums-6ab12c17790033366a05f765a4a03b14a2d3d3b6.tar.bz2
forums-6ab12c17790033366a05f765a4a03b14a2d3d3b6.tar.xz
forums-6ab12c17790033366a05f765a4a03b14a2d3d3b6.zip
[ticket/12006] Test for ext module auth
PHPBB3-12006
Diffstat (limited to 'tests/extension')
-rw-r--r--tests/extension/ext/vendor2/foo/acp/a_info.php2
-rw-r--r--tests/extension/modules_test.php44
2 files changed, 42 insertions, 4 deletions
diff --git a/tests/extension/ext/vendor2/foo/acp/a_info.php b/tests/extension/ext/vendor2/foo/acp/a_info.php
index 27e67c1556..e1eaa340b7 100644
--- a/tests/extension/ext/vendor2/foo/acp/a_info.php
+++ b/tests/extension/ext/vendor2/foo/acp/a_info.php
@@ -11,7 +11,7 @@ class a_info
'title' => 'Foobar',
'version' => '3.1.0-dev',
'modes' => array(
- 'config' => array('title' => 'Config', 'auth' => '', 'cat' => array('ACP_MODS')),
+ 'config' => array('title' => 'Config', 'auth' => 'ext_vendor2/foo', 'cat' => array('ACP_MODS')),
),
);
}
diff --git a/tests/extension/modules_test.php b/tests/extension/modules_test.php
index 5dcb24c691..c0a136e173 100644
--- a/tests/extension/modules_test.php
+++ b/tests/extension/modules_test.php
@@ -12,6 +12,7 @@ require_once dirname(__FILE__) . '/ext/vendor2/foo/mcp/a_info.php';
require_once dirname(__FILE__) . '/ext/vendor2/foo/acp/fail_info.php';
require_once dirname(__FILE__) . '/ext/vendor2/bar/acp/a_info.php';
require_once dirname(__FILE__) . '/../../phpBB/includes/acp/acp_modules.php';
+require_once dirname(__FILE__) . '/../../phpBB/includes/functions_module.php';
class phpbb_extension_modules_test extends phpbb_test_case
{
@@ -59,7 +60,7 @@ class phpbb_extension_modules_test extends phpbb_test_case
'title' => 'Foobar',
'version' => '3.1.0-dev',
'modes' => array(
- 'config' => array('title' => 'Config', 'auth' => '', 'cat' => array('ACP_MODS')),
+ 'config' => array('title' => 'Config', 'auth' => 'ext_vendor2/foo', 'cat' => array('ACP_MODS')),
),
),
'acp_foobar' => array(
@@ -133,7 +134,7 @@ class phpbb_extension_modules_test extends phpbb_test_case
'title' => 'Foobar',
'version' => '3.1.0-dev',
'modes' => array (
- 'config' => array ('title' => 'Config', 'auth' => '', 'cat' => array ('ACP_MODS')),
+ 'config' => array ('title' => 'Config', 'auth' => 'ext_vendor2/foo', 'cat' => array ('ACP_MODS')),
),
),
), $acp_modules);
@@ -157,7 +158,7 @@ class phpbb_extension_modules_test extends phpbb_test_case
'title' => 'Foobar',
'version' => '3.1.0-dev',
'modes' => array(
- 'config' => array('title' => 'Config', 'auth' => '', 'cat' => array('ACP_MODS')),
+ 'config' => array('title' => 'Config', 'auth' => 'ext_vendor2/foo', 'cat' => array('ACP_MODS')),
),
),
'acp_foobar' => array(
@@ -191,4 +192,41 @@ class phpbb_extension_modules_test extends phpbb_test_case
)
), $acp_modules);
}
+
+ public function module_auth_test_data()
+ {
+ return array(
+ // module_auth, expected result
+ array('ext_foo', false),
+ array('ext_foo/bar', false),
+ array('ext_vendor3/bar', false),
+ array('ext_vendor2/foo', true),
+ );
+ }
+
+ /**
+ * @dataProvider module_auth_test_data
+ */
+ public function test_modules_auth($module_auth, $expected)
+ {
+ global $phpbb_extension_manager;
+
+ $phpbb_extension_manager = $this->extension_manager = new phpbb_mock_extension_manager(
+ dirname(__FILE__) . '/',
+ array(
+ 'vendor2/foo' => array(
+ 'ext_name' => 'vendor2/foo',
+ 'ext_active' => '1',
+ 'ext_path' => 'ext/vendor2/foo/',
+ ),
+ 'vendor3/bar' => array(
+ 'ext_name' => 'vendor3/bar',
+ 'ext_active' => '0',
+ 'ext_path' => 'ext/vendor3/bar/',
+ ),
+ )
+ );
+
+ $this->assertEquals($expected, p_master::module_auth($module_auth, 0));
+ }
}