diff --git a/phpBB/phpbb/db/migration/tool/module.php b/phpBB/phpbb/db/migration/tool/module.php index 2aeec109a4..8e35d49d03 100644 --- a/phpBB/phpbb/db/migration/tool/module.php +++ b/phpBB/phpbb/db/migration/tool/module.php @@ -377,7 +377,7 @@ class module implements \phpbb\db\migration\tool\tool_interface { if (!$this->exists($class, $parent, $module, true)) { - return; + throw new \phpbb\db\migration\exception('MODULE_NOT_EXIST', $module); } $parent_sql = ''; diff --git a/tests/migrations/fixtures/migration_remove_jabber.xml b/tests/migrations/fixtures/migration_remove_jabber.xml index 452c7fb40b..e263cdafcf 100644 --- a/tests/migrations/fixtures/migration_remove_jabber.xml +++ b/tests/migrations/fixtures/migration_remove_jabber.xml @@ -84,7 +84,7 @@ 1 acp - 0 + 1 48 59 ACP_CLIENT_COMMUNICATION @@ -120,7 +120,7 @@ 121 - u_sendim + u_sendim 1 0 0 diff --git a/tests/migrations/migration_test_base.php b/tests/migrations/migration_test_base.php index b7ccab3ae8..b2d9e3cf26 100644 --- a/tests/migrations/migration_test_base.php +++ b/tests/migrations/migration_test_base.php @@ -59,10 +59,10 @@ abstract class phpbb_migration_test_base extends phpbb_database_test_case $this->cache = new phpbb_mock_cache(); $this->auth = new \phpbb\auth\auth(); $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); - $cache = $this->cache_service = new \phpbb\cache\service(new \phpbb\cache\driver\dummy(), new \phpbb\config\config(array()), $this->db, $phpbb_dispatcher, $phpbb_root_path, $phpEx); - $this->config = new \phpbb\config\db($this->db, $this->cache, 'phpbb_config'); $this->config->initialise($this->cache); + $cache = $this->cache_service = new \phpbb\cache\service($this->cache, $this->config, $this->db, $phpbb_dispatcher, $phpbb_root_path, $phpEx); + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); $lang = new \phpbb\language\language($lang_loader); @@ -86,11 +86,11 @@ abstract class phpbb_migration_test_base extends phpbb_database_test_case $module_manager = new \phpbb\module\module_manager($this->cache, $this->db, $this->extension_manager, 'phpbb_modules', $phpbb_root_path, $phpEx); - $tools = array( - new \phpbb\db\migration\tool\config($this->config), - new \phpbb\db\migration\tool\config_text(new \phpbb\config\db_text($this->db, 'phpbb_config_text')), - new \phpbb\db\migration\tool\module($this->db, $this->user, $module_manager, 'phpbb_modules'), - new \phpbb\db\migration\tool\permission($this->db, $this->cache_service, $this->auth, $phpbb_root_path, $phpEx), + $this->tools = array( + 'config' => new \phpbb\db\migration\tool\config($this->config), + 'config_text' => new \phpbb\db\migration\tool\config_text(new \phpbb\config\db_text($this->db, 'phpbb_config_text')), + 'module' => new \phpbb\db\migration\tool\module($this->db, $this->user, $module_manager, 'phpbb_modules'), + 'permission' => new \phpbb\db\migration\tool\permission($this->db, $this->cache_service, $this->auth, $phpbb_root_path, $phpEx), ); $this->migrator = new \phpbb\db\migrator( @@ -103,7 +103,7 @@ abstract class phpbb_migration_test_base extends phpbb_database_test_case 'php', 'phpbb_', self::get_core_tables(), - $tools, + $this->tools, new \phpbb\db\migration\helper() ); $container->set('migrator', $this->migrator); diff --git a/tests/migrations/remove_jabber_migration_test.php b/tests/migrations/remove_jabber_migration_test.php index 2793ef032a..0a0c70b4ea 100644 --- a/tests/migrations/remove_jabber_migration_test.php +++ b/tests/migrations/remove_jabber_migration_test.php @@ -32,9 +32,9 @@ class phpbb_migrations_remove_jabber_migration_test extends phpbb_migration_test WHERE config_name = 'jab_enable'"; $this->assertNotFalse($this->db->sql_query($sql)); - $sql = "SELECT auth_option FROM phpbb_acl_options - WHERE auth_option = 'a_jabber'"; - $this->assertNotFalse($this->db->sql_query($sql)); + $this->assertTrue($this->tools['permission']->exists('a_jabber')); + $this->assertTrue($this->tools['permission']->exists('u_sendim')); + $this->assertTrue($this->tools['module']->exists('acp', 'ACP_CLIENT_COMMUNICATION', 'ACP_JABBER_SETTINGS')); $this->apply_migration(); @@ -55,10 +55,9 @@ class phpbb_migrations_remove_jabber_migration_test extends phpbb_migration_test $this->db->sql_query($sql); $this->assertFalse($this->db->sql_fetchfield('config_name')); - $sql = "SELECT auth_option FROM phpbb_acl_options - WHERE auth_option = 'a_jabber'"; - $this->db->sql_query($sql); - $this->assertFalse($this->db->sql_fetchfield('auth_option')); + $this->assertFalse($this->tools['permission']->exists('a_jabber')); + $this->assertFalse($this->tools['permission']->exists('u_sendim')); + $this->assertFalse($this->tools['module']->exists('acp', 'ACP_CLIENT_COMMUNICATION', 'ACP_JABBER_SETTINGS')); $this->revert_migration(); @@ -67,9 +66,8 @@ class phpbb_migrations_remove_jabber_migration_test extends phpbb_migration_test $this->db->sql_query($sql); $this->assertEquals('jab_enable', $this->db->sql_fetchfield('config_name')); - $sql = "SELECT auth_option FROM phpbb_acl_options - WHERE auth_option = 'a_jabber'"; - $this->db->sql_query($sql); - $this->assertEquals('a_jabber', $this->db->sql_fetchfield('auth_option')); + $this->assertTrue($this->tools['permission']->exists('a_jabber')); + $this->assertTrue($this->tools['permission']->exists('u_sendim')); + $this->assertTrue($this->tools['module']->exists('acp', 'ACP_CLIENT_COMMUNICATION', 'ACP_JABBER_SETTINGS')); } }