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.php2
-rw-r--r--tests/test_framework/phpbb_database_test_connection_manager.php74
-rw-r--r--tests/test_framework/phpbb_functional_test_case.php42
-rw-r--r--tests/test_framework/phpbb_search_test_case.php2
-rw-r--r--tests/test_framework/phpbb_test_case_helpers.php2
5 files changed, 61 insertions, 61 deletions
diff --git a/tests/test_framework/phpbb_database_test_case.php b/tests/test_framework/phpbb_database_test_case.php
index c72ea5f765..4c2e9ff600 100644
--- a/tests/test_framework/phpbb_database_test_case.php
+++ b/tests/test_framework/phpbb_database_test_case.php
@@ -82,7 +82,7 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test
$db_config = $this->get_database_config();
// Firebird requires table and column names to be uppercase
- if ($db_config['dbms'] == 'phpbb_db_driver_firebird')
+ if ($db_config['dbms'] == 'phpbb\db\driver\firebird')
{
$xml_data = file_get_contents($path);
$xml_data = preg_replace_callback('/(?:(<table name="))([a-z_]+)(?:(">))/', 'phpbb_database_test_case::to_upper', $xml_data);
diff --git a/tests/test_framework/phpbb_database_test_connection_manager.php b/tests/test_framework/phpbb_database_test_connection_manager.php
index 9d2cfebd29..af9bd22662 100644
--- a/tests/test_framework/phpbb_database_test_connection_manager.php
+++ b/tests/test_framework/phpbb_database_test_connection_manager.php
@@ -108,7 +108,7 @@ class phpbb_database_test_connection_manager
// These require different connection strings on the phpBB side than they do in PDO
// so you must provide a DSN string for ODBC separately
- if (!empty($this->config['custom_dsn']) && ($this->config['dbms'] == 'phpbb_db_driver_mssql' || $this->config['dbms'] == 'phpbb_db_driver_firebird'))
+ if (!empty($this->config['custom_dsn']) && ($this->config['dbms'] == 'phpbb\db\driver\mssql' || $this->config['dbms'] == 'phpbb\db\driver\firebird'))
{
$dsn = 'odbc:' . $this->config['custom_dsn'];
}
@@ -117,12 +117,12 @@ class phpbb_database_test_connection_manager
{
switch ($this->config['dbms'])
{
- case 'phpbb_db_driver_mssql':
- case 'phpbb_db_driver_mssql_odbc':
+ case 'phpbb\db\driver\mssql':
+ case 'phpbb\db\driver\mssql_odbc':
$this->pdo = new phpbb_database_connection_odbc_pdo_wrapper('mssql', 0, $dsn, $this->config['dbuser'], $this->config['dbpasswd']);
break;
- case 'phpbb_db_driver_firebird':
+ case 'phpbb\db\driver\firebird':
if (!empty($this->config['custom_dsn']))
{
$this->pdo = new phpbb_database_connection_odbc_pdo_wrapper('firebird', 0, $dsn, $this->config['dbuser'], $this->config['dbpasswd']);
@@ -145,8 +145,8 @@ class phpbb_database_test_connection_manager
switch ($this->config['dbms'])
{
- case 'phpbb_db_driver_mysql':
- case 'phpbb_db_driver_mysqli':
+ case 'phpbb\db\driver\mysql':
+ case 'phpbb\db\driver\mysqli':
$this->pdo->exec('SET NAMES utf8');
/*
@@ -187,8 +187,8 @@ class phpbb_database_test_connection_manager
{
switch ($this->config['dbms'])
{
- case 'phpbb_db_driver_sqlite':
- case 'phpbb_db_driver_firebird':
+ case 'phpbb\db\driver\sqlite':
+ case 'phpbb\db\driver\firebird':
$this->connect();
// Drop all of the tables
foreach ($this->get_tables() as $table)
@@ -198,7 +198,7 @@ class phpbb_database_test_connection_manager
$this->purge_extras();
break;
- case 'phpbb_db_driver_oracle':
+ case 'phpbb\db\driver\oracle':
$this->connect();
// Drop all of the tables
foreach ($this->get_tables() as $table)
@@ -208,7 +208,7 @@ class phpbb_database_test_connection_manager
$this->purge_extras();
break;
- case 'phpbb_db_driver_postgres':
+ case 'phpbb\db\driver\postgres':
$this->connect();
// Drop all of the tables
foreach ($this->get_tables() as $table)
@@ -258,38 +258,38 @@ class phpbb_database_test_connection_manager
switch ($this->config['dbms'])
{
- case 'phpbb_db_driver_mysql':
- case 'phpbb_db_driver_mysqli':
+ case 'phpbb\db\driver\mysql':
+ case 'phpbb\db\driver\mysqli':
$sql = 'SHOW TABLES';
break;
- case 'phpbb_db_driver_sqlite':
+ case 'phpbb\db\driver\sqlite':
$sql = 'SELECT name
FROM sqlite_master
WHERE type = "table"';
break;
- case 'phpbb_db_driver_mssql':
- case 'phpbb_db_driver_mssql_odbc':
- case 'phpbb_db_driver_mssqlnative':
+ case 'phpbb\db\driver\mssql':
+ case 'phpbb\db\driver\mssql_odbc':
+ case 'phpbb\db\driver\mssqlnative':
$sql = "SELECT name
FROM sysobjects
WHERE type='U'";
break;
- case 'phpbb_db_driver_postgres':
+ case 'phpbb\db\driver\postgres':
$sql = 'SELECT relname
FROM pg_stat_user_tables';
break;
- case 'phpbb_db_driver_firebird':
+ case 'phpbb\db\driver\firebird':
$sql = 'SELECT rdb$relation_name
FROM rdb$relations
WHERE rdb$view_source is null
AND rdb$system_flag = 0';
break;
- case 'phpbb_db_driver_oracle':
+ case 'phpbb\db\driver\oracle':
$sql = 'SELECT table_name
FROM USER_TABLES';
break;
@@ -325,7 +325,7 @@ class phpbb_database_test_connection_manager
{
$schema = $this->dbms['SCHEMA'];
- if ($this->config['dbms'] == 'phpbb_db_driver_mysql')
+ if ($this->config['dbms'] == 'phpbb\db\driver\mysql')
{
$sth = $this->pdo->query('SELECT VERSION() AS version');
$row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -359,47 +359,47 @@ class phpbb_database_test_connection_manager
protected function get_dbms_data($dbms)
{
$available_dbms = array(
- 'phpbb_db_driver_firebird' => array(
+ 'phpbb\db\driver\firebird' => array(
'SCHEMA' => 'firebird',
'DELIM' => ';;',
'PDO' => 'firebird',
),
- 'phpbb_db_driver_mysqli' => array(
+ 'phpbb\db\driver\mysqli' => array(
'SCHEMA' => 'mysql_41',
'DELIM' => ';',
'PDO' => 'mysql',
),
- 'phpbb_db_driver_mysql' => array(
+ 'phpbb\db\driver\mysql' => array(
'SCHEMA' => 'mysql',
'DELIM' => ';',
'PDO' => 'mysql',
),
- 'phpbb_db_driver_mssql' => array(
+ 'phpbb\db\driver\mssql' => array(
'SCHEMA' => 'mssql',
'DELIM' => 'GO',
'PDO' => 'odbc',
),
- 'phpbb_db_driver_mssql_odbc'=> array(
+ 'phpbb\db\driver\mssql_odbc'=> array(
'SCHEMA' => 'mssql',
'DELIM' => 'GO',
'PDO' => 'odbc',
),
- 'phpbb_db_driver_mssqlnative' => array(
+ 'phpbb\db\driver\mssqlnative' => array(
'SCHEMA' => 'mssql',
'DELIM' => 'GO',
'PDO' => 'sqlsrv',
),
- 'phpbb_db_driver_oracle' => array(
+ 'phpbb\db\driver\oracle' => array(
'SCHEMA' => 'oracle',
'DELIM' => '/',
'PDO' => 'oci',
),
- 'phpbb_db_driver_postgres' => array(
+ 'phpbb\db\driver\postgres' => array(
'SCHEMA' => 'postgres',
'DELIM' => ';',
'PDO' => 'pgsql',
),
- 'phpbb_db_driver_sqlite' => array(
+ 'phpbb\db\driver\sqlite' => array(
'SCHEMA' => 'sqlite',
'DELIM' => ';',
'PDO' => 'sqlite2',
@@ -428,7 +428,7 @@ class phpbb_database_test_connection_manager
switch ($this->config['dbms'])
{
- case 'phpbb_db_driver_firebird':
+ case 'phpbb\db\driver\firebird':
$sql = 'SELECT RDB$GENERATOR_NAME
FROM RDB$GENERATORS
WHERE RDB$SYSTEM_FLAG = 0';
@@ -440,7 +440,7 @@ class phpbb_database_test_connection_manager
}
break;
- case 'phpbb_db_driver_oracle':
+ case 'phpbb\db\driver\oracle':
$sql = 'SELECT sequence_name
FROM USER_SEQUENCES';
$result = $this->pdo->query($sql);
@@ -451,7 +451,7 @@ class phpbb_database_test_connection_manager
}
break;
- case 'phpbb_db_driver_postgres':
+ case 'phpbb\db\driver\postgres':
$sql = 'SELECT sequence_name
FROM information_schema.sequences';
$result = $this->pdo->query($sql);
@@ -509,7 +509,7 @@ class phpbb_database_test_connection_manager
switch ($this->config['dbms'])
{
- case 'phpbb_db_driver_oracle':
+ case 'phpbb\db\driver\oracle':
// Get all of the information about the sequences
$sql = "SELECT t.table_name, tc.column_name, d.referenced_name as sequence_name, s.increment_by, s.min_value
FROM USER_TRIGGERS t
@@ -544,14 +544,14 @@ class phpbb_database_test_connection_manager
* Since we have no objects attached to our sequencers (triggers aren't attached), this works fine.
*/
$queries[] = 'DROP SEQUENCE ' . $row['SEQUENCE_NAME'];
- $queries[] = "CREATE SEQUENCE {$row['SEQUENCE_NAME']}
- MINVALUE {$row['MIN_VALUE']}
- INCREMENT BY {$row['INCREMENT_BY']}
+ $queries[] = "CREATE SEQUENCE {$row['SEQUENCE_NAME']}
+ MINVALUE {$row['MIN_VALUE']}
+ INCREMENT BY {$row['INCREMENT_BY']}
START WITH $max_val";
}
break;
- case 'phpbb_db_driver_postgres':
+ case 'phpbb\db\driver\postgres':
// Get the sequences attached to the tables
$sql = 'SELECT column_name, table_name FROM information_schema.columns
WHERE table_name IN (' . implode(', ', $table_names) . ")
diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php
index 41c47faedf..f8ec125481 100644
--- a/tests/test_framework/phpbb_functional_test_case.php
+++ b/tests/test_framework/phpbb_functional_test_case.php
@@ -150,7 +150,7 @@ class phpbb_functional_test_case extends phpbb_test_case
{
global $phpbb_root_path, $phpEx;
// so we don't reopen an open connection
- if (!($this->db instanceof phpbb_db_driver))
+ if (!($this->db instanceof \phpbb\db\driver\driver))
{
$dbms = self::$config['dbms'];
$this->db = new $dbms();
@@ -163,7 +163,7 @@ class phpbb_functional_test_case extends phpbb_test_case
{
if (!$this->cache)
{
- $this->cache = new phpbb_cache_driver_file;
+ $this->cache = new \phpbb\cache\driver\file;
}
return $this->cache;
@@ -182,11 +182,11 @@ class phpbb_functional_test_case extends phpbb_test_case
{
global $phpbb_root_path, $phpEx;
- $config = new phpbb_config(array());
+ $config = new \phpbb\config\config(array());
$db = $this->get_db();
- $db_tools = new phpbb_db_tools($db);
+ $db_tools = new \phpbb\db\tools($db);
- $migrator = new phpbb_db_migrator(
+ $migrator = new \phpbb\db\migrator(
$config,
$db,
$db_tools,
@@ -199,12 +199,12 @@ class phpbb_functional_test_case extends phpbb_test_case
$container = new phpbb_mock_container_builder();
$container->set('migrator', $migrator);
- $extension_manager = new phpbb_extension_manager(
+ $extension_manager = new \phpbb\extension\manager(
$container,
$db,
$config,
- new phpbb_filesystem(
- new phpbb_symfony_request(
+ new phpbb\filesystem(
+ new phpbb\symfony\request(
new phpbb_mock_request()
),
$phpbb_root_path,
@@ -271,7 +271,7 @@ class phpbb_functional_test_case extends phpbb_test_case
self::assertContains('Database configuration', $crawler->filter('#main')->text());
$form = $crawler->selectButton('submit')->form(array(
// Installer uses 3.0-style dbms name
- 'dbms' => str_replace('phpbb_db_driver_', '', self::$config['dbms']),
+ 'dbms' => str_replace('phpbb\db\driver\\', '', self::$config['dbms']),
'dbhost' => self::$config['dbhost'],
'dbport' => self::$config['dbport'],
'dbname' => self::$config['dbname'],
@@ -477,7 +477,7 @@ class phpbb_functional_test_case extends phpbb_test_case
// Required by unique_id
global $config;
- $config = new phpbb_config(array());
+ $config = new \phpbb\config\config(array());
$config['rand_seed'] = '';
$config['rand_seed_last_update'] = time() + 600;
@@ -490,7 +490,7 @@ class phpbb_functional_test_case extends phpbb_test_case
}
$cache = new phpbb_mock_null_cache;
- $cache_driver = new phpbb_cache_driver_null();
+ $cache_driver = new \phpbb\cache\driver\null();
$phpbb_container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
$phpbb_container
->expects($this->any())
@@ -527,18 +527,18 @@ class phpbb_functional_test_case extends phpbb_test_case
{
global $db, $cache, $auth, $config, $phpbb_dispatcher, $phpbb_log, $phpbb_container, $phpbb_root_path, $phpEx;
- $config = new phpbb_config(array());
+ $config = new \phpbb\config\config(array());
$config['coppa_enable'] = 0;
$db = $this->get_db();
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
- $user = $this->getMock('phpbb_user');
- $auth = $this->getMock('phpbb_auth');
+ $user = $this->getMock('\phpbb\user');
+ $auth = $this->getMock('\phpbb\auth\auth');
- $phpbb_log = new phpbb_log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE);
+ $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_null();
+ $cache_driver = new \phpbb\cache\driver\null();
$phpbb_container = new phpbb_mock_container_builder();
$phpbb_container->set('cache.driver', $cache_driver);
$phpbb_container->set('notification_manager', new phpbb_mock_notification_manager());
@@ -566,18 +566,18 @@ class phpbb_functional_test_case extends phpbb_test_case
{
global $db, $cache, $auth, $config, $phpbb_dispatcher, $phpbb_log, $phpbb_container, $phpbb_root_path, $phpEx;
- $config = new phpbb_config(array());
+ $config = new \phpbb\config\config(array());
$config['coppa_enable'] = 0;
$db = $this->get_db();
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
- $user = $this->getMock('phpbb_user');
- $auth = $this->getMock('phpbb_auth');
+ $user = $this->getMock('\phpbb\user');
+ $auth = $this->getMock('\phpbb\auth\auth');
- $phpbb_log = new phpbb_log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE);
+ $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_null();
+ $cache_driver = new \phpbb\cache\driver\null();
$phpbb_container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
$phpbb_container
->expects($this->any())
diff --git a/tests/test_framework/phpbb_search_test_case.php b/tests/test_framework/phpbb_search_test_case.php
index 418d352c17..b929e740ea 100644
--- a/tests/test_framework/phpbb_search_test_case.php
+++ b/tests/test_framework/phpbb_search_test_case.php
@@ -11,7 +11,7 @@ abstract class phpbb_search_test_case extends phpbb_database_test_case
{
static protected function get_search_wrapper($class)
{
- $wrapped = $class . '_wrapper';
+ $wrapped = str_replace('\\', '_', $class) . '_wrapper';
if (!class_exists($wrapped))
{
$code = "
diff --git a/tests/test_framework/phpbb_test_case_helpers.php b/tests/test_framework/phpbb_test_case_helpers.php
index 3d9cd10f32..351a3a9594 100644
--- a/tests/test_framework/phpbb_test_case_helpers.php
+++ b/tests/test_framework/phpbb_test_case_helpers.php
@@ -107,7 +107,7 @@ class phpbb_test_case_helpers
if (extension_loaded('sqlite') && version_compare(PHPUnit_Runner_Version::id(), '3.4.15', '>='))
{
$config = array_merge($config, array(
- 'dbms' => 'phpbb_db_driver_sqlite',
+ 'dbms' => 'phpbb\db\driver\sqlite',
'dbhost' => dirname(__FILE__) . '/../phpbb_unit_tests.sqlite2', // filename
'dbport' => '',
'dbname' => '',