mirror of
https://github.com/phpbb/phpbb.git
synced 2025-10-05 20:21:53 +02:00
[ticket/17543] Use class method to call db object instance where possible
PHPBB-17543
This commit is contained in:
@@ -28,9 +28,7 @@ class phpbb_functional_acp_registration_test extends phpbb_functional_test_case
|
|||||||
|
|
||||||
public function test_submitting_activation_method()
|
public function test_submitting_activation_method()
|
||||||
{
|
{
|
||||||
$db = $this->get_db();
|
$this->set_email_enable($this->db, false);
|
||||||
|
|
||||||
$this->set_email_enable($db, false);
|
|
||||||
|
|
||||||
$this->add_lang('acp/board');
|
$this->add_lang('acp/board');
|
||||||
$this->login();
|
$this->login();
|
||||||
@@ -50,6 +48,6 @@ class phpbb_functional_acp_registration_test extends phpbb_functional_test_case
|
|||||||
$crawler = self::submit($form);
|
$crawler = self::submit($form);
|
||||||
$this->assertNotContainsLang('ACC_ACTIVATION_WARNING', $crawler->filter('div.main')->text());
|
$this->assertNotContainsLang('ACC_ACTIVATION_WARNING', $crawler->filter('div.main')->text());
|
||||||
|
|
||||||
$this->set_email_enable($db, true);
|
$this->set_email_enable($this->db, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -40,15 +40,14 @@ class phpbb_functional_auth_test extends phpbb_functional_test_case
|
|||||||
{
|
{
|
||||||
global $cache, $config;
|
global $cache, $config;
|
||||||
$cache = new phpbb_mock_null_cache;
|
$cache = new phpbb_mock_null_cache;
|
||||||
$db = $this->get_db();
|
|
||||||
$sql = 'UPDATE ' . CONFIG_TABLE . " SET config_value = 'foobar' WHERE config_name = 'auth_method'";
|
$sql = 'UPDATE ' . CONFIG_TABLE . " SET config_value = 'foobar' WHERE config_name = 'auth_method'";
|
||||||
$db->sql_query($sql);
|
$this->db->sql_query($sql);
|
||||||
$config['auth_method'] = 'foobar';
|
$config['auth_method'] = 'foobar';
|
||||||
$this->login('anothertestuser');
|
$this->login('anothertestuser');
|
||||||
$crawler = self::request('GET', 'index.php');
|
$crawler = self::request('GET', 'index.php');
|
||||||
$this->assertStringContainsString('anothertestuser', $crawler->filter('#username_logged_in')->text());
|
$this->assertStringContainsString('anothertestuser', $crawler->filter('#username_logged_in')->text());
|
||||||
$sql = 'UPDATE ' . CONFIG_TABLE . " SET config_value = 'db' WHERE config_name = 'auth_method'";
|
$sql = 'UPDATE ' . CONFIG_TABLE . " SET config_value = 'db' WHERE config_name = 'auth_method'";
|
||||||
$db->sql_query($sql);
|
$this->db->sql_query($sql);
|
||||||
$config['auth_method'] = 'db';
|
$config['auth_method'] = 'db';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -30,9 +30,8 @@ class phpbb_functional_forum_style_test extends phpbb_functional_test_case
|
|||||||
|
|
||||||
public function test_custom_forum_style()
|
public function test_custom_forum_style()
|
||||||
{
|
{
|
||||||
$db = $this->get_db();
|
|
||||||
$this->add_style(2, 'test_style');
|
$this->add_style(2, 'test_style');
|
||||||
$db->sql_query('UPDATE ' . FORUMS_TABLE . ' SET forum_style = 2 WHERE forum_id = 2');
|
$this->db->sql_query('UPDATE ' . FORUMS_TABLE . ' SET forum_style = 2 WHERE forum_id = 2');
|
||||||
|
|
||||||
$crawler = self::request('GET', 'viewtopic.php?t=1&f=2');
|
$crawler = self::request('GET', 'viewtopic.php?t=1&f=2');
|
||||||
$this->assertStringContainsString('styles/test_style/', $crawler->filter('head > link[rel=stylesheet]')->eq(1)->attr('href'));
|
$this->assertStringContainsString('styles/test_style/', $crawler->filter('head > link[rel=stylesheet]')->eq(1)->attr('href'));
|
||||||
@@ -43,7 +42,7 @@ class phpbb_functional_forum_style_test extends phpbb_functional_test_case
|
|||||||
$crawler = self::request('GET', 'viewtopic.php?t=1&view=next');
|
$crawler = self::request('GET', 'viewtopic.php?t=1&view=next');
|
||||||
$this->assertStringContainsString('styles/test_style/', $crawler->filter('head > link[rel=stylesheet]')->eq(1)->attr('href'));
|
$this->assertStringContainsString('styles/test_style/', $crawler->filter('head > link[rel=stylesheet]')->eq(1)->attr('href'));
|
||||||
|
|
||||||
$db->sql_query('UPDATE ' . FORUMS_TABLE . ' SET forum_style = 0 WHERE forum_id = 2');
|
$this->db->sql_query('UPDATE ' . FORUMS_TABLE . ' SET forum_style = 0 WHERE forum_id = 2');
|
||||||
$this->delete_style(2, 'test_style');
|
$this->delete_style(2, 'test_style');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -21,13 +21,12 @@ class phpbb_functional_plupload_test extends phpbb_functional_test_case
|
|||||||
|
|
||||||
protected function set_extension_group_permission($val)
|
protected function set_extension_group_permission($val)
|
||||||
{
|
{
|
||||||
$db = $this->get_db();
|
|
||||||
$query = "
|
$query = "
|
||||||
UPDATE phpbb_extension_groups
|
UPDATE phpbb_extension_groups
|
||||||
SET allow_in_pm = '$val'
|
SET allow_in_pm = '$val'
|
||||||
WHERE group_name = 'IMAGES'
|
WHERE group_name = 'IMAGES'
|
||||||
";
|
";
|
||||||
$db->sql_query($query);
|
$this->db->sql_query($query);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
|
@@ -38,10 +38,9 @@ class phpbb_functional_search_mysql_test extends phpbb_functional_search_base
|
|||||||
// Try optimizing posts table after creating search index.
|
// Try optimizing posts table after creating search index.
|
||||||
// Some versions of MariaDB might not return any results in the search
|
// Some versions of MariaDB might not return any results in the search
|
||||||
// until the table has been optimized or the index deleted and re-created.
|
// until the table has been optimized or the index deleted and re-created.
|
||||||
$db = $this->get_db();
|
$this->db->sql_return_on_error(true);
|
||||||
$db->sql_return_on_error(true);
|
|
||||||
$sql = 'OPTIMIZE TABLE ' . POSTS_TABLE;
|
$sql = 'OPTIMIZE TABLE ' . POSTS_TABLE;
|
||||||
$db->sql_query($sql);
|
$this->db->sql_query($sql);
|
||||||
$db->sql_return_on_error(false);
|
$this->db->sql_return_on_error(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -21,35 +21,29 @@ class phpbb_functional_session_page_update_test extends phpbb_functional_test_ca
|
|||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
global $db;
|
|
||||||
|
|
||||||
$db = $this->db;
|
|
||||||
|
|
||||||
// Delete previous session info for admin user
|
// Delete previous session info for admin user
|
||||||
$sql = 'DELETE FROM ' . SESSIONS_TABLE . ' WHERE session_user_id = 2';
|
$sql = 'DELETE FROM ' . SESSIONS_TABLE . ' WHERE session_user_id = 2';
|
||||||
$db->sql_query($sql);
|
$this->db->sql_query($sql);
|
||||||
|
|
||||||
$this->login();
|
$this->login();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_session_page_update()
|
public function test_session_page_update()
|
||||||
{
|
{
|
||||||
$db = $this->get_db();
|
|
||||||
|
|
||||||
// Request index page
|
// Request index page
|
||||||
self::request('GET', 'index.php');
|
self::request('GET', 'index.php');
|
||||||
$this->assertEquals(200, self::$client->getInternalResponse()->getStatusCode(), 'Failed asserting that status of index page is 200');
|
$this->assertEquals(200, self::$client->getInternalResponse()->getStatusCode(), 'Failed asserting that status of index page is 200');
|
||||||
|
|
||||||
$sql = 'SELECT session_page FROM ' . SESSIONS_TABLE . ' WHERE session_user_id = 2 ORDER BY session_time DESC';
|
$sql = 'SELECT session_page FROM ' . SESSIONS_TABLE . ' WHERE session_user_id = 2 ORDER BY session_time DESC';
|
||||||
$db->sql_query_limit($sql, 1);
|
$this->db->sql_query_limit($sql, 1);
|
||||||
$this->assertEquals('index.php', $db->sql_fetchfield('session_page'), 'Failed asserting that session_page is index.php for admin user');
|
$this->assertEquals('index.php', $this->db->sql_fetchfield('session_page'), 'Failed asserting that session_page is index.php for admin user');
|
||||||
|
|
||||||
// Request non-existent url
|
// Request non-existent url
|
||||||
self::request('GET', 'nonexistent.jpg', [], false);
|
self::request('GET', 'nonexistent.jpg', [], false);
|
||||||
$this->assertEquals(404, self::$client->getInternalResponse()->getStatusCode(), 'Failed asserting that status of non-existent image is 404');
|
$this->assertEquals(404, self::$client->getInternalResponse()->getStatusCode(), 'Failed asserting that status of non-existent image is 404');
|
||||||
|
|
||||||
$db->sql_query_limit($sql, 1);
|
$this->db->sql_query_limit($sql, 1);
|
||||||
// User page should not be updated to non-existent one
|
// User page should not be updated to non-existent one
|
||||||
$this->assertEquals('index.php', $db->sql_fetchfield('session_page'), 'Failed asserting that session page has not changed after 404');
|
$this->assertEquals('index.php', $this->db->sql_fetchfield('session_page'), 'Failed asserting that session page has not changed after 404');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -21,19 +21,18 @@ class phpbb_functional_smilies_test extends phpbb_functional_test_case
|
|||||||
$this->login();
|
$this->login();
|
||||||
|
|
||||||
// Get smilies data
|
// Get smilies data
|
||||||
$db = $this->get_db();
|
|
||||||
$sql_ary = [
|
$sql_ary = [
|
||||||
'SELECT' => 's.smiley_url, MIN(s.emotion) AS emotion, MIN(s.code) AS code, s.smiley_width, s.smiley_height, MIN(s.smiley_order) AS min_smiley_order',
|
'SELECT' => 's.smiley_url, MIN(s.emotion) AS emotion, MIN(s.code) AS code, s.smiley_width, s.smiley_height, MIN(s.smiley_order) AS min_smiley_order',
|
||||||
'FROM' => [
|
'FROM' => [
|
||||||
SMILIES_TABLE => 's',
|
SMILIES_TABLE => 's',
|
||||||
],
|
],
|
||||||
'GROUP_BY' => 's.smiley_url, s.smiley_width, s.smiley_height',
|
'GROUP_BY' => 's.smiley_url, s.smiley_width, s.smiley_height',
|
||||||
'ORDER_BY' => $db->sql_quote('min_smiley_order'),
|
'ORDER_BY' => $this->db->sql_quote('min_smiley_order'),
|
||||||
];
|
];
|
||||||
$sql = $db->sql_build_query('SELECT', $sql_ary);
|
$sql = $this->db->sql_build_query('SELECT', $sql_ary);
|
||||||
$result = $db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
$smilies = $db->sql_fetchrowset($result);
|
$smilies = $this->db->sql_fetchrowset($result);
|
||||||
$db->sql_freeresult($result);
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
// Visit smilies page
|
// Visit smilies page
|
||||||
$crawler = self::request('GET', 'posting.php?mode=smilies');
|
$crawler = self::request('GET', 'posting.php?mode=smilies');
|
||||||
|
@@ -73,13 +73,12 @@ class phpbb_functional_switch_permissions_test extends phpbb_functional_test_cas
|
|||||||
*/
|
*/
|
||||||
public function test_switch_permissions_ucp()
|
public function test_switch_permissions_ucp()
|
||||||
{
|
{
|
||||||
$db = $this->get_db();
|
|
||||||
$sql = 'SELECT user_id
|
$sql = 'SELECT user_id
|
||||||
FROM ' . USERS_TABLE . "
|
FROM ' . USERS_TABLE . "
|
||||||
WHERE username = '" . self::TEST_USER . "'";
|
WHERE username = '" . self::TEST_USER . "'";
|
||||||
$result = $db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
$user_id = $db->sql_fetchfield('user_id');
|
$user_id = $this->db->sql_fetchfield('user_id');
|
||||||
$db->sql_freeresult($result);
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
// Open memberlist profile page for user
|
// Open memberlist profile page for user
|
||||||
$crawler = self::request('GET', "memberlist.php?mode=viewprofile&u={$user_id}&sid={$this->sid}");
|
$crawler = self::request('GET', "memberlist.php?mode=viewprofile&u={$user_id}&sid={$this->sid}");
|
||||||
|
@@ -64,11 +64,10 @@ class phpbb_functional_ucp_allow_pm_test extends phpbb_functional_test_case
|
|||||||
// enable or disable PM for a user, like from ucp
|
// enable or disable PM for a user, like from ucp
|
||||||
protected function set_user_allow_pm($user_id, $allow)
|
protected function set_user_allow_pm($user_id, $allow)
|
||||||
{
|
{
|
||||||
$db = $this->get_db();
|
|
||||||
$sql = 'UPDATE ' . USERS_TABLE . "
|
$sql = 'UPDATE ' . USERS_TABLE . "
|
||||||
SET user_allow_pm = " . $allow . "
|
SET user_allow_pm = " . $allow . "
|
||||||
WHERE user_id = " . $user_id;
|
WHERE user_id = " . $user_id;
|
||||||
$result = $db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
$db->sql_freeresult($result);
|
$this->db->sql_freeresult($result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -73,7 +73,6 @@ class phpbb_functional_ucp_profile_test extends phpbb_functional_test_case
|
|||||||
{
|
{
|
||||||
$this->add_lang('ucp');
|
$this->add_lang('ucp');
|
||||||
$this->login('admin', true);
|
$this->login('admin', true);
|
||||||
$db = $this->get_db();
|
|
||||||
|
|
||||||
$crawler = self::request('GET', 'ucp.php?i=ucp_profile&mode=autologin_keys');
|
$crawler = self::request('GET', 'ucp.php?i=ucp_profile&mode=autologin_keys');
|
||||||
$this->assertContainsLang('UCP_PROFILE_AUTOLOGIN_KEYS', $crawler->filter('#cp-main h2')->text());
|
$this->assertContainsLang('UCP_PROFILE_AUTOLOGIN_KEYS', $crawler->filter('#cp-main h2')->text());
|
||||||
@@ -87,9 +86,9 @@ class phpbb_functional_ucp_profile_test extends phpbb_functional_test_case
|
|||||||
'WHERE' => 'sk.user_id = ' . (int) $user_id,
|
'WHERE' => 'sk.user_id = ' . (int) $user_id,
|
||||||
'ORDER_BY' => 'sk.last_login ASC',
|
'ORDER_BY' => 'sk.last_login ASC',
|
||||||
];
|
];
|
||||||
$result = $db->sql_query_limit($db->sql_build_query('SELECT', $sql_ary), 1);
|
$result = $this->db->sql_query_limit($this->db->sql_build_query('SELECT', $sql_ary), 1);
|
||||||
$key_id = substr($db->sql_fetchfield('key_id'), 0, 8);
|
$key_id = substr($this->db->sql_fetchfield('key_id'), 0, 8);
|
||||||
$db->sql_freeresult($result);
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
$this->assertStringContainsString($key_id, $crawler->filter('label[for="' . $key_id . '"]')->text());
|
$this->assertStringContainsString($key_id, $crawler->filter('label[for="' . $key_id . '"]')->text());
|
||||||
|
|
||||||
|
@@ -241,12 +241,10 @@ class phpbb_functional_user_password_reset_test extends phpbb_functional_test_ca
|
|||||||
$this->assertNotEmpty($this->user_data['user_actkey']);
|
$this->assertNotEmpty($this->user_data['user_actkey']);
|
||||||
|
|
||||||
// Change reason for inactivity
|
// Change reason for inactivity
|
||||||
$db = $this->get_db();
|
|
||||||
|
|
||||||
$sql = 'UPDATE ' . USERS_TABLE . '
|
$sql = 'UPDATE ' . USERS_TABLE . '
|
||||||
SET user_inactive_reason = ' . INACTIVE_REMIND . '
|
SET user_inactive_reason = ' . INACTIVE_REMIND . '
|
||||||
WHERE user_id = ' . (int) $this->user_data['user_id'];
|
WHERE user_id = ' . (int) $this->user_data['user_id'];
|
||||||
$db->sql_query($sql);
|
$this->db->sql_query($sql);
|
||||||
|
|
||||||
$this->add_lang('ucp');
|
$this->add_lang('ucp');
|
||||||
|
|
||||||
@@ -262,12 +260,11 @@ class phpbb_functional_user_password_reset_test extends phpbb_functional_test_ca
|
|||||||
|
|
||||||
protected function get_user_data($username)
|
protected function get_user_data($username)
|
||||||
{
|
{
|
||||||
$db = $this->get_db();
|
|
||||||
$sql = 'SELECT user_id, username, user_type, user_email, user_newpasswd, user_lang, user_actkey, user_inactive_reason, reset_token, reset_token_expiration
|
$sql = 'SELECT user_id, username, user_type, user_email, user_newpasswd, user_lang, user_actkey, user_inactive_reason, reset_token, reset_token_expiration
|
||||||
FROM ' . USERS_TABLE . "
|
FROM ' . USERS_TABLE . "
|
||||||
WHERE username = '" . $db->sql_escape($username) . "'";
|
WHERE username = '" . $this->db->sql_escape($username) . "'";
|
||||||
$result = $db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
$this->user_data = $db->sql_fetchrow($result);
|
$this->user_data = $this->db->sql_fetchrow($result);
|
||||||
$db->sql_freeresult($result);
|
$this->db->sql_freeresult($result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,31 +18,27 @@ class phpbb_functional_viewonline_test extends phpbb_functional_test_case
|
|||||||
{
|
{
|
||||||
protected function get_forum_name_by_topic_id($topic_id)
|
protected function get_forum_name_by_topic_id($topic_id)
|
||||||
{
|
{
|
||||||
$db = $this->get_db();
|
|
||||||
|
|
||||||
// Forum info
|
// Forum info
|
||||||
$sql = 'SELECT f.forum_name
|
$sql = 'SELECT f.forum_name
|
||||||
FROM ' . FORUMS_TABLE . ' f,' . TOPICS_TABLE . ' t
|
FROM ' . FORUMS_TABLE . ' f,' . TOPICS_TABLE . ' t
|
||||||
WHERE t.forum_id = f.forum_id
|
WHERE t.forum_id = f.forum_id
|
||||||
AND t.topic_id = ' . (int) $topic_id;
|
AND t.topic_id = ' . (int) $topic_id;
|
||||||
$result = $db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
$forum_name = $db->sql_fetchfield('forum_name');
|
$forum_name = $this->db->sql_fetchfield('forum_name');
|
||||||
$db->sql_freeresult($result, 1800); // cache for 30 minutes
|
$this->db->sql_freeresult($result, 1800); // cache for 30 minutes
|
||||||
|
|
||||||
return $forum_name;
|
return $forum_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function get_forum_name_by_forum_id($forum_id)
|
protected function get_forum_name_by_forum_id($forum_id)
|
||||||
{
|
{
|
||||||
$db = $this->get_db();
|
|
||||||
|
|
||||||
// Forum info
|
// Forum info
|
||||||
$sql = 'SELECT forum_name
|
$sql = 'SELECT forum_name
|
||||||
FROM ' . FORUMS_TABLE . '
|
FROM ' . FORUMS_TABLE . '
|
||||||
WHERE forum_id = ' . (int) $forum_id;
|
WHERE forum_id = ' . (int) $forum_id;
|
||||||
$result = $db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
$forum_name = $db->sql_fetchfield('forum_name');
|
$forum_name = $this->db->sql_fetchfield('forum_name');
|
||||||
$db->sql_freeresult($result, 1800); // cache for 30 minutes
|
$this->db->sql_freeresult($result, 1800); // cache for 30 minutes
|
||||||
|
|
||||||
return $forum_name;
|
return $forum_name;
|
||||||
}
|
}
|
||||||
|
@@ -119,15 +119,15 @@ class phpbb_functional_test_case extends phpbb_test_case
|
|||||||
$this->lang = array();
|
$this->lang = array();
|
||||||
$this->add_lang('common');
|
$this->add_lang('common');
|
||||||
|
|
||||||
$db = $this->get_db();
|
$this->get_db();
|
||||||
|
|
||||||
// Special flag for testing without possibility to run into lock scenario.
|
// Special flag for testing without possibility to run into lock scenario.
|
||||||
// Unset entry and add it back if lock behavior for posting should be tested.
|
// Unset entry and add it back if lock behavior for posting should be tested.
|
||||||
// Unset ci_tests_no_lock_posting from config
|
// Unset ci_tests_no_lock_posting from config
|
||||||
$db->sql_return_on_error(true);
|
$this->db->sql_return_on_error(true);
|
||||||
$sql = 'INSERT INTO ' . CONFIG_TABLE . " (config_name, config_value) VALUES ('ci_tests_no_lock_posting', '1')";
|
$sql = 'INSERT INTO ' . CONFIG_TABLE . " (config_name, config_value) VALUES ('ci_tests_no_lock_posting', '1')";
|
||||||
$this->db->sql_query($sql);
|
$this->db->sql_query($sql);
|
||||||
$db->sql_return_on_error(false);
|
$this->db->sql_return_on_error(false);
|
||||||
|
|
||||||
foreach (static::setup_extensions() as $extension)
|
foreach (static::setup_extensions() as $extension)
|
||||||
{
|
{
|
||||||
@@ -135,10 +135,10 @@ class phpbb_functional_test_case extends phpbb_test_case
|
|||||||
|
|
||||||
$sql = 'SELECT ext_active
|
$sql = 'SELECT ext_active
|
||||||
FROM ' . EXT_TABLE . "
|
FROM ' . EXT_TABLE . "
|
||||||
WHERE ext_name = '" . $db->sql_escape($extension). "'";
|
WHERE ext_name = '" . $this->db->sql_escape($extension). "'";
|
||||||
$result = $db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
$status = (bool) $db->sql_fetchfield('ext_active');
|
$status = (bool) $this->db->sql_fetchfield('ext_active');
|
||||||
$db->sql_freeresult($result);
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
if (!$status)
|
if (!$status)
|
||||||
{
|
{
|
||||||
@@ -289,7 +289,7 @@ class phpbb_functional_test_case extends phpbb_test_case
|
|||||||
global $phpbb_root_path, $phpEx;
|
global $phpbb_root_path, $phpEx;
|
||||||
|
|
||||||
$config = new \phpbb\config\config(array('version' => PHPBB_VERSION));
|
$config = new \phpbb\config\config(array('version' => PHPBB_VERSION));
|
||||||
$db = $this->get_db();
|
$this->get_db();
|
||||||
$db_doctrine = $this->get_db_doctrine();
|
$db_doctrine = $this->get_db_doctrine();
|
||||||
$factory = new \phpbb\db\tools\factory();
|
$factory = new \phpbb\db\tools\factory();
|
||||||
$finder_factory = new \phpbb\finder\factory(null, false, $phpbb_root_path, $phpEx);
|
$finder_factory = new \phpbb\finder\factory(null, false, $phpbb_root_path, $phpEx);
|
||||||
@@ -300,7 +300,7 @@ class phpbb_functional_test_case extends phpbb_test_case
|
|||||||
$migrator = new \phpbb\db\migrator(
|
$migrator = new \phpbb\db\migrator(
|
||||||
$container,
|
$container,
|
||||||
$config,
|
$config,
|
||||||
$db,
|
$this->db,
|
||||||
$db_tools,
|
$db_tools,
|
||||||
self::$config['table_prefix'] . 'migrations',
|
self::$config['table_prefix'] . 'migrations',
|
||||||
$phpbb_root_path,
|
$phpbb_root_path,
|
||||||
@@ -322,7 +322,7 @@ class phpbb_functional_test_case extends phpbb_test_case
|
|||||||
|
|
||||||
$extension_manager = new \phpbb\extension\manager(
|
$extension_manager = new \phpbb\extension\manager(
|
||||||
$container,
|
$container,
|
||||||
$db,
|
$this->db,
|
||||||
$config,
|
$config,
|
||||||
$finder_factory,
|
$finder_factory,
|
||||||
self::$config['table_prefix'] . 'ext',
|
self::$config['table_prefix'] . 'ext',
|
||||||
@@ -737,10 +737,10 @@ class phpbb_functional_test_case extends phpbb_test_case
|
|||||||
{
|
{
|
||||||
global $phpbb_root_path;
|
global $phpbb_root_path;
|
||||||
|
|
||||||
$db = $this->get_db();
|
$this->get_db();
|
||||||
if (version_compare(PHPBB_VERSION, '3.1.0-dev', '<'))
|
if (version_compare(PHPBB_VERSION, '3.1.0-dev', '<'))
|
||||||
{
|
{
|
||||||
$sql = 'INSERT INTO ' . STYLES_TABLE . ' ' . $db->sql_build_array('INSERT', array(
|
$sql = 'INSERT INTO ' . STYLES_TABLE . ' ' . $this->db->sql_build_array('INSERT', array(
|
||||||
'style_id' => $style_id,
|
'style_id' => $style_id,
|
||||||
'style_name' => $style_path,
|
'style_name' => $style_path,
|
||||||
'style_copyright' => '',
|
'style_copyright' => '',
|
||||||
@@ -749,17 +749,17 @@ class phpbb_functional_test_case extends phpbb_test_case
|
|||||||
'theme_id' => $style_id,
|
'theme_id' => $style_id,
|
||||||
'imageset_id' => $style_id,
|
'imageset_id' => $style_id,
|
||||||
));
|
));
|
||||||
$db->sql_query($sql);
|
$this->db->sql_query($sql);
|
||||||
|
|
||||||
$sql = 'INSERT INTO ' . STYLES_IMAGESET_TABLE . ' ' . $db->sql_build_array('INSERT', array(
|
$sql = 'INSERT INTO ' . STYLES_IMAGESET_TABLE . ' ' . $this->db->sql_build_array('INSERT', array(
|
||||||
'imageset_id' => $style_id,
|
'imageset_id' => $style_id,
|
||||||
'imageset_name' => $style_path,
|
'imageset_name' => $style_path,
|
||||||
'imageset_copyright' => '',
|
'imageset_copyright' => '',
|
||||||
'imageset_path' => $style_path,
|
'imageset_path' => $style_path,
|
||||||
));
|
));
|
||||||
$db->sql_query($sql);
|
$this->db->sql_query($sql);
|
||||||
|
|
||||||
$sql = 'INSERT INTO ' . STYLES_TEMPLATE_TABLE . ' ' . $db->sql_build_array('INSERT', array(
|
$sql = 'INSERT INTO ' . STYLES_TEMPLATE_TABLE . ' ' . $this->db->sql_build_array('INSERT', array(
|
||||||
'template_id' => $style_id,
|
'template_id' => $style_id,
|
||||||
'template_name' => $style_path,
|
'template_name' => $style_path,
|
||||||
'template_copyright' => '',
|
'template_copyright' => '',
|
||||||
@@ -768,9 +768,9 @@ class phpbb_functional_test_case extends phpbb_test_case
|
|||||||
'template_inherits_id' => $parent_style_id,
|
'template_inherits_id' => $parent_style_id,
|
||||||
'template_inherit_path' => $parent_style_path,
|
'template_inherit_path' => $parent_style_path,
|
||||||
));
|
));
|
||||||
$db->sql_query($sql);
|
$this->db->sql_query($sql);
|
||||||
|
|
||||||
$sql = 'INSERT INTO ' . STYLES_THEME_TABLE . ' ' . $db->sql_build_array('INSERT', array(
|
$sql = 'INSERT INTO ' . STYLES_THEME_TABLE . ' ' . $this->db->sql_build_array('INSERT', array(
|
||||||
'theme_id' => $style_id,
|
'theme_id' => $style_id,
|
||||||
'theme_name' => $style_path,
|
'theme_name' => $style_path,
|
||||||
'theme_copyright' => '',
|
'theme_copyright' => '',
|
||||||
@@ -779,7 +779,7 @@ class phpbb_functional_test_case extends phpbb_test_case
|
|||||||
'theme_mtime' => 0,
|
'theme_mtime' => 0,
|
||||||
'theme_data' => '',
|
'theme_data' => '',
|
||||||
));
|
));
|
||||||
$db->sql_query($sql);
|
$this->db->sql_query($sql);
|
||||||
|
|
||||||
if ($style_path != 'prosilver')
|
if ($style_path != 'prosilver')
|
||||||
{
|
{
|
||||||
@@ -789,7 +789,7 @@ class phpbb_functional_test_case extends phpbb_test_case
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$db->sql_multi_insert(STYLES_TABLE, array(array(
|
$this->db->sql_multi_insert(STYLES_TABLE, array(array(
|
||||||
'style_name' => $style_path,
|
'style_name' => $style_path,
|
||||||
'style_copyright' => '',
|
'style_copyright' => '',
|
||||||
'style_active' => 1,
|
'style_active' => 1,
|
||||||
@@ -811,13 +811,13 @@ class phpbb_functional_test_case extends phpbb_test_case
|
|||||||
{
|
{
|
||||||
global $phpbb_root_path;
|
global $phpbb_root_path;
|
||||||
|
|
||||||
$db = $this->get_db();
|
$this->get_db();
|
||||||
$db->sql_query('DELETE FROM ' . STYLES_TABLE . ' WHERE style_id = ' . $style_id);
|
$this->db->sql_query('DELETE FROM ' . STYLES_TABLE . ' WHERE style_id = ' . $style_id);
|
||||||
if (version_compare(PHPBB_VERSION, '3.1.0-dev', '<'))
|
if (version_compare(PHPBB_VERSION, '3.1.0-dev', '<'))
|
||||||
{
|
{
|
||||||
$db->sql_query('DELETE FROM ' . STYLES_IMAGESET_TABLE . ' WHERE imageset_id = ' . $style_id);
|
$this->db->sql_query('DELETE FROM ' . STYLES_IMAGESET_TABLE . ' WHERE imageset_id = ' . $style_id);
|
||||||
$db->sql_query('DELETE FROM ' . STYLES_TEMPLATE_TABLE . ' WHERE template_id = ' . $style_id);
|
$this->db->sql_query('DELETE FROM ' . STYLES_TEMPLATE_TABLE . ' WHERE template_id = ' . $style_id);
|
||||||
$db->sql_query('DELETE FROM ' . STYLES_THEME_TABLE . ' WHERE theme_id = ' . $style_id);
|
$this->db->sql_query('DELETE FROM ' . STYLES_THEME_TABLE . ' WHERE theme_id = ' . $style_id);
|
||||||
|
|
||||||
if ($style_path != 'prosilver')
|
if ($style_path != 'prosilver')
|
||||||
{
|
{
|
||||||
@@ -904,13 +904,13 @@ class phpbb_functional_test_case extends phpbb_test_case
|
|||||||
*/
|
*/
|
||||||
protected function get_group_id($group_name)
|
protected function get_group_id($group_name)
|
||||||
{
|
{
|
||||||
$db = $this->get_db();
|
$this->get_db();
|
||||||
$sql = 'SELECT group_id
|
$sql = 'SELECT group_id
|
||||||
FROM ' . GROUPS_TABLE . "
|
FROM ' . GROUPS_TABLE . "
|
||||||
WHERE group_name = '" . $db->sql_escape($group_name) . "'";
|
WHERE group_name = '" . $this->db->sql_escape($group_name) . "'";
|
||||||
$result = $db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
$group_id = (int) $db->sql_fetchfield('group_id');
|
$group_id = (int) $this->db->sql_fetchfield('group_id');
|
||||||
$db->sql_freeresult($result);
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
return $group_id;
|
return $group_id;
|
||||||
}
|
}
|
||||||
@@ -922,13 +922,12 @@ class phpbb_functional_test_case extends phpbb_test_case
|
|||||||
*/
|
*/
|
||||||
protected function get_search_type()
|
protected function get_search_type()
|
||||||
{
|
{
|
||||||
$db = $this->get_db();
|
|
||||||
$sql = 'SELECT config_value as search_type
|
$sql = 'SELECT config_value as search_type
|
||||||
FROM ' . CONFIG_TABLE . "
|
FROM ' . CONFIG_TABLE . "
|
||||||
WHERE config_name = '" . $db->sql_escape('search_type') . "'";
|
WHERE config_name = '" . $this->db->sql_escape('search_type') . "'";
|
||||||
$result = $db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
$search_type = $db->sql_fetchfield('search_type');
|
$search_type = $this->db->sql_fetchfield('search_type');
|
||||||
$db->sql_freeresult($result);
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
return $search_type;
|
return $search_type;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user