From af3a4ee33a148c864c30d22a2031cfc7e1b7bcf3 Mon Sep 17 00:00:00 2001 From: asperous Date: Fri, 12 Jul 2013 13:04:09 -0700 Subject: [ticket/11620] Fixed check_ban_test errors with cache and ban warning message PHPBB3-11620 --- tests/session/check_ban_test.php | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'tests/session') diff --git a/tests/session/check_ban_test.php b/tests/session/check_ban_test.php index 6795338f23..6ff688ee3d 100644 --- a/tests/session/check_ban_test.php +++ b/tests/session/check_ban_test.php @@ -38,14 +38,26 @@ class phpbb_session_check_ban_test extends phpbb_session_test_case // Change the global cache object for this test because // the mock cache object does not hit the database as is // needed for this test. - global $cache; - $old_cache = $cache; - $cache = new phpbb_cache_driver_file(); + global $cache, $config, $phpbb_root_path, $php_ext; + $cache = new phpbb_cache_service( + new phpbb_cache_driver_file(), + $config, + $this->db, + $phpbb_root_path, + $php_ext + ); - $is_banned = - $session->check_ban($user_id, $user_ips, $user_email, $return); + try + { + $is_banned = + $session->check_ban($user_id, $user_ips, $user_email, $return); + } catch (PHPUnit_Framework_Error_Notice $e) + { + // User error was triggered, user must have been banned + $is_banned = true; + } $this->assertEquals($should_be_banned, $is_banned, $test_msg); - $cache = $old_cache; + $cache = new phpbb_mock_cache(); } } -- cgit v1.2.1