mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 14:00:31 +02:00
[ticket/9687] Update deprecated notices and helper functions
PHPBB3-9687
This commit is contained in:
@@ -2,27 +2,68 @@
|
||||
<dataset>
|
||||
<table name="phpbb_bans">
|
||||
<column>ban_userid</column>
|
||||
<column>ban_mode</column>
|
||||
<column>ban_end</column>
|
||||
<row>
|
||||
<value>2</value>
|
||||
<value>0</value>
|
||||
<value>user</value>
|
||||
<value>0</value>
|
||||
</row>
|
||||
<row>
|
||||
<value>3</value>
|
||||
<value>user</value>
|
||||
<value>0</value>
|
||||
</row>
|
||||
<row>
|
||||
<value>4</value>
|
||||
<value>user</value>
|
||||
<value>2</value>
|
||||
</row>
|
||||
<row>
|
||||
<value>5</value>
|
||||
<value>999999999999999999999</value>
|
||||
<value>user</value>
|
||||
<value>2147485547</value>
|
||||
</row>
|
||||
<row>
|
||||
<value>6</value>
|
||||
<value>user</value>
|
||||
<value>3</value>
|
||||
</row>
|
||||
</table>
|
||||
<table name="phpbb_users">
|
||||
<column>user_id</column>
|
||||
<column>username_clean</column>
|
||||
<column>user_permissions</column>
|
||||
<column>user_sig</column>
|
||||
<row>
|
||||
<value>2</value>
|
||||
<value>admin</value>
|
||||
<value></value>
|
||||
<value></value>
|
||||
</row>
|
||||
<row>
|
||||
<value>3</value>
|
||||
<value>user3</value>
|
||||
<value></value>
|
||||
<value></value>
|
||||
</row>
|
||||
<row>
|
||||
<value>4</value>
|
||||
<value>user4</value>
|
||||
<value></value>
|
||||
<value></value>
|
||||
</row>
|
||||
<row>
|
||||
<value>5</value>
|
||||
<value>user5</value>
|
||||
<value></value>
|
||||
<value></value>
|
||||
</row>
|
||||
<row>
|
||||
<value>6</value>
|
||||
<value>user6</value>
|
||||
<value></value>
|
||||
<value></value>
|
||||
</row>
|
||||
</table>
|
||||
</dataset>
|
||||
|
@@ -20,6 +20,47 @@ class phpbb_get_banned_user_ids_test extends phpbb_database_test_case
|
||||
return $this->createXMLDataSet(__DIR__ . '/fixtures/banned_users.xml');
|
||||
}
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
global $db, $phpbb_container, $phpbb_root_path, $phpEx;
|
||||
|
||||
$db = $this->new_dbal();
|
||||
|
||||
parent::setUp();
|
||||
|
||||
$phpbb_container = new phpbb_mock_container_builder();
|
||||
$config = new \phpbb\config\config([]);
|
||||
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||
$language = new phpbb\language\language(new phpbb\language\language_file_loader($phpbb_root_path, $phpEx));
|
||||
$user = new phpbb\user($language, '\phpbb\datetime');
|
||||
$user->data['user_email'] = '';
|
||||
|
||||
$cache = new \phpbb\cache\service(
|
||||
new \phpbb\cache\driver\dummy(),
|
||||
$config,
|
||||
$db,
|
||||
$phpbb_dispatcher,
|
||||
$phpbb_root_path,
|
||||
$phpEx
|
||||
);
|
||||
$cache->get_driver()->purge();
|
||||
|
||||
$ban_type_email = new \phpbb\ban\type\email($db, 'phpbb_bans', 'phpbb_users', 'phpbb_sessions', 'phpbb_sessions_keys');
|
||||
$ban_type_user = new \phpbb\ban\type\user($db, 'phpbb_bans', 'phpbb_users', 'phpbb_sessions', 'phpbb_sessions_keys');
|
||||
$ban_type_ip = new \phpbb\ban\type\ip($db, 'phpbb_bans', 'phpbb_users', 'phpbb_sessions', 'phpbb_sessions_keys');
|
||||
$phpbb_container->set('ban.type.email', $ban_type_email);
|
||||
$phpbb_container->set('ban.type.user', $ban_type_user);
|
||||
$phpbb_container->set('ban.type.ip', $ban_type_ip);
|
||||
$collection = new \phpbb\di\service_collection($phpbb_container);
|
||||
$collection->add('ban.type.email');
|
||||
$collection->add('ban.type.user');
|
||||
$collection->add('ban.type.ip');
|
||||
$phpbb_log = new \phpbb\log\dummy();
|
||||
|
||||
$ban_manager = new \phpbb\ban\manager($collection, $cache->get_driver(), $db, $language, $phpbb_log, $user, 'phpbb_bans', 'phpbb_users');
|
||||
$phpbb_container->set('ban.manager', $ban_manager);
|
||||
}
|
||||
|
||||
public function phpbb_get_banned_user_ids_data()
|
||||
{
|
||||
return array(
|
||||
@@ -35,6 +76,11 @@ class phpbb_get_banned_user_ids_test extends phpbb_database_test_case
|
||||
array(array(1, 2, 4, 5, 6), false),
|
||||
array(2 => 2),
|
||||
),
|
||||
array(
|
||||
// True to get users currently banned, but should only return passed user IDs
|
||||
array(array(5, 6, 7), true),
|
||||
array(5 => 5),
|
||||
),
|
||||
array(
|
||||
// Unix timestamp to get users banned until that time
|
||||
array(array(1, 2, 4, 5, 6), 2),
|
||||
@@ -43,15 +89,6 @@ class phpbb_get_banned_user_ids_test extends phpbb_database_test_case
|
||||
);
|
||||
}
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
global $db;
|
||||
|
||||
$db = $this->new_dbal();
|
||||
|
||||
parent::setUp();
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider phpbb_get_banned_user_ids_data
|
||||
*/
|
||||
|
Reference in New Issue
Block a user