mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-12 11:44:08 +02:00
[ticket/11465] Add unit tests for acp_modules::get_module_infos()
The tests add 3 different modules. One acp module that should be found (acp/a_module), one acp module that should not be found (acp/fail_module), and one mcp module that should work again (mcp/a_module). The modules' info files had to be included as they were not auto-loaded for some reason. There are several test stages. First of, it is tested if the correct mcp and acp module is returned. Afterwards, the proper loading of specified modules is tested. One with an existing module and one with a not existing module. Finally, the test concludes with trying to get the module info of not existing ucp modules. Other classes like foobar would have also worked for that check but I decided to use the ucp type of class as that is the one type missing from the added test modules. PHPBB3-11465
This commit is contained in:
16
tests/extension/ext/foo/acp/a_info.php
Normal file
16
tests/extension/ext/foo/acp/a_info.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
class phpbb_ext_foo_acp_a_info
|
||||
{
|
||||
public function module()
|
||||
{
|
||||
return array(
|
||||
'filename' => 'phpbb_ext_foo_acp_a_module',
|
||||
'title' => 'Foobar',
|
||||
'version' => '3.1.0-dev',
|
||||
'modes' => array(
|
||||
'config' => array('title' => 'Config', 'auth' => '', 'cat' => array('ACP_MODS')),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
5
tests/extension/ext/foo/acp/a_module.php
Normal file
5
tests/extension/ext/foo/acp/a_module.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
class phpbb_ext_foo_acp_a_module
|
||||
{
|
||||
}
|
16
tests/extension/ext/foo/acp/fail_info.php
Normal file
16
tests/extension/ext/foo/acp/fail_info.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
class phpbb_ext_foo_acp_foo_info
|
||||
{
|
||||
public function module()
|
||||
{
|
||||
return array(
|
||||
'filename' => 'phpbb_ext_foo_acp_fail_module',
|
||||
'title' => 'Foobar',
|
||||
'version' => '3.1.0-dev',
|
||||
'modes' => array(
|
||||
'config' => array('title' => 'Config', 'auth' => '', 'cat' => array('ACP_MODS')),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
5
tests/extension/ext/foo/acp/fail_module.php
Normal file
5
tests/extension/ext/foo/acp/fail_module.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
class phpbb_ext_foo_acp_fail_module
|
||||
{
|
||||
}
|
16
tests/extension/ext/foo/mcp/a_info.php
Normal file
16
tests/extension/ext/foo/mcp/a_info.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
class phpbb_ext_foo_mcp_a_info
|
||||
{
|
||||
public function module()
|
||||
{
|
||||
return array(
|
||||
'filename' => 'phpbb_ext_foo_mcp_a_module',
|
||||
'title' => 'Foobar',
|
||||
'version' => '3.1.0-dev',
|
||||
'modes' => array(
|
||||
'config' => array('title' => 'Config', 'auth' => '', 'cat' => array('MCP_MAIN')),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
5
tests/extension/ext/foo/mcp/a_module.php
Normal file
5
tests/extension/ext/foo/mcp/a_module.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
class phpbb_ext_foo_mcp_a_module
|
||||
{
|
||||
}
|
Reference in New Issue
Block a user