diff options
author | kasimi <mail@kasimi.net> | 2018-03-11 22:13:03 +0100 |
---|---|---|
committer | kasimi <mail@kasimi.net> | 2018-03-11 22:17:26 +0100 |
commit | aa9d24ad3176a2fa0551a65355c05208774eeb6b (patch) | |
tree | bd109c45bd86bfc1a06db667d87249b82c1f8354 /tests/dbal/migrator_tool_module_test.php | |
parent | 2d5fe90ed5735c44ae733959c96da3a67a5d2647 (diff) | |
download | forums-aa9d24ad3176a2fa0551a65355c05208774eeb6b.tar forums-aa9d24ad3176a2fa0551a65355c05208774eeb6b.tar.gz forums-aa9d24ad3176a2fa0551a65355c05208774eeb6b.tar.bz2 forums-aa9d24ad3176a2fa0551a65355c05208774eeb6b.tar.xz forums-aa9d24ad3176a2fa0551a65355c05208774eeb6b.zip |
[ticket/15586] Added tests for adding modules the automatic way
PHPBB3-15586
Diffstat (limited to 'tests/dbal/migrator_tool_module_test.php')
-rw-r--r-- | tests/dbal/migrator_tool_module_test.php | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/dbal/migrator_tool_module_test.php b/tests/dbal/migrator_tool_module_test.php index c625b93ded..117db0760f 100644 --- a/tests/dbal/migrator_tool_module_test.php +++ b/tests/dbal/migrator_tool_module_test.php @@ -11,6 +11,9 @@ * */ +require_once dirname(__FILE__) . '/ext/foo/bar/acp/acp_test_info.php'; +require_once dirname(__FILE__) . '/ext/foo/bar/ucp/ucp_test_info.php'; + class phpbb_dbal_migrator_tool_module_test extends phpbb_database_test_case { public function getDataSet() @@ -39,6 +42,9 @@ class phpbb_dbal_migrator_tool_module_test extends phpbb_database_test_case $auth = $this->getMock('\phpbb\auth\auth'); $phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); + // Correctly set the root path for this test to this directory, so the classes can be found + $phpbb_root_path = dirname(__FILE__) . '/'; + $phpbb_extension_manager = new phpbb_mock_extension_manager($phpbb_root_path); $module_manager = new \phpbb\module\module_manager($cache, $this->db, $phpbb_extension_manager, MODULES_TABLE, $phpbb_root_path, $phpEx); @@ -250,6 +256,35 @@ class phpbb_dbal_migrator_tool_module_test extends phpbb_database_test_case $this->fail($e); } $this->assertEquals(true, $this->tool->exists('ucp', 'UCP_NEW_SUBCAT', 'UCP_NEW_MODULE')); + + // Test adding new UCP module the automatic way, single mode + try + { + $this->tool->add('ucp', 'UCP_NEW_CAT', array( + 'module_basename' => '\foo\bar\ucp\ucp_test_module', + 'modes' => array('mode_1'), + )); + } + catch (Exception $e) + { + $this->fail($e); + } + $this->assertEquals(true, $this->tool->exists('ucp', 'UCP_NEW_CAT', 'UCP_NEW_MODULE_MODE_1')); + $this->assertEquals(false, $this->tool->exists('ucp', 'UCP_NEW_CAT', 'UCP_NEW_MODULE_MODE_2')); + + // Test adding new ACP module the automatic way, all modes + try + { + $this->tool->add('acp', 'ACP_NEW_CAT', array( + 'module_basename' => '\foo\bar\acp\acp_test_module', + )); + } + catch (Exception $e) + { + $this->fail($e); + } + $this->assertEquals(true, $this->tool->exists('acp', 'ACP_NEW_CAT', 'ACP_NEW_MODULE_MODE_1')); + $this->assertEquals(true, $this->tool->exists('acp', 'ACP_NEW_CAT', 'ACP_NEW_MODULE_MODE_2')); } public function test_remove() |