aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_framework
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_framework')
-rw-r--r--tests/test_framework/phpbb_database_test_case.php26
-rw-r--r--tests/test_framework/phpbb_database_test_connection_manager.php16
-rw-r--r--tests/test_framework/phpbb_functional_test_case.php90
-rw-r--r--tests/test_framework/phpbb_session_test_case.php28
-rw-r--r--tests/test_framework/phpbb_test_case.php12
-rw-r--r--tests/test_framework/phpbb_test_case_helpers.php45
-rw-r--r--tests/test_framework/phpbb_ui_test_case.php96
7 files changed, 247 insertions, 66 deletions
diff --git a/tests/test_framework/phpbb_database_test_case.php b/tests/test_framework/phpbb_database_test_case.php
index 606c40a623..c098ff64bd 100644
--- a/tests/test_framework/phpbb_database_test_case.php
+++ b/tests/test_framework/phpbb_database_test_case.php
@@ -11,7 +11,9 @@
*
*/
-abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_TestCase
+use PHPUnit\DbUnit\TestCase;
+
+abstract class phpbb_database_test_case extends TestCase
{
static private $already_connected;
@@ -31,10 +33,10 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test
{
parent::__construct($name, $data, $dataName);
$this->backupStaticAttributesBlacklist += array(
- 'PHP_CodeCoverage' => array('instance'),
- 'PHP_CodeCoverage_Filter' => array('instance'),
- 'PHP_CodeCoverage_Util' => array('ignoredLines', 'templateMethods'),
- 'PHP_Timer' => array('startTimes',),
+ 'SebastianBergmann\CodeCoverage\CodeCoverage' => array('instance'),
+ 'SebastianBergmann\CodeCoverage\Filter' => array('instance'),
+ 'SebastianBergmann\CodeCoverage\Util' => array('ignoredLines', 'templateMethods'),
+ 'SebastianBergmann\Timer\Timer' => array('startTimes',),
'PHP_Token_Stream' => array('customTokens'),
'PHP_Token_Stream_CachingFactory' => array('cache'),
@@ -99,7 +101,7 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test
parent::tearDownAfterClass();
}
- protected function tearDown()
+ protected function tearDown(): void
{
parent::tearDown();
@@ -113,7 +115,7 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test
}
}
- protected function setUp()
+ protected function setUp(): void
{
parent::setUp();
@@ -146,7 +148,7 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test
* Create xml data set for insertion into database
*
* @param string $path Path to fixture XML
- * @return PHPUnit_Extensions_Database_DataSet_DefaultDataSet|PHPUnit_Extensions_Database_DataSet_XmlDataSet
+ * @return PHPUnit\DbUnit\DataSet\DefaultDataSet|PHPUnit\DbUnit\DataSet\XmlDataSet
*/
public function createXMLDataSet($path)
{
@@ -155,11 +157,11 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test
// Extend XML data set on MSSQL
if (strpos($this->get_database_config()['dbms'], 'mssql') !== false)
{
- $newXmlData = new PHPUnit_Extensions_Database_DataSet_DefaultDataSet();
+ $newXmlData = new PHPUnit\DbUnit\DataSet\DefaultDataSet([]);
$db = $this->new_dbal();
foreach ($this->fixture_xml_data as $key => $value)
{
- /** @var \PHPUnit_Extensions_Database_DataSet_DefaultTableMetaData $tableMetaData */
+ /** @var PHPUnit\DbUnit\DataSet\DefaultTableMetaData $tableMetaData */
$tableMetaData = $value->getTableMetaData();
$columns = $tableMetaData->getColumns();
$primaryKeys = $tableMetaData->getPrimaryKeys();
@@ -201,8 +203,8 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test
$columns[] = 'mssqlindex';
}
- $newMetaData = new PHPUnit_Extensions_Database_DataSet_DefaultTableMetaData($key, $columns, $primaryKeys);
- $newTable = new PHPUnit_Extensions_Database_DataSet_DefaultTable($newMetaData);
+ $newMetaData = new PHPUnit\DbUnit\DataSet\DefaultTableMetaData($key, $columns, $primaryKeys);
+ $newTable = new PHPUnit\DbUnit\DataSet\DefaultTable($newMetaData);
for ($i = 0; $i < $value->getRowCount(); $i++)
{
$dataRow = $value->getRow($i);
diff --git a/tests/test_framework/phpbb_database_test_connection_manager.php b/tests/test_framework/phpbb_database_test_connection_manager.php
index f3adbefc1b..fec4709fbd 100644
--- a/tests/test_framework/phpbb_database_test_connection_manager.php
+++ b/tests/test_framework/phpbb_database_test_connection_manager.php
@@ -150,7 +150,6 @@ class phpbb_database_test_connection_manager
switch ($this->config['dbms'])
{
- case 'phpbb\db\driver\mysql':
case 'phpbb\db\driver\mysqli':
$this->pdo->exec('SET NAMES utf8');
@@ -270,7 +269,6 @@ class phpbb_database_test_connection_manager
switch ($this->config['dbms'])
{
- case 'phpbb\db\driver\mysql':
case 'phpbb\db\driver\mysqli':
$sql = 'SHOW TABLES';
break;
@@ -336,14 +334,7 @@ class phpbb_database_test_connection_manager
$sth = $this->pdo->query('SELECT VERSION() AS version');
$row = $sth->fetch(PDO::FETCH_ASSOC);
- if (version_compare($row['version'], '4.1.3', '>='))
- {
- $schema .= '_41';
- }
- else
- {
- $schema .= '_40';
- }
+ $schema .= '_41';
}
$filename = $directory . $schema . '_schema.sql';
@@ -424,11 +415,6 @@ class phpbb_database_test_connection_manager
'DELIM' => ';',
'PDO' => 'mysql',
),
- 'phpbb\db\driver\mysql' => array(
- 'SCHEMA' => 'mysql',
- 'DELIM' => ';',
- 'PDO' => 'mysql',
- ),
'phpbb\db\driver\mssql' => array(
'SCHEMA' => 'mssql',
'DELIM' => 'GO',
diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php
index f1b30f0fed..a31aa648bc 100644
--- a/tests/test_framework/phpbb_functional_test_case.php
+++ b/tests/test_framework/phpbb_functional_test_case.php
@@ -75,7 +75,7 @@ class phpbb_functional_test_case extends phpbb_test_case
return array();
}
- public function setUp()
+ public function setUp(): void
{
parent::setUp();
@@ -114,7 +114,7 @@ class phpbb_functional_test_case extends phpbb_test_case
}
}
- protected function tearDown()
+ protected function tearDown(): void
{
parent::tearDown();
@@ -234,7 +234,7 @@ class phpbb_functional_test_case extends phpbb_test_case
{
global $phpbb_root_path, $phpEx;
- $config = new \phpbb\config\config(array());
+ $config = new \phpbb\config\config(array('version' => PHPBB_VERSION));
$db = $this->get_db();
$factory = new \phpbb\db\tools\factory();
$db_tools = $factory->get($db);
@@ -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);
@@ -651,11 +717,11 @@ class phpbb_functional_test_case extends phpbb_test_case
$db = $this->get_db();
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
- $user = $this->getMock('\phpbb\user', array(), array(
+ $user = $this->createMock('\phpbb\user', array(), array(
new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
'\phpbb\datetime'
));
- $auth = $this->getMock('\phpbb\auth\auth');
+ $auth = $this->createMock('\phpbb\auth\auth');
$phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE);
$cache = new phpbb_mock_null_cache;
@@ -688,17 +754,17 @@ class phpbb_functional_test_case extends phpbb_test_case
$db = $this->get_db();
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
- $user = $this->getMock('\phpbb\user', array(), array(
+ $user = $this->createMock('\phpbb\user', array(), array(
new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
'\phpbb\datetime'
));
- $auth = $this->getMock('\phpbb\auth\auth');
+ $auth = $this->createMock('\phpbb\auth\auth');
$phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE);
$cache = new phpbb_mock_null_cache;
$cache_driver = new \phpbb\cache\driver\dummy();
- $phpbb_container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
+ $phpbb_container = $this->createMock('Symfony\Component\DependencyInjection\ContainerInterface');
$phpbb_container
->expects($this->any())
->method('get')
@@ -863,7 +929,7 @@ class phpbb_functional_test_case extends phpbb_test_case
* @param string $haystack Search this
* @param string $message Optional failure message
*/
- public function assertContainsLang($needle, $haystack, $message = null)
+ public function assertContainsLang($needle, $haystack, $message = '')
{
$this->assertContains(html_entity_decode($this->lang($needle), ENT_QUOTES), $haystack, $message);
}
@@ -875,7 +941,7 @@ class phpbb_functional_test_case extends phpbb_test_case
* @param string $haystack Search this
* @param string $message Optional failure message
*/
- public function assertNotContainsLang($needle, $haystack, $message = null)
+ public function assertNotContainsLang($needle, $haystack, $message = '')
{
$this->assertNotContains(html_entity_decode($this->lang($needle), ENT_QUOTES), $haystack, $message);
}
diff --git a/tests/test_framework/phpbb_session_test_case.php b/tests/test_framework/phpbb_session_test_case.php
index b3d7780d14..530d8c6b48 100644
--- a/tests/test_framework/phpbb_session_test_case.php
+++ b/tests/test_framework/phpbb_session_test_case.php
@@ -25,7 +25,7 @@ abstract class phpbb_session_test_case extends phpbb_database_test_case
/** @var \phpbb\db\driver\driver_interface */
protected $db;
- function setUp()
+ function setUp(): void
{
parent::setUp();
@@ -37,7 +37,7 @@ abstract class phpbb_session_test_case extends phpbb_database_test_case
$phpbb_path_helper = new \phpbb\path_helper(
$symfony_request,
$phpbb_filesystem,
- $this->getMock('\phpbb\request\request'),
+ $this->createMock('\phpbb\request\request'),
$phpbb_root_path,
$phpEx
);
@@ -48,11 +48,33 @@ abstract class phpbb_session_test_case extends phpbb_database_test_case
new phpbb_session_testable_facade($this->db, $this->session_factory);
}
+ protected function check_user_session_data($expected_session_data, $message)
+ {
+ $sql= 'SELECT username_clean, user_lastvisit, user_lastpage
+ FROM ' . USERS_TABLE . '
+ ORDER BY user_id';
+
+ $this->assertSqlResultEquals($expected_session_data, $sql, $message);
+ }
+
+ protected function check_expired_sessions_recent($expected_sessions, $message)
+ {
+ global $config;
+ $time_now = time();
+ $sql = 'SELECT session_user_id, MAX(session_time) AS recent_time
+ FROM ' . SESSIONS_TABLE . '
+ WHERE session_time < ' . ($time_now - (int) $config['session_length']) . '
+ AND session_user_id <> ' . ANONYMOUS . '
+ GROUP BY session_user_id';
+
+ $this->assertSqlResultEquals($expected_sessions, $sql, $message);
+ }
+
protected function check_sessions_equals($expected_sessions, $message)
{
$sql = 'SELECT session_id, session_user_id
FROM phpbb_sessions
- ORDER BY session_user_id';
+ ORDER BY session_user_id, session_id';
$this->assertSqlResultEquals($expected_sessions, $sql, $message);
}
diff --git a/tests/test_framework/phpbb_test_case.php b/tests/test_framework/phpbb_test_case.php
index 01d26fb67d..8e09f17ede 100644
--- a/tests/test_framework/phpbb_test_case.php
+++ b/tests/test_framework/phpbb_test_case.php
@@ -11,7 +11,9 @@
*
*/
-class phpbb_test_case extends PHPUnit_Framework_TestCase
+use PHPUnit\Framework\TestCase;
+
+class phpbb_test_case extends TestCase
{
protected $test_case_helpers;
@@ -19,10 +21,10 @@ class phpbb_test_case extends PHPUnit_Framework_TestCase
{
parent::__construct($name, $data, $dataName);
$this->backupStaticAttributesBlacklist += array(
- 'PHP_CodeCoverage' => array('instance'),
- 'PHP_CodeCoverage_Filter' => array('instance'),
- 'PHP_CodeCoverage_Util' => array('ignoredLines', 'templateMethods'),
- 'PHP_Timer' => array('startTimes',),
+ 'SebastianBergmann\CodeCoverage\CodeCoverage' => array('instance'),
+ 'SebastianBergmann\CodeCoverage\Filter' => array('instance'),
+ 'SebastianBergmann\CodeCoverage\Util' => array('ignoredLines', 'templateMethods'),
+ 'SebastianBergmann\Timer\Timer' => array('startTimes',),
'PHP_Token_Stream' => array('customTokens'),
'PHP_Token_Stream_CachingFactory' => array('cache'),
diff --git a/tests/test_framework/phpbb_test_case_helpers.php b/tests/test_framework/phpbb_test_case_helpers.php
index c792976b1e..9a2ea275d0 100644
--- a/tests/test_framework/phpbb_test_case_helpers.php
+++ b/tests/test_framework/phpbb_test_case_helpers.php
@@ -81,21 +81,26 @@ class phpbb_test_case_helpers
{
case E_NOTICE:
case E_STRICT:
- PHPUnit_Framework_Error_Notice::$enabled = true;
- $exceptionName = 'PHPUnit_Framework_Error_Notice';
+ PHPUnit\Framework\Error\Notice::$enabled = true;
+ $exceptionName = 'PHPUnit\Framework\Error\Notice';
break;
case E_WARNING:
- PHPUnit_Framework_Error_Warning::$enabled = true;
- $exceptionName = 'PHPUnit_Framework_Error_Warning';
+ PHPUnit\Framework\Error\Warning::$enabled = true;
+ $exceptionName = 'PHPUnit\Framework\Error\Warning';
break;
default:
- $exceptionName = 'PHPUnit_Framework_Error';
+ $exceptionName = 'PHPUnit\Framework\Error\Error';
break;
}
$this->expectedTriggerError = true;
- $this->test_case->setExpectedException($exceptionName, (string) $message, $errno);
+ $this->test_case->expectException($exceptionName);
+ $this->test_case->expectExceptionCode($errno);
+ if ($message)
+ {
+ $this->test_case->expectExceptionMessage((string) $message);
+ }
}
public function makedirs($path)
@@ -168,6 +173,16 @@ class phpbb_test_case_helpers
{
$config['fulltext_sphinx_id'] = $fulltext_sphinx_id;
}
+
+ if (isset($phpbb_memcached_host))
+ {
+ $config['memcached_host'] = $phpbb_memcached_host;
+ }
+
+ if (isset($phpbb_memcached_port))
+ {
+ $config['memcached_port'] = $phpbb_memcached_port;
+ }
}
if (isset($_SERVER['PHPBB_TEST_DBMS']))
@@ -200,6 +215,16 @@ class phpbb_test_case_helpers
$config['redis_port'] = $_SERVER['PHPBB_TEST_REDIS_PORT'];
}
+ if (isset($_SERVER['PHPBB_TEST_MEMCACHED_HOST']))
+ {
+ $config['memcached_host'] = $_SERVER['PHPBB_TEST_MEMCACHED_HOST'];
+ }
+
+ if (isset($_SERVER['PHPBB_TEST_MEMCACHED_PORT']))
+ {
+ $config['memcached_port'] = $_SERVER['PHPBB_TEST_MEMCACHED_PORT'];
+ }
+
return $config;
}
@@ -382,10 +407,16 @@ class phpbb_test_case_helpers
}
// Mock the DAL, make it return data from the fixture
+ $db_driver = $this->test_case->getMockBuilder('phpbb\\db\\driver\\driver')
+ ->disableOriginalConstructor()
+ ->disableOriginalClone()
+ ->disableArgumentCloning()
+ ->disallowMockingUnknownTypes()
+ ->getMock();
$mb = $this->test_case->getMockBuilder('phpbb\\textformatter\\data_access');
$mb->setMethods(array('get_bbcodes', 'get_censored_words', 'get_smilies', 'get_styles'));
$mb->setConstructorArgs(array(
- $this->test_case->getMockBuilder('phpbb\\db\\driver\\driver')->getMock(),
+ $db_driver,
'phpbb_bbcodes',
'phpbb_smilies',
'phpbb_styles',
diff --git a/tests/test_framework/phpbb_ui_test_case.php b/tests/test_framework/phpbb_ui_test_case.php
index 48e510abe3..243db39d69 100644
--- a/tests/test_framework/phpbb_ui_test_case.php
+++ b/tests/test_framework/phpbb_ui_test_case.php
@@ -53,15 +53,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.'
);
}
@@ -108,7 +103,7 @@ class phpbb_ui_test_case extends phpbb_test_case
return array();
}
- public function setUp()
+ public function setUp(): void
{
if (!self::$install_success)
{
@@ -140,7 +135,7 @@ class phpbb_ui_test_case extends phpbb_test_case
}
}
- protected function tearDown()
+ protected function tearDown(): void
{
parent::tearDown();
@@ -344,9 +339,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
@@ -371,6 +366,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)
@@ -402,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(