mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[ticket/11465] Add disabled ext to allow proper testing of get_module_infos()
This will now also enable us to test the $use_all_available parameter of get_module_infos(), which will not only return the module infos for enabled extensions but also those from disabled extensions. PHPBB3-11465
This commit is contained in:
parent
7327f9326f
commit
f90ed6c3cb
5 changed files with 50 additions and 2 deletions
16
tests/extension/ext/barfoo/acp/a_info.php
Normal file
16
tests/extension/ext/barfoo/acp/a_info.php
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class phpbb_ext_barfoo_acp_a_info
|
||||||
|
{
|
||||||
|
public function module()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'filename' => 'phpbb_ext_barfoo_acp_a_module',
|
||||||
|
'title' => 'Barfoo',
|
||||||
|
'version' => '3.1.0-dev',
|
||||||
|
'modes' => array(
|
||||||
|
'config' => array('title' => 'Config', 'auth' => '', 'cat' => array('ACP_MODS')),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
5
tests/extension/ext/barfoo/acp/a_module.php
Normal file
5
tests/extension/ext/barfoo/acp/a_module.php
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class phpbb_ext_barfoo_acp_a_module
|
||||||
|
{
|
||||||
|
}
|
5
tests/extension/ext/barfoo/ext.php
Normal file
5
tests/extension/ext/barfoo/ext.php
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class phpbb_ext_barfoo_ext extends phpbb_extension_base
|
||||||
|
{
|
||||||
|
}
|
|
@ -30,7 +30,7 @@ class phpbb_extension_manager_test extends phpbb_database_test_case
|
||||||
|
|
||||||
public function test_available()
|
public function test_available()
|
||||||
{
|
{
|
||||||
$this->assertEquals(array('bar', 'foo', 'vendor/moo'), array_keys($this->extension_manager->all_available()));
|
$this->assertEquals(array('bar', 'barfoo', 'foo', 'vendor/moo'), array_keys($this->extension_manager->all_available()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_enabled()
|
public function test_enabled()
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
require_once dirname(__FILE__) . '/ext/foo/acp/a_info.php';
|
require_once dirname(__FILE__) . '/ext/foo/acp/a_info.php';
|
||||||
require_once dirname(__FILE__) . '/ext/foo/mcp/a_info.php';
|
require_once dirname(__FILE__) . '/ext/foo/mcp/a_info.php';
|
||||||
require_once dirname(__FILE__) . '/ext/foo/acp/fail_info.php';
|
require_once dirname(__FILE__) . '/ext/foo/acp/fail_info.php';
|
||||||
|
require_once dirname(__FILE__) . '/ext/barfoo/acp/a_info.php';
|
||||||
require_once dirname(__FILE__) . '/../../phpBB/includes/acp/acp_modules.php';
|
require_once dirname(__FILE__) . '/../../phpBB/includes/acp/acp_modules.php';
|
||||||
|
|
||||||
class phpbb_extension_modules_test extends phpbb_test_case
|
class phpbb_extension_modules_test extends phpbb_test_case
|
||||||
|
@ -145,7 +146,7 @@ class phpbb_extension_modules_test extends phpbb_test_case
|
||||||
$this->assertEquals(array(), $acp_modules);
|
$this->assertEquals(array(), $acp_modules);
|
||||||
|
|
||||||
// No specific module, module class set to false (will default to the above acp)
|
// No specific module, module class set to false (will default to the above acp)
|
||||||
// Setting $use_all_available will have no effect here as the ext manager is just mocked
|
// Setting $use_all_available will cause get_module_infos() to also load not enabled extensions (barfoo)
|
||||||
$this->acp_modules->module_class = 'acp';
|
$this->acp_modules->module_class = 'acp';
|
||||||
$acp_modules = $this->acp_modules->get_module_infos('', false, true);
|
$acp_modules = $this->acp_modules->get_module_infos('', false, true);
|
||||||
$this->assertEquals(array(
|
$this->assertEquals(array(
|
||||||
|
@ -165,6 +166,27 @@ class phpbb_extension_modules_test extends phpbb_test_case
|
||||||
'test' => array('title' => 'Test', 'auth' => '', 'cat' => array('ACP_GENERAL')),
|
'test' => array('title' => 'Test', 'auth' => '', 'cat' => array('ACP_GENERAL')),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
'phpbb_ext_barfoo_acp_a_module' => array(
|
||||||
|
'filename' => 'phpbb_ext_barfoo_acp_a_module',
|
||||||
|
'title' => 'Barfoo',
|
||||||
|
'version' => '3.1.0-dev',
|
||||||
|
'modes' => array(
|
||||||
|
'config' => array('title' => 'Config', 'auth' => '', 'cat' => array('ACP_MODS')),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
), $acp_modules);
|
||||||
|
|
||||||
|
// Specific module set to disabled extension
|
||||||
|
$acp_modules = $this->acp_modules->get_module_infos('phpbb_ext_barfoo_acp_a_module', 'acp', true);
|
||||||
|
$this->assertEquals(array(
|
||||||
|
'phpbb_ext_barfoo_acp_a_module' => array(
|
||||||
|
'filename' => 'phpbb_ext_barfoo_acp_a_module',
|
||||||
|
'title' => 'Barfoo',
|
||||||
|
'version' => '3.1.0-dev',
|
||||||
|
'modes' => array(
|
||||||
|
'config' => array('title' => 'Config', 'auth' => '', 'cat' => array('ACP_MODS')),
|
||||||
|
),
|
||||||
|
)
|
||||||
), $acp_modules);
|
), $acp_modules);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue