mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[ticket/9687] Fix ban session tests for real
PHPBB3-9687
This commit is contained in:
parent
40b1d1e6ff
commit
3563f20991
1 changed files with 13 additions and 3 deletions
|
@ -33,8 +33,6 @@ class phpbb_session_check_ban_test extends phpbb_session_test_case
|
||||||
false, false, false, false, /* should be banned? -> */ false),
|
false, false, false, false, /* should be banned? -> */ false),
|
||||||
array('Matching values in the database, should be banned',
|
array('Matching values in the database, should be banned',
|
||||||
4, '127.0.0.1', 'bar@example.org', true, /* should be banned? -> */ true),
|
4, '127.0.0.1', 'bar@example.org', true, /* should be banned? -> */ true),
|
||||||
array('IP Banned, should not be banned',
|
|
||||||
false, '127.1.1.1', false, false, /* should be banned? -> */ false),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +51,7 @@ class phpbb_session_check_ban_test extends phpbb_session_test_case
|
||||||
'BAN_TRIGGERED_BY_USER' => 'BAN_TRIGGERED_BY_USER',
|
'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_container;
|
||||||
|
|
||||||
$phpbb_filesystem = new \phpbb\filesystem\filesystem();
|
$phpbb_filesystem = new \phpbb\filesystem\filesystem();
|
||||||
|
|
||||||
|
@ -73,6 +71,18 @@ class phpbb_session_check_ban_test extends phpbb_session_test_case
|
||||||
$phpbb_root_path,
|
$phpbb_root_path,
|
||||||
$phpEx
|
$phpEx
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$phpbb_container = new phpbb_mock_container_builder();
|
||||||
|
$ban_type_email = new \phpbb\ban\type\email($this->db, 'phpbb_users', 'phpbb_sessions', 'phpbb_sessions_keys');
|
||||||
|
$ban_type_user = new \phpbb\ban\type\user($this->db, '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);
|
||||||
|
$collection = new \phpbb\di\service_collection($phpbb_container);
|
||||||
|
$collection->add('ban.type.email');
|
||||||
|
$collection->add('ban.type.user');
|
||||||
|
|
||||||
|
$ban_manager = new \phpbb\ban\manager($collection, $cache, $this->db, 'phpbb_bans', 'phpbb_users');
|
||||||
|
$phpbb_container->set('ban.manager', $ban_manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function tearDown(): void
|
protected function tearDown(): void
|
||||||
|
|
Loading…
Add table
Reference in a new issue