From 3563f20991d8d16bb748af080af5e0b11c14e040 Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Thu, 8 Nov 2018 20:45:17 +0100 Subject: [PATCH] [ticket/9687] Fix ban session tests for real PHPBB3-9687 --- tests/session/check_ban_test.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/tests/session/check_ban_test.php b/tests/session/check_ban_test.php index 100c039639..95ad89cacd 100644 --- a/tests/session/check_ban_test.php +++ b/tests/session/check_ban_test.php @@ -33,8 +33,6 @@ class phpbb_session_check_ban_test extends phpbb_session_test_case false, false, false, false, /* should be banned? -> */ false), array('Matching values in the database, should be banned', 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', ]; - 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(); @@ -73,6 +71,18 @@ class phpbb_session_check_ban_test extends phpbb_session_test_case $phpbb_root_path, $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