1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 14:00:31 +02:00

[ticket/15725] Fix installing ext in tests for master branch

PHPBB3-15725
This commit is contained in:
rxu
2018-07-28 16:32:24 +07:00
committed by Marc Alexander
parent 64b053c997
commit ab0dae6003
3 changed files with 151 additions and 4 deletions

View File

@@ -424,9 +424,9 @@ class phpbb_functional_test_case extends phpbb_test_case
$ext_path = str_replace('/', '%2F', $extension);
$crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=enable_pre&ext_name=' . $ext_path . '&sid=' . $this->sid);
$this->assertGreaterThan(0, $crawler->filter('.submit-buttons')->count());
$this->assertGreaterThan(1, $crawler->filter('div.main fieldset div input.button2')->count());
$form = $crawler->selectButton('Enable')->form();
$form = $crawler->selectButton('confirm')->form();
$crawler = self::submit($form);
$this->add_lang('acp/extensions');
@@ -446,6 +446,72 @@ class phpbb_functional_test_case extends phpbb_test_case
$this->logout();
}
public function disable_ext($extension)
{
$this->login();
$this->admin_login();
$ext_path = str_replace('/', '%2F', $extension);
$crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=disable_pre&ext_name=' . $ext_path . '&sid=' . $this->sid);
$this->assertGreaterThan(1, $crawler->filter('div.main fieldset div input.button2')->count());
$form = $crawler->selectButton('confirm')->form();
$crawler = self::submit($form);
$this->add_lang('acp/extensions');
$meta_refresh = $crawler->filter('meta[http-equiv="refresh"]');
// Wait for extension to be fully enabled
while (count($meta_refresh))
{
preg_match('#url=.+/(adm+.+)#', $meta_refresh->attr('content'), $match);
$url = $match[1];
$crawler = self::request('POST', $url);
$meta_refresh = $crawler->filter('meta[http-equiv="refresh"]');
}
$this->assertContainsLang('EXTENSION_DISABLE_SUCCESS', $crawler->filter('div.successbox')->text());
$this->logout();
}
public function delete_ext_data($extension)
{
$this->login();
$this->admin_login();
$ext_path = str_replace('/', '%2F', $extension);
$crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=delete_data_pre&ext_name=' . $ext_path . '&sid=' . $this->sid);
$this->assertGreaterThan(1, $crawler->filter('div.main fieldset div input.button2')->count());
$form = $crawler->selectButton('confirm')->form();
$crawler = self::submit($form);
$this->add_lang('acp/extensions');
$meta_refresh = $crawler->filter('meta[http-equiv="refresh"]');
// Wait for extension to be fully enabled
while (count($meta_refresh))
{
preg_match('#url=.+/(adm+.+)#', $meta_refresh->attr('content'), $match);
$url = $match[1];
$crawler = self::request('POST', $url);
$meta_refresh = $crawler->filter('meta[http-equiv="refresh"]');
}
$this->assertContainsLang('EXTENSION_DELETE_DATA_SUCCESS', $crawler->filter('div.successbox')->text());
$this->logout();
}
public function uninstall_ext($extension)
{
$this->disable_ext($extension);
$this->delete_ext_data($extension);
}
static private function recreate_database($config)
{
$db_conn_mgr = new phpbb_database_test_connection_manager($config);