mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
[ticket/11700] Move all recent code to namespaces
PHPBB3-11700
This commit is contained in:
@@ -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);
|
||||
|
@@ -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
|
||||
@@ -551,7 +551,7 @@ class phpbb_database_test_connection_manager
|
||||
}
|
||||
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) . ")
|
||||
|
@@ -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,11 +199,11 @@ 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\filesystem(),
|
||||
self::$config['table_prefix'] . 'ext',
|
||||
dirname(__FILE__) . '/',
|
||||
$php_ext,
|
||||
@@ -471,7 +471,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;
|
||||
|
||||
@@ -484,7 +484,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())
|
||||
@@ -521,18 +521,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())
|
||||
@@ -563,18 +563,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())
|
||||
|
@@ -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' => '',
|
||||
|
Reference in New Issue
Block a user