mirror of
https://github.com/phpbb/phpbb.git
synced 2025-01-19 07:08:09 +01:00
[ticket/11700] Fix dbal tests after config namespace mishap
PHPBB3-11700
This commit is contained in:
parent
1a6202d517
commit
97012dd851
@ -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\config';
|
||||
FROM phpbb_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\config';
|
||||
FROM phpbb_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\config';
|
||||
FROM phpbb_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\config';
|
||||
FROM phpbb_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\config
|
||||
FROM phpbb_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\config
|
||||
FROM phpbb_config
|
||||
WHERE config_value = 'bar'";
|
||||
$result = $db->sql_query_limit($sql, 1);
|
||||
|
||||
|
@ -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\config';
|
||||
FROM phpbb_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\config';
|
||||
FROM phpbb_config';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$db->sql_return_on_error(false);
|
||||
|
@ -18,7 +18,7 @@ class phpbb_dbal_migration_dummy extends \phpbb\db\migration\migration
|
||||
{
|
||||
return array(
|
||||
'add_columns' => array(
|
||||
'\phpbb\config\config' => array(
|
||||
'phpbb_config' => array(
|
||||
'extra_column' => array('UINT', 1),
|
||||
),
|
||||
),
|
||||
|
@ -13,7 +13,7 @@ class phpbb_dbal_migration_revert extends \phpbb\db\migration\migration
|
||||
{
|
||||
return array(
|
||||
'add_columns' => array(
|
||||
'\phpbb\config\config' => array(
|
||||
'phpbb_config' => array(
|
||||
'bar_column' => array('UINT', 1),
|
||||
),
|
||||
),
|
||||
@ -24,7 +24,7 @@ class phpbb_dbal_migration_revert extends \phpbb\db\migration\migration
|
||||
{
|
||||
return array(
|
||||
'drop_columns' => array(
|
||||
'\phpbb\config\config' => array(
|
||||
'phpbb_config' => array(
|
||||
'bar_column',
|
||||
),
|
||||
),
|
||||
|
@ -35,7 +35,7 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case
|
||||
$this->db = $this->new_dbal();
|
||||
$this->db_tools = new \phpbb\db\tools($this->db);
|
||||
|
||||
$this->config = new \phpbb\config\db($this->db, new phpbb_mock_cache, '\phpbb\config\config');
|
||||
$this->config = new \phpbb\config\db($this->db, new phpbb_mock_cache, 'phpbb_config');
|
||||
|
||||
$tools = array(
|
||||
new \phpbb\db\migration\tool\config($this->config),
|
||||
@ -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\config WHERE config_name = 'foo'",
|
||||
"SELECT extra_column FROM phpbb_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\config', 'extra_column');
|
||||
$this->db_tools->sql_column_remove('phpbb_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\config WHERE config_name = 'foo'",
|
||||
"SELECT extra_column FROM phpbb_config WHERE config_name = 'foo'",
|
||||
'Dummy migration was run, even though an unfulfillable migration was found.'
|
||||
);
|
||||
|
||||
$this->db_tools->sql_column_remove('\phpbb\config\config', 'extra_column');
|
||||
$this->db_tools->sql_column_remove('phpbb_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\config WHERE config_name = 'foo'",
|
||||
"SELECT bar_column FROM phpbb_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\config';
|
||||
$sql = 'SELECT * FROM phpbb_config';
|
||||
$result = $this->db->sql_query_limit($sql, 1);
|
||||
$row = $this->db->sql_fetchrow($result);
|
||||
$this->db->sql_freeresult($result);
|
||||
@ -237,7 +237,7 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case
|
||||
// Failure should have caused an automatic roll-back, so this should not exist.
|
||||
$this->assertFalse(isset($this->config['foobar3']));
|
||||
|
||||
$sql = 'SELECT * FROM \phpbb\config\config';
|
||||
$sql = 'SELECT * FROM phpbb_config';
|
||||
$result = $this->db->sql_query_limit($sql, 1);
|
||||
$row = $this->db->sql_fetchrow($result);
|
||||
$this->db->sql_freeresult($result);
|
||||
|
@ -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\config
|
||||
$sql = "INSERT INTO phpbb_config
|
||||
(config_name, config_value)
|
||||
VALUES ('name', '$value')";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$sql = "SELECT config_value
|
||||
FROM \phpbb\config\config
|
||||
FROM phpbb_config
|
||||
WHERE config_name = 'name'";
|
||||
$result = $db->sql_query_limit($sql, 1);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
|
@ -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\config', 2);
|
||||
$this->buffer = new \phpbb\db\sql_insert_buffer($this->db, 'phpbb_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\config';
|
||||
FROM phpbb_config';
|
||||
$result = $this->db->sql_query($sql);
|
||||
$this->assertEquals($num_configs, $this->db->sql_fetchfield('num_configs'));
|
||||
$this->db->sql_freeresult($result);
|
||||
|
@ -39,11 +39,11 @@ class phpbb_dbal_write_test extends phpbb_database_test_case
|
||||
{
|
||||
$db = $this->new_dbal();
|
||||
|
||||
$sql = 'INSERT INTO \phpbb\config\config ' . $db->sql_build_array('INSERT', $sql_ary);
|
||||
$sql = 'INSERT INTO phpbb_config ' . $db->sql_build_array('INSERT', $sql_ary);
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$sql = "SELECT *
|
||||
FROM \phpbb\config\config
|
||||
FROM phpbb_config
|
||||
WHERE config_name = '" . $sql_ary['config_name'] . "'";
|
||||
$result = $db->sql_query_limit($sql, 1);
|
||||
|
||||
@ -56,15 +56,15 @@ class phpbb_dbal_write_test extends phpbb_database_test_case
|
||||
{
|
||||
$db = $this->new_dbal();
|
||||
|
||||
$sql = "DELETE FROM \phpbb\config\config
|
||||
$sql = "DELETE FROM phpbb_config
|
||||
WHERE config_name = 'config1'";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$sql = 'SELECT *
|
||||
FROM \phpbb\config\config';
|
||||
FROM phpbb_config';
|
||||
$result = $db->sql_query($sql);
|
||||
$rows = $db->sql_fetchrowset($result);
|
||||
|
||||
|
||||
$this->assertEquals(1, sizeof($rows));
|
||||
$this->assertEquals('config2', $rows[0]['config_name']);
|
||||
|
||||
@ -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\config';
|
||||
$sql = 'DELETE FROM phpbb_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\config', $batch_ary);
|
||||
$result = $db->sql_multi_insert('phpbb_config', $batch_ary);
|
||||
|
||||
$sql = 'SELECT *
|
||||
FROM \phpbb\config\config
|
||||
FROM phpbb_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\config
|
||||
$sql = 'UPDATE phpbb_config
|
||||
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . $where;
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$sql = 'SELECT *
|
||||
FROM \phpbb\config\config
|
||||
FROM phpbb_config
|
||||
ORDER BY config_name ASC';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user