[ticket/10714] Add global variables for the unit tests

PHPBB3-10714
This commit is contained in:
Joas Schilling 2012-12-07 16:05:57 +01:00
parent 37530abd39
commit 0f94ff9138
2 changed files with 7 additions and 3 deletions

View file

@ -142,7 +142,7 @@ class phpbb_log_function_add_log_test extends phpbb_database_test_case
*/ */
public function test_add_log_function($expected, $user_id, $mode, $required1, $additional1 = null, $additional2 = null, $additional3 = null) public function test_add_log_function($expected, $user_id, $mode, $required1, $additional1 = null, $additional2 = null, $additional3 = null)
{ {
global $db, $user, $phpbb_dispatcher; global $db, $cache, $user, $phpbb_log, $phpbb_dispatcher;
if ($expected) if ($expected)
{ {
@ -155,7 +155,9 @@ class phpbb_log_function_add_log_test extends phpbb_database_test_case
} }
$db = $this->new_dbal(); $db = $this->new_dbal();
$cache = new phpbb_mock_cache;
$phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $phpbb_dispatcher = new phpbb_mock_event_dispatcher();
$phpbb_log = new phpbb_log(LOG_TABLE);
$user->ip = 'user_ip'; $user->ip = 'user_ip';
if ($user_id) if ($user_id)

View file

@ -24,7 +24,8 @@ class phpbb_log_function_view_log_test extends phpbb_database_test_case
public static function test_view_log_function_data() public static function test_view_log_function_data()
{ {
global $phpEx; global $phpEx, $phpbb_dispatcher;
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
$expected_data_sets = array( $expected_data_sets = array(
1 => array( 1 => array(
@ -299,11 +300,12 @@ class phpbb_log_function_view_log_test extends phpbb_database_test_case
*/ */
public function test_view_log_function($expected, $expected_returned, $mode, $log_count, $limit = 5, $offset = 0, $forum_id = 0, $topic_id = 0, $user_id = 0, $limit_days = 0, $sort_by = 'l.log_id ASC', $keywords = '') public function test_view_log_function($expected, $expected_returned, $mode, $log_count, $limit = 5, $offset = 0, $forum_id = 0, $topic_id = 0, $user_id = 0, $limit_days = 0, $sort_by = 'l.log_id ASC', $keywords = '')
{ {
global $cache, $db, $user, $auth, $phpbb_dispatcher; global $cache, $db, $user, $auth, $phpbb_log, $phpbb_dispatcher;
$db = $this->new_dbal(); $db = $this->new_dbal();
$cache = new phpbb_mock_cache; $cache = new phpbb_mock_cache;
$phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $phpbb_dispatcher = new phpbb_mock_event_dispatcher();
$phpbb_log = new phpbb_log(LOGS_TABLE);
// Create auth mock // Create auth mock
$auth = $this->getMock('phpbb_auth'); $auth = $this->getMock('phpbb_auth');