mirror of
https://github.com/phpbb/phpbb.git
synced 2025-04-11 11:24:23 +02:00
[ticket/15725] Fix installing ext in tests for master branch
PHPBB3-15725
This commit is contained in:
parent
a9e0d91cc1
commit
c90e8d270f
@ -233,5 +233,10 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case
|
||||
// Attempt to enable invalid extension
|
||||
$crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=enable_pre&ext_name=barfoo&sid=' . $this->sid);
|
||||
$this->assertContainsLang('EXTENSION_DIR_INVALID', $crawler->filter('.errorbox')->text());
|
||||
|
||||
// Test installing/uninstalling extension altogether
|
||||
$this->logout();
|
||||
$this->install_ext('vendor/moo');
|
||||
$this->uninstall_ext('vendor/moo');
|
||||
}
|
||||
}
|
||||
|
@ -415,9 +415,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');
|
||||
|
||||
@ -437,6 +437,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);
|
||||
|
@ -307,9 +307,9 @@ class phpbb_ui_test_case extends phpbb_test_case
|
||||
$ext_path = str_replace('/', '%2F', $extension);
|
||||
|
||||
$this->visit('adm/index.php?i=acp_extensions&mode=main&action=enable_pre&ext_name=' . $ext_path . '&sid=' . $this->sid);
|
||||
$this->assertNotEmpty(count($this->find_element('cssSelector', '.submit-buttons')));
|
||||
$this->assertNotEmpty(count($this->find_element('cssSelector', 'div.main fieldset div input.button2')));
|
||||
|
||||
$this->find_element('cssSelector', "input[value='Enable']")->submit();
|
||||
$this->find_element('cssSelector', "input[value='Yes']")->submit();
|
||||
$this->add_lang('acp/extensions');
|
||||
|
||||
try
|
||||
@ -334,6 +334,82 @@ class phpbb_ui_test_case extends phpbb_test_case
|
||||
$this->logout();
|
||||
}
|
||||
|
||||
public function disable_ext($extension)
|
||||
{
|
||||
$this->login();
|
||||
$this->admin_login();
|
||||
|
||||
$ext_path = str_replace('/', '%2F', $extension);
|
||||
|
||||
$this->visit('adm/index.php?i=acp_extensions&mode=main&action=disable_pre&ext_name=' . $ext_path . '&sid=' . $this->sid);
|
||||
$this->assertNotEmpty(count($this->find_element('cssSelector', 'div.main fieldset div input.button2')));
|
||||
|
||||
$this->find_element('cssSelector', "input[value='Yes']")->submit();
|
||||
$this->add_lang('acp/extensions');
|
||||
|
||||
try
|
||||
{
|
||||
$meta_refresh = $this->find_element('cssSelector', 'meta[http-equiv="refresh"]');
|
||||
|
||||
// Wait for extension to be fully enabled
|
||||
while (count($meta_refresh))
|
||||
{
|
||||
preg_match('#url=.+/(adm+.+)#', $meta_refresh->getAttribute('content'), $match);
|
||||
$this->getDriver()->execute(array('method' => 'post', 'url' => $match[1]));
|
||||
$meta_refresh = $this->find_element('cssSelector', 'meta[http-equiv="refresh"]');
|
||||
}
|
||||
}
|
||||
catch (\Facebook\WebDriver\Exception\NoSuchElementException $e)
|
||||
{
|
||||
// Probably no refresh triggered
|
||||
}
|
||||
|
||||
$this->assertContainsLang('EXTENSION_DISABLE_SUCCESS', $this->find_element('cssSelector', 'div.successbox')->getText());
|
||||
|
||||
$this->logout();
|
||||
}
|
||||
|
||||
public function delete_ext_data($extension)
|
||||
{
|
||||
$this->login();
|
||||
$this->admin_login();
|
||||
|
||||
$ext_path = str_replace('/', '%2F', $extension);
|
||||
|
||||
$this->visit('adm/index.php?i=acp_extensions&mode=main&action=delete_data_pre&ext_name=' . $ext_path . '&sid=' . $this->sid);
|
||||
$this->assertNotEmpty(count($this->find_element('cssSelector', 'div.main fieldset div input.button2')));
|
||||
|
||||
$this->find_element('cssSelector', "input[value='Yes']")->submit();
|
||||
$this->add_lang('acp/extensions');
|
||||
|
||||
try
|
||||
{
|
||||
$meta_refresh = $this->find_element('cssSelector', 'meta[http-equiv="refresh"]');
|
||||
|
||||
// Wait for extension to be fully enabled
|
||||
while (count($meta_refresh))
|
||||
{
|
||||
preg_match('#url=.+/(adm+.+)#', $meta_refresh->getAttribute('content'), $match);
|
||||
$this->getDriver()->execute(array('method' => 'post', 'url' => $match[1]));
|
||||
$meta_refresh = $this->find_element('cssSelector', 'meta[http-equiv="refresh"]');
|
||||
}
|
||||
}
|
||||
catch (\Facebook\WebDriver\Exception\NoSuchElementException $e)
|
||||
{
|
||||
// Probably no refresh triggered
|
||||
}
|
||||
|
||||
$this->assertContainsLang('EXTENSION_DELETE_DATA_SUCCESS', $this->find_element('cssSelector', 'div.successbox')->getText());
|
||||
|
||||
$this->logout();
|
||||
}
|
||||
|
||||
public function uninstall_ext($extension)
|
||||
{
|
||||
$this->disable_ext($extension);
|
||||
$this->delete_ext_data($extension);
|
||||
}
|
||||
|
||||
protected function get_cache_driver()
|
||||
{
|
||||
if (!$this->cache)
|
||||
|
Loading…
x
Reference in New Issue
Block a user