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

[ticket/16549] Fix tests

PHPBB3-16549
This commit is contained in:
rxu
2020-08-10 15:02:25 +07:00
parent fc631040fd
commit ec565de6cb
43 changed files with 334 additions and 51 deletions

View File

@@ -74,6 +74,8 @@ abstract class phpbb_tests_notification_base extends phpbb_database_test_case
$lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx);
$lang = new \phpbb\language\language($lang_loader);
$user = new \phpbb\user($lang, '\phpbb\datetime');
$user->data['user_id'] = 0;
$user->data['user_type'] = USER_NORMAL;
$this->user = $user;
$this->user_loader = new \phpbb\user_loader($this->db, $phpbb_root_path, $phpEx, 'phpbb_users');
$auth = $this->auth = new phpbb_mock_notifications_auth();

View File

@@ -249,7 +249,16 @@ class notification_method_email_test extends phpbb_tests_notification_base
*/
public function test_notification_email($notification_type, $post_data, $expected_users)
{
$post_data = array_merge(['post_time' => 1349413322], $post_data);
$post_data = array_merge([
'post_time' => 1349413322,
'poster_id' => 1,
'topic_title' => '',
'post_subject' => '',
'post_username' => '',
'forum_name' => '',
],
$post_data);
$notification_options = [
'item_id' => $post_data['post_id'],
'item_parent_id' => $post_data['topic_id'],

View File

@@ -160,6 +160,8 @@ class phpbb_notification_test extends phpbb_tests_notification_base
'post_subject' => 'Re: test-title',
'forum_id' => 2,
'forum_name' => 'Your first forum',
'post_username' => '',
'post_text' => 'test text',
));
$this->db->sql_query('INSERT INTO ' . BOOKMARKS_TABLE . ' ' . $this->db->sql_build_array('INSERT', array(
@@ -176,6 +178,8 @@ class phpbb_notification_test extends phpbb_tests_notification_base
'post_subject' => 'Re: test-title',
'forum_id' => 2,
'forum_name' => 'Your first forum',
'post_username' => '',
'post_text' => 'test text',
));
$this->notifications->delete_subscription('test');
@@ -267,6 +271,9 @@ class phpbb_notification_test extends phpbb_tests_notification_base
'post_subject' => 'Re: test-title2', // change post_subject
'forum_id' => 3, // change forum_id
'forum_name' => 'Your second forum', // change forum_name
'post_username' => '',
'post_text' => 'test text2',
'post_time' => 1349413325,
));
$this->assert_notifications(

View File

@@ -39,6 +39,9 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c
'bbcode_bitfield' => '',
'bbcode_uid' => '',
'post_edit_locked' => false,
'notify_set' => 0,
'notify' => false,
'forum_name' => 'Test forum name',
//'force_approved_state' => 1,
);
@@ -102,6 +105,7 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c
'username' => 'user-name',
'is_registered' => true,
'user_colour' => '',
'user_lastmark' => 0,
);
// Request

View File

@@ -135,9 +135,10 @@ class phpbb_notification_submit_post_type_topic_test extends phpbb_notification_
$this->db->sql_freeresult($result);
$result = $this->db->sql_query(
'SELECT *
FROM ' . POSTS_TABLE . '
WHERE post_id = ' . $reply_id);
'SELECT p.*, t.topic_posts_approved, t.topic_posts_unapproved, t.topic_posts_softdeleted, t.topic_first_post_id, t.topic_last_post_id
FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t
WHERE p.topic_id = t.topic_id
AND p.post_id = ' . $reply_id);
$reply_edit_data = array_merge($this->post_data, $this->db->sql_fetchrow($result), array(
'force_approved_state' => false,
'post_edit_reason' => 'PHPBB3-12370',

View File

@@ -51,7 +51,10 @@ class phpbb_notification_user_list_trim_test extends phpbb_database_test_case
$lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx);
$lang = new \phpbb\language\language($lang_loader);
$user = new \phpbb\user($lang, '\phpbb\datetime');
$user->data = array('user_lang' => 'en');
$user->data = [
'user_id' => 1,
'user_lang' => 'en',
];
$lang->add_lang('common');
$user_loader = new phpbb\user_loader($db, $phpbb_root_path, $phpEx, USERS_TABLE);