1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-22 16:22:58 +02:00

[ticket/11700] Move all recent code to namespaces

PHPBB3-11700
This commit is contained in:
Nils Adermann
2013-09-10 14:01:09 +02:00
parent 196e1813cd
commit b95fdacdd3
420 changed files with 2316 additions and 1840 deletions

View File

@@ -26,7 +26,7 @@ class phpbb_dbal_auto_increment_test extends phpbb_database_test_case
parent::setUp();
$this->db = $this->new_dbal();
$this->tools = new phpbb_db_tools($this->db);
$this->tools = new \phpbb\db\tools($this->db);
$this->table_data = array(
'COLUMNS' => array(

View File

@@ -19,13 +19,13 @@ class phpbb_dbal_case_test extends phpbb_database_test_case
$db = $this->new_dbal();
$sql = 'SELECT ' . $db->sql_case('1 = 1', '1', '2') . ' AS test_num
FROM phpbb_config';
FROM \phpbb\config\config';
$result = $db->sql_query_limit($sql, 1);
$this->assertEquals(1, (int) $db->sql_fetchfield('test_num'));
$sql = 'SELECT ' . $db->sql_case('1 = 0', '1', '2') . ' AS test_num
FROM phpbb_config';
FROM \phpbb\config\config';
$result = $db->sql_query_limit($sql, 1);
$this->assertEquals(2, (int) $db->sql_fetchfield('test_num'));
@@ -36,13 +36,13 @@ class phpbb_dbal_case_test extends phpbb_database_test_case
$db = $this->new_dbal();
$sql = 'SELECT ' . $db->sql_case('1 = 1', "'foo'", "'bar'") . ' AS test_string
FROM phpbb_config';
FROM \phpbb\config\config';
$result = $db->sql_query_limit($sql, 1);
$this->assertEquals('foo', $db->sql_fetchfield('test_string'));
$sql = 'SELECT ' . $db->sql_case('1 = 0', "'foo'", "'bar'") . ' AS test_string
FROM phpbb_config';
FROM \phpbb\config\config';
$result = $db->sql_query_limit($sql, 1);
$this->assertEquals('bar', $db->sql_fetchfield('test_string'));
@@ -53,14 +53,14 @@ class phpbb_dbal_case_test extends phpbb_database_test_case
$db = $this->new_dbal();
$sql = 'SELECT ' . $db->sql_case("config_name = 'config1'", 'config_name', 'config_value') . " AS test_string
FROM phpbb_config
FROM \phpbb\config\config
WHERE config_name = 'config1'";
$result = $db->sql_query_limit($sql, 1);
$this->assertEquals('config1', $db->sql_fetchfield('test_string'));
$sql = 'SELECT ' . $db->sql_case("config_name = 'config1'", 'config_name', 'config_value') . " AS test_string
FROM phpbb_config
FROM \phpbb\config\config
WHERE config_value = 'bar'";
$result = $db->sql_query_limit($sql, 1);

View File

@@ -19,7 +19,7 @@ class phpbb_dbal_concatenate_test extends phpbb_database_test_case
$db = $this->new_dbal();
$sql = 'SELECT config_name, ' . $db->sql_concatenate('config_name', "'" . $db->sql_escape('append') . "'") . ' AS string
FROM phpbb_config';
FROM \phpbb\config\config';
$result = $db->sql_query($sql);
$db->sql_return_on_error(false);
@@ -43,7 +43,7 @@ class phpbb_dbal_concatenate_test extends phpbb_database_test_case
$db = $this->new_dbal();
$sql = 'SELECT config_name, ' . $db->sql_concatenate('config_name', 'config_value') . ' AS string
FROM phpbb_config';
FROM \phpbb\config\config';
$result = $db->sql_query($sql);
$db->sql_return_on_error(false);

View File

@@ -26,7 +26,7 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case
parent::setUp();
$this->db = $this->new_dbal();
$this->tools = new phpbb_db_tools($this->db);
$this->tools = new \phpbb\db\tools($this->db);
$this->table_data = array(
'COLUMNS' => array(
@@ -254,7 +254,7 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case
public function test_peform_schema_changes_drop_tables()
{
$db_tools = $this->getMock('phpbb_db_tools', array(
$db_tools = $this->getMock('\phpbb\db\tools', array(
'sql_table_exists',
'sql_table_drop',
), array(&$this->db));
@@ -280,7 +280,7 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case
public function test_peform_schema_changes_drop_columns()
{
$db_tools = $this->getMock('phpbb_db_tools', array(
$db_tools = $this->getMock('\phpbb\db\tools', array(
'sql_column_exists',
'sql_column_remove',
), array(&$this->db));

View File

@@ -7,7 +7,7 @@
*
*/
class phpbb_dbal_migration_dummy extends phpbb_db_migration
class phpbb_dbal_migration_dummy extends \phpbb\db\migration\migration
{
static public function depends_on()
{
@@ -18,7 +18,7 @@ class phpbb_dbal_migration_dummy extends phpbb_db_migration
{
return array(
'add_columns' => array(
'phpbb_config' => array(
'\phpbb\config\config' => array(
'extra_column' => array('UINT', 1),
),
),

View File

@@ -7,7 +7,7 @@
*
*/
class phpbb_dbal_migration_fail extends phpbb_db_migration
class phpbb_dbal_migration_fail extends \phpbb\db\migration\migration
{
function update_schema()
{

View File

@@ -7,7 +7,7 @@
*
*/
class phpbb_dbal_migration_if extends phpbb_db_migration
class phpbb_dbal_migration_if extends \phpbb\db\migration\migration
{
function update_schema()
{

View File

@@ -7,7 +7,7 @@
*
*/
class phpbb_dbal_migration_installed extends phpbb_db_migration
class phpbb_dbal_migration_installed extends \phpbb\db\migration\migration
{
function effectively_installed()
{

View File

@@ -7,7 +7,7 @@
*
*/
class phpbb_dbal_migration_recall extends phpbb_db_migration
class phpbb_dbal_migration_recall extends \phpbb\db\migration\migration
{
function update_schema()
{

View File

@@ -7,13 +7,13 @@
*
*/
class phpbb_dbal_migration_revert extends phpbb_db_migration
class phpbb_dbal_migration_revert extends \phpbb\db\migration\migration
{
function update_schema()
{
return array(
'add_columns' => array(
'phpbb_config' => array(
'\phpbb\config\config' => array(
'bar_column' => array('UINT', 1),
),
),
@@ -24,7 +24,7 @@ class phpbb_dbal_migration_revert extends phpbb_db_migration
{
return array(
'drop_columns' => array(
'phpbb_config' => array(
'\phpbb\config\config' => array(
'bar_column',
),
),

View File

@@ -7,7 +7,7 @@
*
*/
class phpbb_dbal_migration_revert_with_dependency extends phpbb_db_migration
class phpbb_dbal_migration_revert_with_dependency extends \phpbb\db\migration\migration
{
static public function depends_on()
{

View File

@@ -7,7 +7,7 @@
*
*/
class phpbb_dbal_migration_unfulfillable extends phpbb_db_migration
class phpbb_dbal_migration_unfulfillable extends \phpbb\db\migration\migration
{
static public function depends_on()
{

View File

@@ -33,15 +33,15 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case
parent::setUp();
$this->db = $this->new_dbal();
$this->db_tools = new phpbb_db_tools($this->db);
$this->db_tools = new \phpbb\db\tools($this->db);
$this->config = new phpbb_config_db($this->db, new phpbb_mock_cache, 'phpbb_config');
$this->config = new \phpbb\config\db($this->db, new phpbb_mock_cache, '\phpbb\config\config');
$tools = array(
new phpbb_db_migration_tool_config($this->config),
new \phpbb\db\migration\tool\config($this->config),
);
$this->migrator = new phpbb_db_migrator(
$this->migrator = new \phpbb\db\migrator(
$this->config,
$this->db,
$this->db_tools,
@@ -55,11 +55,11 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case
$container = new phpbb_mock_container_builder();
$container->set('migrator', $migrator);
$this->extension_manager = new phpbb_extension_manager(
$this->extension_manager = new \phpbb\extension\manager(
$container,
$this->db,
$this->config,
new phpbb_filesystem(),
new \phpbb\filesystem(),
'phpbb_ext',
dirname(__FILE__) . '/../../phpBB/',
'php',
@@ -91,7 +91,7 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case
$this->assertSqlResultEquals(
array(array('extra_column' => '1')),
"SELECT extra_column FROM phpbb_config WHERE config_name = 'foo'",
"SELECT extra_column FROM \phpbb\config\config WHERE config_name = 'foo'",
'Dummy migration created extra_column with value 1 in all rows.'
);
@@ -107,7 +107,7 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case
);
// cleanup
$this->db_tools->sql_column_remove('phpbb_config', 'extra_column');
$this->db_tools->sql_column_remove('\phpbb\config\config', 'extra_column');
}
public function test_unfulfillable()
@@ -123,11 +123,11 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case
$this->assertSqlResultEquals(
array(array('extra_column' => '1')),
"SELECT extra_column FROM phpbb_config WHERE config_name = 'foo'",
"SELECT extra_column FROM \phpbb\config\config WHERE config_name = 'foo'",
'Dummy migration was run, even though an unfulfillable migration was found.'
);
$this->db_tools->sql_column_remove('phpbb_config', 'extra_column');
$this->db_tools->sql_column_remove('\phpbb\config\config', 'extra_column');
}
public function test_if()
@@ -192,7 +192,7 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case
$this->assertSqlResultEquals(
array(array('bar_column' => '1')),
"SELECT bar_column FROM phpbb_config WHERE config_name = 'foo'",
"SELECT bar_column FROM \phpbb\config\config WHERE config_name = 'foo'",
'Installing revert migration failed to create bar_column.'
);
@@ -208,7 +208,7 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case
$this->assertFalse(isset($this->config['foobartest']));
$sql = 'SELECT * FROM phpbb_config';
$sql = 'SELECT * FROM \phpbb\config\config';
$result = $this->db->sql_query_limit($sql, 1);
$row = $this->db->sql_fetchrow($result);
$this->db->sql_freeresult($result);
@@ -232,12 +232,12 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case
$this->migrator->update();
}
}
catch (phpbb_db_migration_exception $e) {}
catch (\phpbb\db\migration\exception $e) {}
// Failure should have caused an automatic roll-back, so this should not exist.
$this->assertFalse(isset($this->config['foobar3']));
$sql = 'SELECT * FROM phpbb_config';
$sql = 'SELECT * FROM \phpbb\config\config';
$result = $this->db->sql_query_limit($sql, 1);
$row = $this->db->sql_fetchrow($result);
$this->db->sql_freeresult($result);

View File

@@ -11,9 +11,9 @@ class phpbb_dbal_migrator_tool_config_test extends phpbb_test_case
{
public function setup()
{
$this->config = new phpbb_config(array());
$this->config = new \phpbb\config\config(array());
$this->tool = new phpbb_db_migration_tool_config($this->config);
$this->tool = new \phpbb\db\migration\tool\config($this->config);
parent::setup();
}

View File

@@ -27,15 +27,15 @@ class phpbb_dbal_migrator_tool_module_test extends phpbb_database_test_case
$skip_add_log = true;
$db = $this->db = $this->new_dbal();
$this->cache = new phpbb_cache_service(new phpbb_cache_driver_null(), new phpbb_config(array()), $this->db, $phpbb_root_path, $phpEx);
$user = $this->user = new phpbb_user();
$this->cache = new \phpbb\cache\service(new \phpbb\cache\driver\null(), new \phpbb\config\config(array()), $this->db, $phpbb_root_path, $phpEx);
$user = $this->user = new \phpbb\user();
$cache = new phpbb_mock_cache;
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
$auth = $this->getMock('phpbb_auth');
$phpbb_log = new phpbb_log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE);
$auth = $this->getMock('\phpbb\auth\auth');
$phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE);
$this->tool = new phpbb_db_migration_tool_module($this->db, $this->cache, $this->user, $phpbb_root_path, $phpEx, 'phpbb_modules');
$this->tool = new \phpbb\db\migration\tool\module($this->db, $this->cache, $this->user, $phpbb_root_path, $phpEx, 'phpbb_modules');
}
public function exists_data()

View File

@@ -24,10 +24,10 @@ class phpbb_dbal_migrator_tool_permission_test extends phpbb_database_test_case
parent::setup();
$db = $this->db = $this->new_dbal();
$cache = $this->cache = new phpbb_cache_service(new phpbb_cache_driver_null(), new phpbb_config(array()), $this->db, $phpbb_root_path, $phpEx);
$this->auth = new phpbb_auth();
$cache = $this->cache = new \phpbb\cache\service(new \phpbb\cache\driver\null(), new \phpbb\config\config(array()), $this->db, $phpbb_root_path, $phpEx);
$this->auth = new \phpbb\auth\auth();
$this->tool = new phpbb_db_migration_tool_permission($this->db, $this->cache, $this->auth, $phpbb_root_path, $phpEx);
$this->tool = new \phpbb\db\migration\tool\permission($this->db, $this->cache, $this->auth, $phpbb_root_path, $phpEx);
}
public function exists_data()

View File

@@ -21,13 +21,13 @@ class phpbb_dbal_schema_test extends phpbb_database_test_case
$db = $this->new_dbal();
$value = str_repeat("\xC3\x84", 255);
$sql = "INSERT INTO phpbb_config
$sql = "INSERT INTO \phpbb\config\config
(config_name, config_value)
VALUES ('name', '$value')";
$result = $db->sql_query($sql);
$sql = "SELECT config_value
FROM phpbb_config
FROM \phpbb\config\config
WHERE config_name = 'name'";
$result = $db->sql_query_limit($sql, 1);
$row = $db->sql_fetchrow($result);

View File

@@ -17,7 +17,7 @@ class phpbb_dbal_sql_insert_buffer_test extends phpbb_database_test_case
parent::setUp();
$this->db = $this->new_dbal();
$this->buffer = new phpbb_db_sql_insert_buffer($this->db, 'phpbb_config', 2);
$this->buffer = new \phpbb\db\sql_insert_buffer($this->db, '\phpbb\config\config', 2);
$this->assert_config_count(2);
}
@@ -81,7 +81,7 @@ class phpbb_dbal_sql_insert_buffer_test extends phpbb_database_test_case
protected function assert_config_count($num_configs)
{
$sql = 'SELECT COUNT(*) AS num_configs
FROM phpbb_config';
FROM \phpbb\config\config';
$result = $this->db->sql_query($sql);
$this->assertEquals($num_configs, $this->db->sql_fetchfield('num_configs'));
$this->db->sql_freeresult($result);

View File

@@ -39,11 +39,11 @@ class phpbb_dbal_write_test extends phpbb_database_test_case
{
$db = $this->new_dbal();
$sql = 'INSERT INTO phpbb_config ' . $db->sql_build_array('INSERT', $sql_ary);
$sql = 'INSERT INTO \phpbb\config\config ' . $db->sql_build_array('INSERT', $sql_ary);
$result = $db->sql_query($sql);
$sql = "SELECT *
FROM phpbb_config
FROM \phpbb\config\config
WHERE config_name = '" . $sql_ary['config_name'] . "'";
$result = $db->sql_query_limit($sql, 1);
@@ -56,12 +56,12 @@ class phpbb_dbal_write_test extends phpbb_database_test_case
{
$db = $this->new_dbal();
$sql = "DELETE FROM phpbb_config
$sql = "DELETE FROM \phpbb\config\config
WHERE config_name = 'config1'";
$result = $db->sql_query($sql);
$sql = 'SELECT *
FROM phpbb_config';
FROM \phpbb\config\config';
$result = $db->sql_query($sql);
$rows = $db->sql_fetchrowset($result);
@@ -76,7 +76,7 @@ class phpbb_dbal_write_test extends phpbb_database_test_case
$db = $this->new_dbal();
// empty the table
$sql = 'DELETE FROM phpbb_config';
$sql = 'DELETE FROM \phpbb\config\config';
$db->sql_query($sql);
$batch_ary = array(
@@ -92,10 +92,10 @@ class phpbb_dbal_write_test extends phpbb_database_test_case
),
);
$result = $db->sql_multi_insert('phpbb_config', $batch_ary);
$result = $db->sql_multi_insert('\phpbb\config\config', $batch_ary);
$sql = 'SELECT *
FROM phpbb_config
FROM \phpbb\config\config
ORDER BY config_name ASC';
$result = $db->sql_query($sql);
@@ -155,12 +155,12 @@ class phpbb_dbal_write_test extends phpbb_database_test_case
{
$db = $this->new_dbal();
$sql = 'UPDATE phpbb_config
$sql = 'UPDATE \phpbb\config\config
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . $where;
$result = $db->sql_query($sql);
$sql = 'SELECT *
FROM phpbb_config
FROM \phpbb\config\config
ORDER BY config_name ASC';
$result = $db->sql_query($sql);