From ab0dae600335eb66a31c951e27954accac208296 Mon Sep 17 00:00:00 2001 From: rxu Date: Sat, 28 Jul 2018 16:32:24 +0700 Subject: [ticket/15725] Fix installing ext in tests for master branch PHPBB3-15725 --- tests/test_framework/phpbb_ui_test_case.php | 80 ++++++++++++++++++++++++++++- 1 file changed, 78 insertions(+), 2 deletions(-) (limited to 'tests/test_framework/phpbb_ui_test_case.php') diff --git a/tests/test_framework/phpbb_ui_test_case.php b/tests/test_framework/phpbb_ui_test_case.php index 7b950a7d5d..09b0927966 100644 --- a/tests/test_framework/phpbb_ui_test_case.php +++ b/tests/test_framework/phpbb_ui_test_case.php @@ -322,9 +322,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 @@ -349,6 +349,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) -- cgit v1.2.1 From ebac54aa9e705e99a562d2fe2c0f57bc6af8dd32 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 30 Dec 2018 11:36:08 +0100 Subject: [ticket/14948] Adjust calls for twig and phpunit updates PHPBB3-14948 --- tests/test_framework/phpbb_ui_test_case.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests/test_framework/phpbb_ui_test_case.php') diff --git a/tests/test_framework/phpbb_ui_test_case.php b/tests/test_framework/phpbb_ui_test_case.php index 09b0927966..2d249f5c73 100644 --- a/tests/test_framework/phpbb_ui_test_case.php +++ b/tests/test_framework/phpbb_ui_test_case.php @@ -105,7 +105,7 @@ class phpbb_ui_test_case extends phpbb_test_case return array(); } - public function setUp() + public function setUp(): void { if (!self::$install_success) { @@ -137,7 +137,7 @@ class phpbb_ui_test_case extends phpbb_test_case } } - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); @@ -424,7 +424,7 @@ class phpbb_ui_test_case extends phpbb_test_case $this->disable_ext($extension); $this->delete_ext_data($extension); } - + protected function get_cache_driver() { if (!$this->cache) -- cgit v1.2.1 From 978d883abb4f62f1b644bdab760fedbabdb61690 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 2 Jan 2019 20:34:45 +0100 Subject: [ticket/14948] Remove checks for unsupported PHP versions PHPBB3-14948 --- tests/test_framework/phpbb_ui_test_case.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'tests/test_framework/phpbb_ui_test_case.php') diff --git a/tests/test_framework/phpbb_ui_test_case.php b/tests/test_framework/phpbb_ui_test_case.php index 2d249f5c73..914de2e02a 100644 --- a/tests/test_framework/phpbb_ui_test_case.php +++ b/tests/test_framework/phpbb_ui_test_case.php @@ -52,15 +52,10 @@ class phpbb_ui_test_case extends phpbb_test_case { parent::setUpBeforeClass(); - if (version_compare(PHP_VERSION, '5.3.19', '<')) - { - self::markTestSkipped('UI test case requires at least PHP 5.3.19.'); - } - else if (!class_exists('\Facebook\WebDriver\Remote\RemoteWebDriver')) + if (!class_exists('\Facebook\WebDriver\Remote\RemoteWebDriver')) { self::markTestSkipped( - 'Could not find RemoteWebDriver class. ' . - 'Run "php ../composer.phar install" from the tests folder.' + 'Could not find RemoteWebDriver class.' ); } -- cgit v1.2.1 From 1a4739aed90c88eb49ccbe3ad58af17632f026ec Mon Sep 17 00:00:00 2001 From: mrgoldy Date: Sat, 30 Nov 2019 15:28:01 +0100 Subject: [ticket/16239] Update DB tools in UI test case PHPBB3-16239 --- tests/test_framework/phpbb_ui_test_case.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests/test_framework/phpbb_ui_test_case.php') diff --git a/tests/test_framework/phpbb_ui_test_case.php b/tests/test_framework/phpbb_ui_test_case.php index fcac3594d0..243db39d69 100644 --- a/tests/test_framework/phpbb_ui_test_case.php +++ b/tests/test_framework/phpbb_ui_test_case.php @@ -473,7 +473,8 @@ class phpbb_ui_test_case extends phpbb_test_case $config = new \phpbb\config\config(array()); $db = $this->get_db(); - $db_tools = new \phpbb\db\tools($db); + $factory = new \phpbb\db\tools\factory(); + $db_tools = $factory->get($this->db); $container = new phpbb_mock_container_builder(); $migrator = new \phpbb\db\migrator( -- cgit v1.2.1