From 70e47bc9290ff0ce54b53374f703a3574c54325c Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Wed, 4 Dec 2013 13:33:19 +0100 Subject: [ticket/12056] validate_range: Fix "Creating default object from empty value" PHPBB3-12056 --- tests/functions_acp/validate_range_test.php | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) (limited to 'tests/functions_acp/validate_range_test.php') diff --git a/tests/functions_acp/validate_range_test.php b/tests/functions_acp/validate_range_test.php index 8606158251..cb028d4d07 100644 --- a/tests/functions_acp/validate_range_test.php +++ b/tests/functions_acp/validate_range_test.php @@ -12,6 +12,16 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/functions_acp.php'; class phpbb_functions_acp_validate_range_test extends phpbb_test_case { + protected function setUp() + { + parent::setUp(); + + global $user; + + $user = new phpbb_mock_user(); + $user->lang = new phpbb_mock_lang(); + } + /** * Data sets that don't throw an error. */ @@ -52,10 +62,6 @@ class phpbb_functions_acp_validate_range_test extends phpbb_test_case */ public function test_validate_range_fit($test_data) { - global $user; - - $user->lang = new phpbb_mock_lang(); - $phpbb_error = array(); validate_range($test_data, $phpbb_error); @@ -91,10 +97,6 @@ class phpbb_functions_acp_validate_range_test extends phpbb_test_case */ public function test_validate_range_too_low($test_data) { - global $user; - - $user->lang = new phpbb_mock_lang(); - $phpbb_error = array(); validate_range($test_data, $phpbb_error); @@ -130,10 +132,6 @@ class phpbb_functions_acp_validate_range_test extends phpbb_test_case */ public function test_validate_range_too_big($test_data) { - global $user; - - $user->lang = new phpbb_mock_lang(); - $phpbb_error = array(); validate_range($test_data, $phpbb_error); @@ -158,10 +156,6 @@ class phpbb_functions_acp_validate_range_test extends phpbb_test_case */ public function test_validate_range_too_long($test_data) { - global $user; - - $user->lang = new phpbb_mock_lang(); - $phpbb_error = array(); validate_range($test_data, $phpbb_error); -- cgit v1.2.1