[ticket/16549] Fix tests

PHPBB3-16549
This commit is contained in:
rxu 2020-08-10 15:02:25 +07:00
parent fc631040fd
commit ec565de6cb
No known key found for this signature in database
GPG key ID: 955F0567380E586A
43 changed files with 334 additions and 51 deletions

View file

@ -137,6 +137,7 @@ class phpbb_attachment_upload_test extends \phpbb_database_test_case
$this->files_upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); $this->files_upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
$this->phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $this->phpbb_dispatcher = new phpbb_mock_event_dispatcher();
$this->user = new \phpbb\user($this->language, '\phpbb\datetime'); $this->user = new \phpbb\user($this->language, '\phpbb\datetime');
$this->user->data['user_id'] = ANONYMOUS;
$this->upload = new \phpbb\attachment\upload( $this->upload = new \phpbb\attachment\upload(
@ -181,7 +182,14 @@ class phpbb_attachment_upload_test extends \phpbb_database_test_case
) )
), ),
array('foobar', 1, true, array('foobar', 1, true,
array(), // Instead of setting to false or empty array, set default filedata array
// as otherwise it throws PHP undefined array key warnings
// in different file upload related services
array(
'realname' => null,
'type' => null,
'size' => null,
),
array( array(
'error' => array( 'error' => array(
'NOT_UPLOADED', 'NOT_UPLOADED',
@ -244,7 +252,16 @@ class phpbb_attachment_upload_test extends \phpbb_database_test_case
$this->phpbb_root_path $this->phpbb_root_path
); );
$filedata = $this->upload->upload('foobar', 1, true); // Instead of setting to false or empty array, set default filedata array
// as otherwise it throws PHP undefined array key warnings
// in different file upload related services
$filedata = $this->upload->upload('foobar', 1, true, '', false,
[
'realname' => null,
'type' => null,
'size' => null,
]
);
$this->assertSame(array( $this->assertSame(array(
'error' => array(), 'error' => array(),

View file

@ -333,7 +333,9 @@ class phpbb_avatar_manager_test extends \phpbb_database_test_case
'avatar_type' => '', 'avatar_type' => '',
'avatar_width' => 0, 'avatar_width' => 0,
'avatar_height' => 0, 'avatar_height' => 0,
), 1, array( ),
array(
'id' => 1,
'avatar' => 'foobar@example.com', 'avatar' => 'foobar@example.com',
'avatar_type' => 'avatar.driver.gravatar', 'avatar_type' => 'avatar.driver.gravatar',
'avatar_width' => '16', 'avatar_width' => '16',
@ -346,7 +348,9 @@ class phpbb_avatar_manager_test extends \phpbb_database_test_case
'avatar_type' => '', 'avatar_type' => '',
'avatar_width' => 0, 'avatar_width' => 0,
'avatar_height' => 0, 'avatar_height' => 0,
), 5, array( ),
array(
'id' => 5,
'avatar' => 'g5_1414350991.jpg', 'avatar' => 'g5_1414350991.jpg',
'avatar_type' => 'avatar.driver.upload', 'avatar_type' => 'avatar.driver.upload',
'avatar_width' => '80', 'avatar_width' => '80',
@ -359,13 +363,13 @@ class phpbb_avatar_manager_test extends \phpbb_database_test_case
/** /**
* @dataProvider data_handle_avatar_delete * @dataProvider data_handle_avatar_delete
*/ */
public function test_handle_avatar_delete($expected, $id, $avatar_data, $table, $prefix) public function test_handle_avatar_delete($expected, $avatar_data, $table, $prefix)
{ {
$this->config['allow_avatar_gravatar'] = true; $this->config['allow_avatar_gravatar'] = true;
$this->assertNull($this->manager->handle_avatar_delete($this->db, $this->user, $avatar_data, $table, $prefix)); $this->assertNull($this->manager->handle_avatar_delete($this->db, $this->user, $avatar_data, $table, $prefix));
$sql = 'SELECT * FROM ' . $table . ' $sql = 'SELECT * FROM ' . $table . '
WHERE ' . $prefix . 'id = ' . $id; WHERE ' . $prefix . 'id = ' . (int) $avatar_data['id'];
$result = $this->db->sql_query_limit($sql, 1); $result = $this->db->sql_query_limit($sql, 1);
$row = $this->manager->clean_row($this->db->sql_fetchrow($result), substr($prefix, 0, -1)); $row = $this->manager->clean_row($this->db->sql_fetchrow($result), substr($prefix, 0, -1));

View file

@ -31,7 +31,7 @@ class phpbb_cache_memory extends \phpbb\cache\driver\memory
*/ */
function _read($var) function _read($var)
{ {
return $this->data[$var]; return $this->data[$var] ?? false;
} }
/** /**

View file

@ -123,7 +123,7 @@ class phpbb_cache_memory_test extends phpbb_database_test_case
foreach ($sql_queries as $query) foreach ($sql_queries as $query)
{ {
$this->assertNotEquals(false, $this->cache->sql_load($query[0])); $this->assertFalse($this->cache->sql_load($query[0]));
} }
} }
} }

View file

@ -66,6 +66,7 @@ abstract class phpbb_console_user_base extends phpbb_database_test_case
$this->language, $this->language,
'\phpbb\datetime' '\phpbb\datetime'
)); ));
$user->data['user_email'] = '';
$this->user_loader = new \phpbb\user_loader($db, $phpbb_root_path, $phpEx, USERS_TABLE); $this->user_loader = new \phpbb\user_loader($db, $phpbb_root_path, $phpEx, USERS_TABLE);

View file

@ -309,6 +309,8 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case
$lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx);
$lang = new \phpbb\language\language($lang_loader); $lang = new \phpbb\language\language($lang_loader);
$user = new \phpbb\user($lang, '\phpbb\datetime'); $user = new \phpbb\user($lang, '\phpbb\datetime');
$user->data['user_id'] = ANONYMOUS;
$attachment_delete = new \phpbb\attachment\delete($config, $db, new \phpbb_mock_event_dispatcher(), new \phpbb\filesystem\filesystem(), new \phpbb\attachment\resync($db), $phpbb_root_path); $attachment_delete = new \phpbb\attachment\delete($config, $db, new \phpbb_mock_event_dispatcher(), new \phpbb\filesystem\filesystem(), new \phpbb\attachment\resync($db), $phpbb_root_path);
$phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $phpbb_dispatcher = new phpbb_mock_event_dispatcher();

View file

@ -425,7 +425,7 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case
public function test_create_int_default_null() public function test_create_int_default_null()
{ {
$this->assertFalse($this->tools->sql_column_exists('prefix_table_name', 'c_bug_13282')); $this->assertFalse($this->tools->sql_column_exists('prefix_table_name', 'c_bug_13282'));
$this->assertTrue($this->tools->sql_column_add('prefix_table_name', 'c_bug_13282', array('TINT:2'))); $this->assertTrue($this->tools->sql_column_add('prefix_table_name', 'c_bug_13282', array('TINT:2', null)));
$this->assertTrue($this->tools->sql_column_exists('prefix_table_name', 'c_bug_13282')); $this->assertTrue($this->tools->sql_column_exists('prefix_table_name', 'c_bug_13282'));
} }

View file

@ -53,6 +53,7 @@ class phpbb_email_parsing_test extends phpbb_test_case
$lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx);
$lang = new \phpbb\language\language($lang_loader); $lang = new \phpbb\language\language($lang_loader);
$user = new \phpbb\user($lang, '\phpbb\datetime'); $user = new \phpbb\user($lang, '\phpbb\datetime');
$user->data['user_lang'] = 'en';
$phpbb_container->set('user', $user); $phpbb_container->set('user', $user);
$extension_manager = new phpbb_mock_extension_manager( $extension_manager = new phpbb_mock_extension_manager(
dirname(__FILE__) . '/', dirname(__FILE__) . '/',

View file

@ -51,14 +51,16 @@ class phpbb_error_collector_test extends phpbb_test_case
// Cause a warning // Cause a warning
1/0; $line = __LINE__; 1/0; $line = __LINE__;
// Cause a notice // Cause a "Notice: unserialize(): Error at offset 0 of 27 bytes in ..."
$array = array(0 => 'value'); // "Undefined array index" used earlier was promoted to warning in PHP 8.0,
$value = $array[1]; $line2 = __LINE__; // see https://github.com/php/php-src/commit/c48b745f0090c944e77c1fbcfb6c4df3b54356ad
unserialize("obvious non-serialized data"); $line2 = __LINE__;
$collector->uninstall(); $collector->uninstall();
// The notice should not be collected // The notice should not be collected
$this->assertEmpty($collector->errors[1]); $this->assertFalse(isset($collector->errors[1]));
$this->assertEquals(count($collector->errors), 1);
list($errno, $msg_text, $errfile, $errline) = $collector->errors[0]; list($errno, $msg_text, $errfile, $errline) = $collector->errors[0];
$error_contents = $collector->format_errors(); $error_contents = $collector->format_errors();

View file

@ -104,6 +104,7 @@ class phpbb_files_types_local_test extends phpbb_test_case
array( array(
'foo', 'foo',
array( array(
'realname' => null,
'tmp_name' => 'foo', 'tmp_name' => 'foo',
'size' => 500, 'size' => 500,
'type' => 'image/png', 'type' => 'image/png',
@ -112,13 +113,17 @@ class phpbb_files_types_local_test extends phpbb_test_case
), ),
array( array(
'none', 'none',
false, array(
'realname' => null,
'size' => null,
'type' => null,
),
array('PHP_SIZE_OVERRUN'), array('PHP_SIZE_OVERRUN'),
), ),
array( array(
'tests/upload/fixture/png', 'tests/upload/fixture/png',
array( array(
'realname' => 'foo.png', 'realname' => 'foo.png',
'size' => 500, 'size' => 500,
'type' => 'image/png', 'type' => 'image/png',
'local_mode' => true, 'local_mode' => true,
@ -153,7 +158,6 @@ class phpbb_files_types_local_test extends phpbb_test_case
$upload->set_allowed_extensions(array('png')); $upload->set_allowed_extensions(array('png'));
$type_local->set_upload($upload); $type_local->set_upload($upload);
$file = $type_local->upload($filename, $upload_ary); $file = $type_local->upload($filename, $upload_ary);
$this->assertSame($expected, $file->error); $this->assertSame($expected, $file->error);
$this->assertInstanceOf('\phpbb\files\filespec', $file); $this->assertInstanceOf('\phpbb\files\filespec', $file);

View file

@ -117,8 +117,10 @@ class phpbb_functional_acp_groups_test extends phpbb_functional_common_groups_te
else else
{ {
$this->form_data = $form->getValues(); $this->form_data = $form->getValues();
$this->assertEquals($tick_legend, $this->form_data['group_legend']); // form_data[] values can be bool or null if not ticked, $tick_* value can be bool or null if not set.
$this->assertEquals($tick_teampage, $this->form_data['group_teampage']); // Cast both to the same type to correctly compare the values.
$this->assertEquals((bool) $tick_legend, (bool) ($this->form_data['group_legend'] ?? false));
$this->assertEquals((bool) $tick_teampage, (bool) ($this->form_data['group_teampage'] ?? false));
} }
} }
} }

View file

@ -80,6 +80,6 @@ class phpbb_functional_avatar_acp_groups_test extends phpbb_functional_common_av
$crawler = self::request('GET', $this->get_url() . '&sid=' . $this->sid); $crawler = self::request('GET', $this->get_url() . '&sid=' . $this->sid);
$form = $crawler->selectButton($this->lang('SUBMIT'))->form(); $form = $crawler->selectButton($this->lang('SUBMIT'))->form();
$form_data = $form->getValues(); $form_data = $form->getValues();
$this->assertEmpty($form_data['avatar_type']); $this->assertFalse(isset($form_data['avatar_type']));
} }
} }

View file

@ -39,7 +39,7 @@ class phpbb_functional_smilies_test extends phpbb_functional_test_case
$crawler = self::request('GET', 'posting.php?mode=smilies'); $crawler = self::request('GET', 'posting.php?mode=smilies');
foreach ($smilies as $index => $smiley) foreach ($smilies as $index => $smiley)
{ {
$this->assertContains($smiley['smiley_url'], $this->assertStringContainsString($smiley['smiley_url'],
$crawler->filter('div[class="inner"] > a > img')->eq($index)->attr('src') $crawler->filter('div[class="inner"] > a > img')->eq($index)->attr('src')
); );
} }

View file

@ -33,6 +33,7 @@ class phpbb_functions_user_delete_test extends phpbb_database_test_case
$lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx);
$lang = new \phpbb\language\language($lang_loader); $lang = new \phpbb\language\language($lang_loader);
$user = new \phpbb\user($lang, '\phpbb\datetime'); $user = new \phpbb\user($lang, '\phpbb\datetime');
$user->data['user_id'] = 2;
$phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $phpbb_dispatcher = new phpbb_mock_event_dispatcher();
$phpbb_container = new phpbb_mock_container_builder(); $phpbb_container = new phpbb_mock_container_builder();
$config = new \phpbb\config\config(array( $config = new \phpbb\config\config(array(

View file

@ -30,7 +30,7 @@ class phpbb_functions_validate_num_test extends phpbb_test_case
$this->helper->assert_valid_data(array( $this->helper->assert_valid_data(array(
'empty' => array( 'empty' => array(
array(), array(),
'', null, // '' < 0 is true since PHP 8.0, hence use null instead of '' (empty string)
array('num'), array('num'),
), ),
'zero' => array( 'zero' => array(
@ -54,7 +54,7 @@ class phpbb_functions_validate_num_test extends phpbb_test_case
array('num', false, 2, 3), array('num', false, 2, 3),
), ),
'string' => array( 'string' => array(
array(), version_compare(PHP_VERSION, '7.5', '<=') ? [] : ['TOO_LARGE'], // See https://wiki.php.net/rfc/string_to_number_comparison
'foobar', 'foobar',
array('num'), array('num'),
), ),

View file

@ -38,6 +38,7 @@ class phpbb_functions_validate_user_email_test extends phpbb_database_test_case
$phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $phpbb_dispatcher = new phpbb_mock_event_dispatcher();
$language = new phpbb\language\language(new phpbb\language\language_file_loader($phpbb_root_path, $phpEx)); $language = new phpbb\language\language(new phpbb\language\language_file_loader($phpbb_root_path, $phpEx));
$this->user = new phpbb\user($language, '\phpbb\datetime'); $this->user = new phpbb\user($language, '\phpbb\datetime');
$this->user->data['user_email'] = '';
$this->helper = new phpbb_functions_validate_data_helper($this); $this->helper = new phpbb_functions_validate_data_helper($this);
} }

View file

@ -25,6 +25,7 @@ class phpbb_functions_content_phpbb_format_quote_test extends phpbb_test_case
$lang_file_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); $lang_file_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx);
$this->lang = new \phpbb\language\language($lang_file_loader); $this->lang = new \phpbb\language\language($lang_file_loader);
$user = new \phpbb\user($this->lang, '\phpbb\datetime'); $user = new \phpbb\user($this->lang, '\phpbb\datetime');
$user->data['user_options'] = 230271;
$cache = new phpbb_mock_cache(); $cache = new phpbb_mock_cache();
parent::setUp(); parent::setUp();

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_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx);
$lang = new \phpbb\language\language($lang_loader); $lang = new \phpbb\language\language($lang_loader);
$user = new \phpbb\user($lang, '\phpbb\datetime'); $user = new \phpbb\user($lang, '\phpbb\datetime');
$user->data['user_id'] = 0;
$user->data['user_type'] = USER_NORMAL;
$this->user = $user; $this->user = $user;
$this->user_loader = new \phpbb\user_loader($this->db, $phpbb_root_path, $phpEx, 'phpbb_users'); $this->user_loader = new \phpbb\user_loader($this->db, $phpbb_root_path, $phpEx, 'phpbb_users');
$auth = $this->auth = new phpbb_mock_notifications_auth(); $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) 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 = [ $notification_options = [
'item_id' => $post_data['post_id'], 'item_id' => $post_data['post_id'],
'item_parent_id' => $post_data['topic_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', 'post_subject' => 'Re: test-title',
'forum_id' => 2, 'forum_id' => 2,
'forum_name' => 'Your first forum', '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( $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', 'post_subject' => 'Re: test-title',
'forum_id' => 2, 'forum_id' => 2,
'forum_name' => 'Your first forum', 'forum_name' => 'Your first forum',
'post_username' => '',
'post_text' => 'test text',
)); ));
$this->notifications->delete_subscription('test'); $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 'post_subject' => 'Re: test-title2', // change post_subject
'forum_id' => 3, // change forum_id 'forum_id' => 3, // change forum_id
'forum_name' => 'Your second forum', // change forum_name 'forum_name' => 'Your second forum', // change forum_name
'post_username' => '',
'post_text' => 'test text2',
'post_time' => 1349413325,
)); ));
$this->assert_notifications( $this->assert_notifications(

View file

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

View file

@ -135,9 +135,10 @@ class phpbb_notification_submit_post_type_topic_test extends phpbb_notification_
$this->db->sql_freeresult($result); $this->db->sql_freeresult($result);
$result = $this->db->sql_query( $result = $this->db->sql_query(
'SELECT * '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 . ' FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t
WHERE post_id = ' . $reply_id); 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( $reply_edit_data = array_merge($this->post_data, $this->db->sql_fetchrow($result), array(
'force_approved_state' => false, 'force_approved_state' => false,
'post_edit_reason' => 'PHPBB3-12370', '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_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx);
$lang = new \phpbb\language\language($lang_loader); $lang = new \phpbb\language\language($lang_loader);
$user = new \phpbb\user($lang, '\phpbb\datetime'); $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'); $lang->add_lang('common');
$user_loader = new phpbb\user_loader($db, $phpbb_root_path, $phpEx, USERS_TABLE); $user_loader = new phpbb\user_loader($db, $phpbb_root_path, $phpEx, USERS_TABLE);

View file

@ -66,6 +66,8 @@ class manager_test extends phpbb_database_test_case
$language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)); $language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx));
$collection = new \phpbb\di\service_collection($container); $collection = new \phpbb\di\service_collection($container);
$user = new \phpbb\user($language, '\phpbb\datetime'); $user = new \phpbb\user($language, '\phpbb\datetime');
$user->data['user_id'] = 2;
$user->ip = '';
$this->log = new \phpbb\log\log($this->db, $user, $auth, $dispatcher, $phpbb_root_path, 'adm/', $phpEx, $table_prefix . 'log'); $this->log = new \phpbb\log\log($this->db, $user, $auth, $dispatcher, $phpbb_root_path, 'adm/', $phpEx, $table_prefix . 'log');

View file

@ -67,8 +67,10 @@ class phpbb_profilefield_type_bool_test extends phpbb_test_case
'lang_id' => 1, 'lang_id' => 1,
'lang_name' => 'field', 'lang_name' => 'field',
'field_required' => false, 'field_required' => false,
'field_default_value' => 1, 'field_default_value' => 1,
'field_length' => 1, 'field_length' => 1,
'field_show_novalue' => null,
'field_novalue' => null,
); );
$this->options = array( $this->options = array(

View file

@ -61,6 +61,8 @@ class phpbb_profilefield_type_date_test extends phpbb_test_case
'lang_id' => 1, 'lang_id' => 1,
'lang_name' => 'field', 'lang_name' => 'field',
'field_required' => false, 'field_required' => false,
'field_show_novalue' => null,
'field_novalue' => null,
); );
} }

View file

@ -69,6 +69,7 @@ class phpbb_profilefield_type_dropdown_test extends phpbb_test_case
'field_required' => false, 'field_required' => false,
'field_validation' => '.*', 'field_validation' => '.*',
'field_novalue' => 0, 'field_novalue' => 0,
'field_show_novalue' => null,
); );
$this->dropdown_options = array( $this->dropdown_options = array(
@ -156,7 +157,7 @@ class phpbb_profilefield_type_dropdown_test extends phpbb_test_case
'Field should output nothing for empty value', 'Field should output nothing for empty value',
), ),
array( array(
'', null, // Since PHP 8, '' == 0 returns false, hence use null instead of '' (empty string)
array('field_show_novalue' => false), array('field_show_novalue' => false),
null, null,
'Field should simply output null for empty value', 'Field should simply output null for empty value',
@ -187,7 +188,7 @@ class phpbb_profilefield_type_dropdown_test extends phpbb_test_case
'Field should return the correct raw value', 'Field should return the correct raw value',
), ),
array( array(
'', null, // Since PHP 8, '' == 0 returns false, hence use null instead of '' (empty string)
array('field_show_novalue' => false), array('field_show_novalue' => false),
null, null,
'Field should null for empty value without show_novalue', 'Field should null for empty value without show_novalue',

View file

@ -50,6 +50,10 @@ class phpbb_profilefield_type_int_test extends phpbb_test_case
'lang_id' => 1, 'lang_id' => 1,
'lang_name' => 'field', 'lang_name' => 'field',
'field_required' => false, 'field_required' => false,
'field_show_novalue' => null,
'field_novalue' => null,
'field_minlen' => null,
'field_maxlen' => null,
); );
} }

View file

@ -53,6 +53,10 @@ class phpbb_profilefield_type_string_test extends phpbb_test_case
'lang_name' => 'field', 'lang_name' => 'field',
'field_required' => false, 'field_required' => false,
'field_validation' => '.*', 'field_validation' => '.*',
'field_show_novalue' => null,
'field_novalue' => null,
'field_minlen' => null,
'field_maxlen' => null,
); );
} }

View file

@ -56,6 +56,10 @@ class phpbb_profilefield_type_url_test extends phpbb_test_case
'lang_id' => 1, 'lang_id' => 1,
'lang_name' => 'field', 'lang_name' => 'field',
'field_required' => false, 'field_required' => false,
'field_show_novalue' => null,
'field_novalue' => null,
'field_minlen' => null,
'field_maxlen' => null,
); );
} }

View file

@ -43,6 +43,16 @@ class phpbb_session_check_ban_test extends phpbb_session_test_case
parent::setUp(); parent::setUp();
// Get session here so that config is mocked correctly // Get session here so that config is mocked correctly
$this->session = $this->session_factory->get_session($this->db); $this->session = $this->session_factory->get_session($this->db);
$this->session->data['user_id'] = ANONYMOUS; // Don't get into the session_kill() procedure
$this->session->lang = [
'BOARD_BAN_TIME' => 'BOARD_BAN_TIME',
'BOARD_BAN_PERM' => 'BOARD_BAN_PERM',
'BOARD_BAN_REASON' => 'BOARD_BAN_REASON',
'BAN_TRIGGERED_BY_EMAIL' => 'BAN_TRIGGERED_BY_EMAIL',
'BAN_TRIGGERED_BY_IP' => 'BAN_TRIGGERED_BY_IP',
'BAN_TRIGGERED_BY_USER' => 'BAN_TRIGGERED_BY_USER',
];
global $cache, $config, $phpbb_root_path, $phpEx, $phpbb_filesystem; global $cache, $config, $phpbb_root_path, $phpEx, $phpbb_filesystem;
$phpbb_filesystem = new \phpbb\filesystem\filesystem(); $phpbb_filesystem = new \phpbb\filesystem\filesystem();

View file

@ -34,6 +34,8 @@ class phpbb_session_login_keys_test extends phpbb_session_test_case
$session->cookie_data['k'] = $this->key_id; $session->cookie_data['k'] = $this->key_id;
// Try to access session with the session key // Try to access session with the session key
global $request, $symfony_request, $phpbb_filesystem, $phpbb_root_path;
$session->page = $session->extract_current_page($phpbb_root_path);
$session->session_create(false, false, false); $session->session_create(false, false, false);
$this->assertEquals($this->user_id, $session->data['user_id'], 'User should be logged in by the session key'); $this->assertEquals($this->user_id, $session->data['user_id'], 'User should be logged in by the session key');
} }
@ -45,6 +47,8 @@ class phpbb_session_login_keys_test extends phpbb_session_test_case
$session = $this->session_factory->get_session($this->db); $session = $this->session_factory->get_session($this->db);
// Reset of the keys for this user // Reset of the keys for this user
$session->cookie_data['k'] = $this->key_id;
$session->data['user_id'] = $this->user_id;
$session->reset_login_keys($this->user_id); $session->reset_login_keys($this->user_id);
// Using a user_id and key that was in the database (before reset) // Using a user_id and key that was in the database (before reset)
@ -52,6 +56,8 @@ class phpbb_session_login_keys_test extends phpbb_session_test_case
$session->cookie_data['k'] = $this->key_id; $session->cookie_data['k'] = $this->key_id;
// Try to access session with the session key // Try to access session with the session key
global $request, $symfony_request, $phpbb_filesystem, $phpbb_root_path;
$session->page = $session->extract_current_page($phpbb_root_path);
$session->session_create(false, false, $this->user_id); $session->session_create(false, false, $this->user_id);
$this->assertNotEquals($this->user_id, $session->data['user_id'], 'User is not logged in because the session key is invalid'); $this->assertNotEquals($this->user_id, $session->data['user_id'], 'User is not logged in because the session key is invalid');

View file

@ -94,10 +94,12 @@ class phpbb_session_testable_facade
$this->session_factory->merge_config_data($config_overrides); $this->session_factory->merge_config_data($config_overrides);
// Bots // Bots
$this->session_factory->merge_cache_data(array('_bots' => $bot_overrides)); $this->session_factory->merge_cache_data(array('_bots' => $bot_overrides));
global $request; global $request, $symfony_request, $phpbb_filesystem, $phpbb_root_path;
$session = $this->session_factory->get_session($this->db); $session = $this->session_factory->get_session($this->db);
$session->browser = $user_agent; $session->browser = $user_agent;
$session->ip = $ip_address; $session->ip = $ip_address;
$session->page = $session->extract_current_page($phpbb_root_path);
// Uri sid // Uri sid
if ($uri_sid) if ($uri_sid)
{ {

View file

@ -32,6 +32,8 @@ class phpbb_template_extension_test extends phpbb_template_template_test_case
global $auth, $request, $symfony_request, $user; global $auth, $request, $symfony_request, $user;
$user = new phpbb_mock_user(); $user = new phpbb_mock_user();
$user->optionset('user_id', 2); $user->optionset('user_id', 2);
$user->style['style_path'] = '';
$user->data['user_id'] = 2;
$auth = $this->getMockBuilder('phpbb\auth\auth') $auth = $this->getMockBuilder('phpbb\auth\auth')
->disableOriginalConstructor() ->disableOriginalConstructor()
->setMethods(['acl_get']) ->setMethods(['acl_get'])

View file

@ -493,7 +493,8 @@ class phpbb_template_template_test extends phpbb_template_template_test_case
array( array(
'loop_expressions.html', 'loop_expressions.html',
array(), array(),
array('loop' => array(array(),array(),array(),array(),array(),array()),), // Do not use 'loop' as a block name to not override Twig's internal 'loop' object
array('loop1' => array(array(),array(),array(),array(),array(),array()),),
array(), array(),
'yesnononoyesnoyesnonoyesnono', 'yesnononoyesnoyesnonoyesnono',
), ),

View file

@ -1,11 +1,11 @@
<!-- BEGIN loop --> <!-- BEGIN loop1 -->
<!-- IF loop.S_ROW_NUM is divisible by(4) -->yes<!-- ELSE -->no<!-- ENDIF --> <!-- IF loop1.S_ROW_NUM is divisible by(4) -->yes<!-- ELSE -->no<!-- ENDIF -->
<!-- END loop --> <!-- END loop1 -->
<!-- BEGIN loop --> <!-- BEGIN loop1 -->
<!-- IF loop.S_ROW_NUM is divisible by(3) -->yes<!-- ELSE -->no<!-- ENDIF --> <!-- IF loop1.S_ROW_NUM is divisible by(3) -->yes<!-- ELSE -->no<!-- ENDIF -->
<!-- END loop --> <!-- END loop1 -->

View file

@ -725,6 +725,8 @@ class phpbb_functional_test_case extends phpbb_test_case
new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
'\phpbb\datetime' '\phpbb\datetime'
)); ));
$user->data['user_id'] = 2; // admin
$user->ip = '';
$auth = $this->createMock('\phpbb\auth\auth'); $auth = $this->createMock('\phpbb\auth\auth');
$phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); $phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE);
@ -762,6 +764,8 @@ class phpbb_functional_test_case extends phpbb_test_case
new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
'\phpbb\datetime' '\phpbb\datetime'
)); ));
$user->data['user_id'] = 2; // admin
$user->ip = '';
$auth = $this->createMock('\phpbb\auth\auth'); $auth = $this->createMock('\phpbb\auth\auth');
$phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); $phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE);

View file

@ -531,6 +531,14 @@ class phpbb_test_case_helpers
if ($container->has('user')) if ($container->has('user'))
{ {
$user = $container->get('user'); $user = $container->get('user');
// Set default required user data if not set
$user->data['is_bot'] = $user->data['is_bot'] ?? false;
$user->data['is_registered'] = $user->data['is_registered'] ?? false;
$user->data['style_id'] = $user->data['style_id'] ?? 1;
$user->data['user_id'] = $user->data['user_id'] ?? ANONYMOUS;
$user->data['user_options'] = $user->data['user_options'] ?? 230271;
$user->style['style_id'] = $user->style['style_id'] ?? 1;
} }
else else
{ {
@ -545,6 +553,14 @@ class phpbb_test_case_helpers
->method('format_date') ->method('format_date')
->will($this->test_case->returnCallback(__CLASS__ . '::format_date')); ->will($this->test_case->returnCallback(__CLASS__ . '::format_date'));
// Set default required user data
$user->data['is_bot'] = false;
$user->data['is_registered'] = false;
$user->data['style_id'] = 1;
$user->data['user_id'] = ANONYMOUS;
$user->data['user_options'] = 230271;
$user->style['style_id'] = 1;
$user->date_format = 'Y-m-d H:i:s'; $user->date_format = 'Y-m-d H:i:s';
$user->optionset('viewcensors', true); $user->optionset('viewcensors', true);
$user->optionset('viewflash', true); $user->optionset('viewflash', true);
@ -555,11 +571,6 @@ class phpbb_test_case_helpers
} }
$user->add_lang('common'); $user->add_lang('common');
if (!isset($user->style))
{
$user->style = array('style_id' => 1);
}
// Create and register a quote_helper // Create and register a quote_helper
$quote_helper = new \phpbb\textformatter\s9e\quote_helper( $quote_helper = new \phpbb\textformatter\s9e\quote_helper(
$container->get('user'), $container->get('user'),

View file

@ -61,7 +61,10 @@ class phpbb_textformatter_s9e_renderer_test extends phpbb_test_case
->getMock(); ->getMock();
$factory->expects($this->once()) $factory->expects($this->once())
->method('regenerate') ->method('regenerate')
->will($this->returnValue(array('parser' => $mock))); ->will($this->returnValue([
'parser' => $mock,
'renderer' => $mock,
]));
$renderer = new \phpbb\textformatter\s9e\renderer( $renderer = new \phpbb\textformatter\s9e\renderer(
$cache, $cache,
@ -160,6 +163,7 @@ class phpbb_textformatter_s9e_renderer_test extends phpbb_test_case
$lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx);
$lang = new \phpbb\language\language($lang_loader); $lang = new \phpbb\language\language($lang_loader);
$user = new \phpbb\user($lang, '\phpbb\datetime'); $user = new \phpbb\user($lang, '\phpbb\datetime');
$user->data['user_options'] = 230271;
$user->optionset('viewcensors', false); $user->optionset('viewcensors', false);
$phpbb_container->set('user', $user); $phpbb_container->set('user', $user);
@ -175,6 +179,7 @@ class phpbb_textformatter_s9e_renderer_test extends phpbb_test_case
$lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx);
$lang = new \phpbb\language\language($lang_loader); $lang = new \phpbb\language\language($lang_loader);
$user = new \phpbb\user($lang, '\phpbb\datetime'); $user = new \phpbb\user($lang, '\phpbb\datetime');
$user->data['user_options'] = 230271;
$user->optionset('viewcensors', false); $user->optionset('viewcensors', false);
$config = new \phpbb\config\config(array('allow_nocensors' => true)); $config = new \phpbb\config\config(array('allow_nocensors' => true));
@ -193,6 +198,7 @@ class phpbb_textformatter_s9e_renderer_test extends phpbb_test_case
$lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx);
$lang = new \phpbb\language\language($lang_loader); $lang = new \phpbb\language\language($lang_loader);
$user = new \phpbb\user($lang, '\phpbb\datetime'); $user = new \phpbb\user($lang, '\phpbb\datetime');
$user->data['user_options'] = 230271;
$user->optionset('viewcensors', false); $user->optionset('viewcensors', false);
$config = new \phpbb\config\config(array('allow_nocensors' => true)); $config = new \phpbb\config\config(array('allow_nocensors' => true));
@ -222,6 +228,7 @@ class phpbb_textformatter_s9e_renderer_test extends phpbb_test_case
$lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx);
$lang = new \phpbb\language\language($lang_loader); $lang = new \phpbb\language\language($lang_loader);
$user = new \phpbb\user($lang, '\phpbb\datetime'); $user = new \phpbb\user($lang, '\phpbb\datetime');
$user->data['user_options'] = 230271;
$user->optionset('viewflash', false); $user->optionset('viewflash', false);
$phpbb_container->set('user', $user); $phpbb_container->set('user', $user);
@ -241,6 +248,7 @@ class phpbb_textformatter_s9e_renderer_test extends phpbb_test_case
$lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx);
$lang = new \phpbb\language\language($lang_loader); $lang = new \phpbb\language\language($lang_loader);
$user = new \phpbb\user($lang, '\phpbb\datetime'); $user = new \phpbb\user($lang, '\phpbb\datetime');
$user->data['user_options'] = 230271;
$user->optionset('viewimg', false); $user->optionset('viewimg', false);
$phpbb_container->set('user', $user); $phpbb_container->set('user', $user);
@ -260,7 +268,8 @@ class phpbb_textformatter_s9e_renderer_test extends phpbb_test_case
$lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx);
$lang = new \phpbb\language\language($lang_loader); $lang = new \phpbb\language\language($lang_loader);
$user = new \phpbb\user($lang, '\phpbb\datetime'); $user = new \phpbb\user($lang, '\phpbb\datetime');
$user->optionset('smilies', false); $user->data['user_options'] = 230271;
$user->optionset('viewsmilies', false);
$phpbb_container->set('user', $user); $phpbb_container->set('user', $user);
} }

View file

@ -37,6 +37,7 @@ class phpbb_text_processing_generate_text_for_display_test extends phpbb_test_ca
$lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx);
$lang = new \phpbb\language\language($lang_loader); $lang = new \phpbb\language\language($lang_loader);
$user = new \phpbb\user($lang, '\phpbb\datetime'); $user = new \phpbb\user($lang, '\phpbb\datetime');
$user->data['user_options'] = 230271;
$user->optionset('viewcensors', true); $user->optionset('viewcensors', true);
$user->optionset('viewflash', true); $user->optionset('viewflash', true);
$user->optionset('viewimg', true); $user->optionset('viewimg', true);
@ -72,6 +73,7 @@ class phpbb_text_processing_generate_text_for_display_test extends phpbb_test_ca
$lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx);
$lang = new \phpbb\language\language($lang_loader); $lang = new \phpbb\language\language($lang_loader);
$user = new \phpbb\user($lang, '\phpbb\datetime'); $user = new \phpbb\user($lang, '\phpbb\datetime');
$user->data['user_options'] = 230271;
// Do not ignore word censoring by user (switch censoring on in UCP) // Do not ignore word censoring by user (switch censoring on in UCP)
$user->optionset('viewcensors', true); $user->optionset('viewcensors', true);
@ -172,6 +174,7 @@ class phpbb_text_processing_generate_text_for_display_test extends phpbb_test_ca
$lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx);
$lang = new \phpbb\language\language($lang_loader); $lang = new \phpbb\language\language($lang_loader);
$user = new \phpbb\user($lang, '\phpbb\datetime'); $user = new \phpbb\user($lang, '\phpbb\datetime');
$user->data['user_options'] = 230271;
$user->optionset('viewflash', false); $user->optionset('viewflash', false);
$phpbb_container->set('user', $user); $phpbb_container->set('user', $user);
@ -192,6 +195,7 @@ class phpbb_text_processing_generate_text_for_display_test extends phpbb_test_ca
$lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx);
$lang = new \phpbb\language\language($lang_loader); $lang = new \phpbb\language\language($lang_loader);
$user = new \phpbb\user($lang, '\phpbb\datetime'); $user = new \phpbb\user($lang, '\phpbb\datetime');
$user->data['user_options'] = 230271;
$user->optionset('viewimg', false); $user->optionset('viewimg', false);
$phpbb_container->set('user', $user); $phpbb_container->set('user', $user);
@ -212,7 +216,8 @@ class phpbb_text_processing_generate_text_for_display_test extends phpbb_test_ca
$lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx);
$lang = new \phpbb\language\language($lang_loader); $lang = new \phpbb\language\language($lang_loader);
$user = new \phpbb\user($lang, '\phpbb\datetime'); $user = new \phpbb\user($lang, '\phpbb\datetime');
$user->optionset('smilies', false); $user->data['user_options'] = 230271;
$user->optionset('viewsmilies', false);
$phpbb_container->set('user', $user); $phpbb_container->set('user', $user);
} }

View file

@ -183,7 +183,13 @@ class phpbb_fileupload_test extends phpbb_test_case
->set_max_filesize(1000); ->set_max_filesize(1000);
copy($this->path . 'jpg', $this->path . 'jpg.jpg'); copy($this->path . 'jpg', $this->path . 'jpg.jpg');
$file = $upload->handle_upload('files.types.local', $this->path . 'jpg.jpg'); // Upload file data should be set to prevent "Undefined array key" PHP 8 warning
$filedata = [
'size' => 519,
'realname' => $this->path . 'jpg.jpg',
'type' => false,
];
$file = $upload->handle_upload('files.types.local', $this->path . 'jpg.jpg', $filedata);
$this->assertEquals(0, count($file->error)); $this->assertEquals(0, count($file->error));
$this->assertFalse($file->additional_checks()); $this->assertFalse($file->additional_checks());
$this->assertTrue($file->move_file('../tests/upload/fixture/copies', true)); $this->assertTrue($file->move_file('../tests/upload/fixture/copies', true));
@ -197,7 +203,13 @@ class phpbb_fileupload_test extends phpbb_test_case
->set_max_filesize(1000); ->set_max_filesize(1000);
copy($this->path . 'jpg', $this->path . 'jpg.jpg'); copy($this->path . 'jpg', $this->path . 'jpg.jpg');
$file = $upload->handle_upload('files.types.local', $this->path . 'jpg.jpg'); // Upload file data should be set to prevent "Undefined array key" PHP 8 warning
$filedata = [
'size' => 519,
'realname' => $this->path . 'jpg.jpg',
'type' => false,
];
$file = $upload->handle_upload('files.types.local', $this->path . 'jpg.jpg', $filedata);
$this->assertEquals(0, count($file->error)); $this->assertEquals(0, count($file->error));
$this->assertFalse($file->move_file('../tests/upload/fixture')); $this->assertFalse($file->move_file('../tests/upload/fixture'));
$this->assertFalse($file->get('file_moved')); $this->assertFalse($file->get('file_moved'));
@ -212,7 +224,13 @@ class phpbb_fileupload_test extends phpbb_test_case
copy($this->path . 'jpg', $this->path . 'jpg.jpg'); copy($this->path . 'jpg', $this->path . 'jpg.jpg');
copy($this->path . 'jpg', $this->path . 'copies/jpg.jpg'); copy($this->path . 'jpg', $this->path . 'copies/jpg.jpg');
$file = $upload->handle_upload('files.types.local', $this->path . 'jpg.jpg'); // Upload file data should be set to prevent "Undefined array key" PHP 8 warning
$filedata = [
'size' => 519,
'realname' => $this->path . 'jpg.jpg',
'type' => false,
];
$file = $upload->handle_upload('files.types.local', $this->path . 'jpg.jpg', $filedata);
$this->assertEquals(0, count($file->error)); $this->assertEquals(0, count($file->error));
$file->move_file('../tests/upload/fixture/copies', true); $file->move_file('../tests/upload/fixture/copies', true);
$this->assertEquals(0, count($file->error)); $this->assertEquals(0, count($file->error));

View file

@ -350,13 +350,19 @@ class phpbb_version_helper_test extends phpbb_test_case
array( array(
'1.0' => array( '1.0' => array(
'current' => '1.0.1', 'current' => '1.0.1',
'eol' => false,
'security' => false,
), ),
'1.1' => array( '1.1' => array(
'current' => '1.1.1', 'current' => '1.1.1',
'eol' => false,
'security' => false,
), ),
), ),
array( array(
'current' => '1.0.1', 'current' => '1.0.1',
'eol' => false,
'security' => false,
), ),
), ),
array( array(
@ -364,9 +370,13 @@ class phpbb_version_helper_test extends phpbb_test_case
array( array(
'1.0' => array( '1.0' => array(
'current' => '1.0.1', 'current' => '1.0.1',
'eol' => false,
'security' => false,
), ),
'1.1' => array( '1.1' => array(
'current' => '1.1.1', 'current' => '1.1.1',
'eol' => false,
'security' => false,
), ),
), ),
array(), array(),
@ -376,13 +386,19 @@ class phpbb_version_helper_test extends phpbb_test_case
array( array(
'1.0' => array( '1.0' => array(
'current' => '1.0.1-a2', 'current' => '1.0.1-a2',
'eol' => false,
'security' => false,
), ),
'1.1' => array( '1.1' => array(
'current' => '1.1.0', 'current' => '1.1.0',
'eol' => false,
'security' => false,
), ),
), ),
array( array(
'current' => '1.0.1-a2', 'current' => '1.0.1-a2',
'eol' => false,
'security' => false,
), ),
), ),
array( array(
@ -390,13 +406,19 @@ class phpbb_version_helper_test extends phpbb_test_case
array( array(
'1.0' => array( '1.0' => array(
'current' => '1.0.1', 'current' => '1.0.1',
'eol' => false,
'security' => false,
), ),
'1.1' => array( '1.1' => array(
'current' => '1.1.1', 'current' => '1.1.1',
'eol' => false,
'security' => false,
), ),
), ),
array( array(
'current' => '1.1.1', 'current' => '1.1.1',
'eol' => false,
'security' => false,
), ),
), ),
array( array(
@ -404,9 +426,13 @@ class phpbb_version_helper_test extends phpbb_test_case
array( array(
'1.0' => array( '1.0' => array(
'current' => '1.0.1', 'current' => '1.0.1',
'eol' => false,
'security' => false,
), ),
'1.1' => array( '1.1' => array(
'current' => '1.1.1', 'current' => '1.1.1',
'eol' => false,
'security' => false,
), ),
), ),
array(), array(),
@ -416,13 +442,19 @@ class phpbb_version_helper_test extends phpbb_test_case
array( array(
'1.0' => array( '1.0' => array(
'current' => '1.0.1', 'current' => '1.0.1',
'eol' => false,
'security' => false,
), ),
'1.1' => array( '1.1' => array(
'current' => '1.1.0-a2', 'current' => '1.1.0-a2',
'eol' => false,
'security' => false,
), ),
), ),
array( array(
'current' => '1.1.0-a2', 'current' => '1.1.0-a2',
'eol' => false,
'security' => false,
), ),
), ),
array( array(
@ -436,14 +468,18 @@ class phpbb_version_helper_test extends phpbb_test_case
array( array(
'1.0' => array( '1.0' => array(
'current' => '1.0.1', 'current' => '1.0.1',
'eol' => false,
'security' => '1.0.1', 'security' => '1.0.1',
), ),
'1.1' => array( '1.1' => array(
'current' => '1.1.1', 'current' => '1.1.1',
'eol' => false,
'security' => false,
), ),
), ),
array( array(
'current' => '1.0.1', 'current' => '1.0.1',
'eol' => false,
'security' => '1.0.1', 'security' => '1.0.1',
), ),
), ),
@ -453,14 +489,18 @@ class phpbb_version_helper_test extends phpbb_test_case
array( array(
'1.0' => array( '1.0' => array(
'current' => '1.0.1', 'current' => '1.0.1',
'eol' => false,
'security' => '1.0.0', 'security' => '1.0.0',
), ),
'1.1' => array( '1.1' => array(
'current' => '1.1.1', 'current' => '1.1.1',
'eol' => false,
'security' => false,
), ),
), ),
array( array(
'current' => '1.0.1', 'current' => '1.0.1',
'eol' => false,
'security' => '1.0.0', 'security' => '1.0.0',
), ),
), ),
@ -470,14 +510,19 @@ class phpbb_version_helper_test extends phpbb_test_case
array( array(
'1.0' => array( '1.0' => array(
'current' => '1.0.1', 'current' => '1.0.1',
'eol' => false,
'security' => '1.1.0', 'security' => '1.1.0',
), ),
'1.1' => array( '1.1' => array(
'current' => '1.1.1', 'current' => '1.1.1',
'eol' => false,
'security' => false,
), ),
), ),
array( array(
'current' => '1.1.1', 'current' => '1.1.1',
'eol' => false,
'security' => false,
), ),
), ),
// Latest 1.0 release is EOL // Latest 1.0 release is EOL
@ -487,13 +532,18 @@ class phpbb_version_helper_test extends phpbb_test_case
'1.0' => array( '1.0' => array(
'current' => '1.0.1', 'current' => '1.0.1',
'eol' => true, 'eol' => true,
'security' => false,
), ),
'1.1' => array( '1.1' => array(
'current' => '1.1.1', 'current' => '1.1.1',
'eol' => false,
'security' => false,
), ),
), ),
array( array(
'current' => '1.1.1', 'current' => '1.1.1',
'eol' => false,
'security' => false,
), ),
), ),
// All are EOL -- somewhat undefined behavior // All are EOL -- somewhat undefined behavior
@ -503,10 +553,12 @@ class phpbb_version_helper_test extends phpbb_test_case
'1.0' => array( '1.0' => array(
'current' => '1.0.1', 'current' => '1.0.1',
'eol' => true, 'eol' => true,
'security' => false,
), ),
'1.1' => array( '1.1' => array(
'current' => '1.1.1', 'current' => '1.1.1',
'eol' => true, 'eol' => true,
'security' => false,
), ),
), ),
array(), array(),
@ -557,10 +609,14 @@ class phpbb_version_helper_test extends phpbb_test_case
array( array(
'3.1' => array( '3.1' => array(
'current' => '1.0.1', 'current' => '1.0.1',
'eol' => false,
'security' => false,
), ),
), ),
array( array(
'current' => '1.0.1', 'current' => '1.0.1',
'eol' => false,
'security' => false,
), ),
), ),
array( array(
@ -569,6 +625,8 @@ class phpbb_version_helper_test extends phpbb_test_case
array( array(
'3.1' => array( '3.1' => array(
'current' => '1.0.1', 'current' => '1.0.1',
'eol' => false,
'security' => false,
), ),
), ),
array(), array(),
@ -579,10 +637,14 @@ class phpbb_version_helper_test extends phpbb_test_case
array( array(
'3.2' => array( '3.2' => array(
'current' => '1.1.1', 'current' => '1.1.1',
'eol' => false,
'security' => false,
), ),
), ),
array( array(
'current' => '1.1.1', 'current' => '1.1.1',
'eol' => false,
'security' => false,
), ),
), ),
array( array(
@ -591,6 +653,8 @@ class phpbb_version_helper_test extends phpbb_test_case
array( array(
'3.2' => array( '3.2' => array(
'current' => '1.1.1', 'current' => '1.1.1',
'eol' => false,
'security' => false,
), ),
), ),
array(), array(),
@ -602,10 +666,14 @@ class phpbb_version_helper_test extends phpbb_test_case
array( array(
'3.2' => array( '3.2' => array(
'current' => '1.1.1', 'current' => '1.1.1',
'eol' => false,
'security' => false,
), ),
), ),
array( array(
'current' => '1.1.1', 'current' => '1.1.1',
'eol' => false,
'security' => false,
), ),
), ),
array( array(
@ -614,6 +682,8 @@ class phpbb_version_helper_test extends phpbb_test_case
array( array(
'3.2' => array( '3.2' => array(
'current' => '1.1.1', 'current' => '1.1.1',
'eol' => false,
'security' => false,
), ),
), ),
array(), array(),
@ -624,10 +694,14 @@ class phpbb_version_helper_test extends phpbb_test_case
array( array(
'3.1' => array( '3.1' => array(
'current' => '1.0.1', 'current' => '1.0.1',
'eol' => false,
'security' => false,
), ),
), ),
array( array(
'current' => '1.0.1', 'current' => '1.0.1',
'eol' => false,
'security' => false,
), ),
), ),
array( array(
@ -636,6 +710,8 @@ class phpbb_version_helper_test extends phpbb_test_case
array( array(
'3.1' => array( '3.1' => array(
'current' => '1.0.1', 'current' => '1.0.1',
'eol' => false,
'security' => false,
), ),
), ),
array(), array(),
@ -646,10 +722,14 @@ class phpbb_version_helper_test extends phpbb_test_case
array( array(
'3.2' => array( '3.2' => array(
'current' => '1.1.1', 'current' => '1.1.1',
'eol' => false,
'security' => false,
), ),
), ),
array( array(
'current' => '1.1.1', 'current' => '1.1.1',
'eol' => false,
'security' => false,
), ),
), ),
array( array(
@ -658,6 +738,8 @@ class phpbb_version_helper_test extends phpbb_test_case
array( array(
'3.2' => array( '3.2' => array(
'current' => '1.1.1', 'current' => '1.1.1',
'eol' => false,
'security' => false,
), ),
), ),
array(), array(),
@ -669,13 +751,19 @@ class phpbb_version_helper_test extends phpbb_test_case
array( array(
'3.1' => array( '3.1' => array(
'current' => '1.0.1', 'current' => '1.0.1',
'eol' => false,
'security' => false,
), ),
'3.2' => array( '3.2' => array(
'current' => '1.1.1', 'current' => '1.1.1',
'eol' => false,
'security' => false,
), ),
), ),
array( array(
'current' => '1.0.1', 'current' => '1.0.1',
'eol' => false,
'security' => false,
), ),
), ),
array( array(
@ -684,9 +772,13 @@ class phpbb_version_helper_test extends phpbb_test_case
array( array(
'3.1' => array( '3.1' => array(
'current' => '1.0.1', 'current' => '1.0.1',
'eol' => false,
'security' => false,
), ),
'3.2' => array( '3.2' => array(
'current' => '1.1.1', 'current' => '1.1.1',
'eol' => false,
'security' => false,
), ),
), ),
array(), array(),
@ -697,9 +789,13 @@ class phpbb_version_helper_test extends phpbb_test_case
array( array(
'3.1' => array( '3.1' => array(
'current' => '1.0.1', 'current' => '1.0.1',
'eol' => false,
'security' => false,
), ),
'3.2' => array( '3.2' => array(
'current' => '1.1.1', 'current' => '1.1.1',
'eol' => false,
'security' => false,
), ),
), ),
array(), array(),
@ -710,13 +806,19 @@ class phpbb_version_helper_test extends phpbb_test_case
array( array(
'3.1' => array( '3.1' => array(
'current' => '1.0.1', 'current' => '1.0.1',
'eol' => false,
'security' => false,
), ),
'3.2' => array( '3.2' => array(
'current' => '1.1.1', 'current' => '1.1.1',
'eol' => false,
'security' => false,
), ),
), ),
array( array(
'current' => '1.1.1', 'current' => '1.1.1',
'eol' => false,
'security' => false,
), ),
), ),
array( array(
@ -725,13 +827,19 @@ class phpbb_version_helper_test extends phpbb_test_case
array( array(
'3.1' => array( '3.1' => array(
'current' => '1.0.1', 'current' => '1.0.1',
'eol' => false,
'security' => false,
), ),
'3.2' => array( '3.2' => array(
'current' => '1.1.1', 'current' => '1.1.1',
'eol' => false,
'security' => false,
), ),
), ),
array( array(
'current' => '1.1.1', 'current' => '1.1.1',
'eol' => false,
'security' => false,
), ),
), ),
array( array(
@ -740,9 +848,13 @@ class phpbb_version_helper_test extends phpbb_test_case
array( array(
'3.1' => array( '3.1' => array(
'current' => '1.0.1', 'current' => '1.0.1',
'eol' => false,
'security' => false,
), ),
'3.2' => array( '3.2' => array(
'current' => '1.1.1', 'current' => '1.1.1',
'eol' => false,
'security' => false,
), ),
), ),
array(), array(),
@ -754,13 +866,19 @@ class phpbb_version_helper_test extends phpbb_test_case
array( array(
'3.1' => array( '3.1' => array(
'current' => '1.0.1', 'current' => '1.0.1',
'eol' => false,
'security' => false,
), ),
'3.2' => array( '3.2' => array(
'current' => '1.1.1', 'current' => '1.1.1',
'eol' => false,
'security' => false,
), ),
), ),
array( array(
'current' => '1.1.1', 'current' => '1.1.1',
'eol' => false,
'security' => false,
), ),
), ),
array( array(
@ -769,13 +887,19 @@ class phpbb_version_helper_test extends phpbb_test_case
array( array(
'3.1' => array( '3.1' => array(
'current' => '1.0.1', 'current' => '1.0.1',
'eol' => false,
'security' => false,
), ),
'3.2' => array( '3.2' => array(
'current' => '1.1.1', 'current' => '1.1.1',
'eol' => false,
'security' => false,
), ),
), ),
array( array(
'current' => '1.1.1', 'current' => '1.1.1',
'eol' => false,
'security' => false,
), ),
), ),
array( array(
@ -784,13 +908,19 @@ class phpbb_version_helper_test extends phpbb_test_case
array( array(
'3.1' => array( '3.1' => array(
'current' => '1.0.1', 'current' => '1.0.1',
'eol' => false,
'security' => false,
), ),
'3.2' => array( '3.2' => array(
'current' => '1.1.1', 'current' => '1.1.1',
'eol' => false,
'security' => false,
), ),
), ),
array( array(
'current' => '1.1.1', 'current' => '1.1.1',
'eol' => false,
'security' => false,
), ),
), ),
array( array(
@ -799,9 +929,13 @@ class phpbb_version_helper_test extends phpbb_test_case
array( array(
'3.1' => array( '3.1' => array(
'current' => '1.0.1', 'current' => '1.0.1',
'eol' => false,
'security' => false,
), ),
'3.2' => array( '3.2' => array(
'current' => '1.1.1', 'current' => '1.1.1',
'eol' => false,
'security' => false,
), ),
), ),
array(), array(),

View file

@ -41,6 +41,6 @@ php ../composer.phar install --dev --no-interaction
if [ "$TRAVIS_PHP_VERSION" == "nightly" ] if [ "$TRAVIS_PHP_VERSION" == "nightly" ]
then then
php ../composer.phar remove phpunit/dbunit --dev --update-with-dependencies \ php ../composer.phar remove phpunit/dbunit --dev --update-with-dependencies \
&& php ../composer.phar require symfony/yaml:~4.4 misantron/dbunit:~5.0 nikic/php-parser:~4.7 phpunit/phpunit:^9.3 --dev --update-with-all-dependencies --ignore-platform-reqs && php ../composer.phar require symfony/yaml:~4.4 misantron/dbunit:~5.0 phpunit/phpunit:^9.3 --dev --update-with-all-dependencies --ignore-platform-reqs
fi fi
cd .. cd ..