aboutsummaryrefslogtreecommitdiffstats
path: root/tests/dbal
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2013-09-10 14:01:09 +0200
committerNils Adermann <naderman@naderman.de>2013-09-16 00:25:27 +0200
commitb95fdacdd378877d277e261465da73deb06e50da (patch)
tree01d55340b37f412cecd2d898c302e101b8a0ed19 /tests/dbal
parent196e1813cd37c47965eb6f254ce6a55210a1b751 (diff)
downloadforums-b95fdacdd378877d277e261465da73deb06e50da.tar
forums-b95fdacdd378877d277e261465da73deb06e50da.tar.gz
forums-b95fdacdd378877d277e261465da73deb06e50da.tar.bz2
forums-b95fdacdd378877d277e261465da73deb06e50da.tar.xz
forums-b95fdacdd378877d277e261465da73deb06e50da.zip
[ticket/11700] Move all recent code to namespaces
PHPBB3-11700
Diffstat (limited to 'tests/dbal')
-rw-r--r--tests/dbal/auto_increment_test.php2
-rw-r--r--tests/dbal/case_test.php12
-rw-r--r--tests/dbal/concatenate_test.php4
-rw-r--r--tests/dbal/db_tools_test.php6
-rw-r--r--tests/dbal/migration/dummy.php4
-rw-r--r--tests/dbal/migration/fail.php2
-rw-r--r--tests/dbal/migration/if.php2
-rw-r--r--tests/dbal/migration/installed.php2
-rw-r--r--tests/dbal/migration/recall.php2
-rw-r--r--tests/dbal/migration/revert.php6
-rw-r--r--tests/dbal/migration/revert_with_dependency.php2
-rw-r--r--tests/dbal/migration/unfulfillable.php2
-rw-r--r--tests/dbal/migrator_test.php28
-rw-r--r--tests/dbal/migrator_tool_config_test.php4
-rw-r--r--tests/dbal/migrator_tool_module_test.php10
-rw-r--r--tests/dbal/migrator_tool_permission_test.php6
-rw-r--r--tests/dbal/schema_test.php4
-rw-r--r--tests/dbal/sql_insert_buffer_test.php4
-rw-r--r--tests/dbal/write_test.php18
19 files changed, 60 insertions, 60 deletions
diff --git a/tests/dbal/auto_increment_test.php b/tests/dbal/auto_increment_test.php
index 077bfad933..2196292e83 100644
--- a/tests/dbal/auto_increment_test.php
+++ b/tests/dbal/auto_increment_test.php
@@ -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(
diff --git a/tests/dbal/case_test.php b/tests/dbal/case_test.php
index 57a1729a39..edab3525a1 100644
--- a/tests/dbal/case_test.php
+++ b/tests/dbal/case_test.php
@@ -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);
diff --git a/tests/dbal/concatenate_test.php b/tests/dbal/concatenate_test.php
index 0891fa58a0..818bde7d23 100644
--- a/tests/dbal/concatenate_test.php
+++ b/tests/dbal/concatenate_test.php
@@ -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);
diff --git a/tests/dbal/db_tools_test.php b/tests/dbal/db_tools_test.php
index 7bdbc696e7..e25335165a 100644
--- a/tests/dbal/db_tools_test.php
+++ b/tests/dbal/db_tools_test.php
@@ -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));
diff --git a/tests/dbal/migration/dummy.php b/tests/dbal/migration/dummy.php
index 0ac6e733a1..3f48f22252 100644
--- a/tests/dbal/migration/dummy.php
+++ b/tests/dbal/migration/dummy.php
@@ -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),
),
),
diff --git a/tests/dbal/migration/fail.php b/tests/dbal/migration/fail.php
index f88d8169f5..d90972720d 100644
--- a/tests/dbal/migration/fail.php
+++ b/tests/dbal/migration/fail.php
@@ -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()
{
diff --git a/tests/dbal/migration/if.php b/tests/dbal/migration/if.php
index 83fe21bd21..bbbda60ea3 100644
--- a/tests/dbal/migration/if.php
+++ b/tests/dbal/migration/if.php
@@ -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()
{
diff --git a/tests/dbal/migration/installed.php b/tests/dbal/migration/installed.php
index 01829f7a99..4b86896d9c 100644
--- a/tests/dbal/migration/installed.php
+++ b/tests/dbal/migration/installed.php
@@ -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()
{
diff --git a/tests/dbal/migration/recall.php b/tests/dbal/migration/recall.php
index 6c2f04bf08..041d12ad27 100644
--- a/tests/dbal/migration/recall.php
+++ b/tests/dbal/migration/recall.php
@@ -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()
{
diff --git a/tests/dbal/migration/revert.php b/tests/dbal/migration/revert.php
index ac01987cd4..c46dfca30d 100644
--- a/tests/dbal/migration/revert.php
+++ b/tests/dbal/migration/revert.php
@@ -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',
),
),
diff --git a/tests/dbal/migration/revert_with_dependency.php b/tests/dbal/migration/revert_with_dependency.php
index ca2c070e8c..0b09fb784d 100644
--- a/tests/dbal/migration/revert_with_dependency.php
+++ b/tests/dbal/migration/revert_with_dependency.php
@@ -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()
{
diff --git a/tests/dbal/migration/unfulfillable.php b/tests/dbal/migration/unfulfillable.php
index 6d375e6880..a1cdef9a23 100644
--- a/tests/dbal/migration/unfulfillable.php
+++ b/tests/dbal/migration/unfulfillable.php
@@ -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()
{
diff --git a/tests/dbal/migrator_test.php b/tests/dbal/migrator_test.php
index 9e55e4dd35..d336854a1c 100644
--- a/tests/dbal/migrator_test.php
+++ b/tests/dbal/migrator_test.php
@@ -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);
diff --git a/tests/dbal/migrator_tool_config_test.php b/tests/dbal/migrator_tool_config_test.php
index b82d1ef48d..a8d8966839 100644
--- a/tests/dbal/migrator_tool_config_test.php
+++ b/tests/dbal/migrator_tool_config_test.php
@@ -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();
}
diff --git a/tests/dbal/migrator_tool_module_test.php b/tests/dbal/migrator_tool_module_test.php
index 828fb76c65..3c23891348 100644
--- a/tests/dbal/migrator_tool_module_test.php
+++ b/tests/dbal/migrator_tool_module_test.php
@@ -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()
diff --git a/tests/dbal/migrator_tool_permission_test.php b/tests/dbal/migrator_tool_permission_test.php
index 79d9db66da..1090b4726a 100644
--- a/tests/dbal/migrator_tool_permission_test.php
+++ b/tests/dbal/migrator_tool_permission_test.php
@@ -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()
diff --git a/tests/dbal/schema_test.php b/tests/dbal/schema_test.php
index 2a332fddba..a09daa0f76 100644
--- a/tests/dbal/schema_test.php
+++ b/tests/dbal/schema_test.php
@@ -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);
diff --git a/tests/dbal/sql_insert_buffer_test.php b/tests/dbal/sql_insert_buffer_test.php
index 45339a6b50..976495d195 100644
--- a/tests/dbal/sql_insert_buffer_test.php
+++ b/tests/dbal/sql_insert_buffer_test.php
@@ -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);
diff --git a/tests/dbal/write_test.php b/tests/dbal/write_test.php
index 987161a831..c0f0c271d2 100644
--- a/tests/dbal/write_test.php
+++ b/tests/dbal/write_test.php
@@ -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);