diff options
author | Andy Chase <asperous2@gmail.com> | 2013-07-22 17:39:45 -0700 |
---|---|---|
committer | Andy Chase <asperous2@gmail.com> | 2013-07-22 17:39:45 -0700 |
commit | 2fe2724e684304e1c8323c047d1dde6cd732afcd (patch) | |
tree | cf52d225f5996ea9706aa5bad2d547098e94a648 | |
parent | 0c54fb034b71cfc2bff338430acb1e2b43083dd5 (diff) | |
download | forums-2fe2724e684304e1c8323c047d1dde6cd732afcd.tar forums-2fe2724e684304e1c8323c047d1dde6cd732afcd.tar.gz forums-2fe2724e684304e1c8323c047d1dde6cd732afcd.tar.bz2 forums-2fe2724e684304e1c8323c047d1dde6cd732afcd.tar.xz forums-2fe2724e684304e1c8323c047d1dde6cd732afcd.zip |
[ticket/11620] Whitespace and combine function into test_case
PHPBB3-11620
-rw-r--r-- | tests/mock/auth_provider.php | 8 | ||||
-rw-r--r-- | tests/session/check_isvalid_test.php | 13 | ||||
-rw-r--r-- | tests/session/create_test.php | 2 | ||||
-rw-r--r-- | tests/session/garbage_collection_test.php | 22 | ||||
-rw-r--r-- | tests/session/testable_facade.php | 8 | ||||
-rw-r--r-- | tests/session/validate_referrer_test.php | 7 | ||||
-rw-r--r-- | tests/test_framework/phpbb_session_test_case.php | 9 |
7 files changed, 30 insertions, 39 deletions
diff --git a/tests/mock/auth_provider.php b/tests/mock/auth_provider.php index e0a2abd2d5..9d002334d6 100644 --- a/tests/mock/auth_provider.php +++ b/tests/mock/auth_provider.php @@ -20,10 +20,10 @@ class phpbb_mock_auth_provider implements phpbb_auth_provider_interface function login($username, $password) { return array( - 'status' => "", - 'error_msg' => "", - 'user_row' => "", - ); + 'status' => "", + 'error_msg' => "", + 'user_row' => "", + ); } function autologin() diff --git a/tests/session/check_isvalid_test.php b/tests/session/check_isvalid_test.php index c60770dad8..760e2a6f24 100644 --- a/tests/session/check_isvalid_test.php +++ b/tests/session/check_isvalid_test.php @@ -28,21 +28,12 @@ class phpbb_session_check_isvalid_test extends phpbb_session_test_case return $session; } - protected function check_session_equals($expected_sessions, $message) - { - $sql = 'SELECT session_id, session_user_id - FROM phpbb_sessions - ORDER BY session_user_id'; - - $this->assertSqlResultEquals($expected_sessions, $sql, $message); - } - public function test_session_valid_session_exists() { $session = $this->access_with('bar_session000000000000000000000', '4', 'user agent', '127.0.0.1'); $session->check_cookies($this, array()); - $this->check_session_equals(array( + $this->check_sessions_equals(array( array('session_id' => 'anon_session00000000000000000000', 'session_user_id' => 1), array('session_id' => 'bar_session000000000000000000000', 'session_user_id' => 4), ), @@ -59,7 +50,7 @@ class phpbb_session_check_isvalid_test extends phpbb_session_test_case 'sid' => array($session->session_id, null), )); - $this->check_session_equals(array( + $this->check_sessions_equals(array( array('session_id' => $session->session_id, 'session_user_id' => 1), // use generated SID array('session_id' => 'bar_session000000000000000000000', 'session_user_id' => 4), ), diff --git a/tests/session/create_test.php b/tests/session/create_test.php index 0faedf4db2..442445599b 100644 --- a/tests/session/create_test.php +++ b/tests/session/create_test.php @@ -38,6 +38,6 @@ class phpbb_session_create_test extends phpbb_session_test_case self::bot('user agent', 13, '127.0.0.1'), '' ); - $this->assertEquals(true, $output->data['is_bot'] , 'should be a bot'); + $this->assertEquals(true, $output->data['is_bot'], 'should be a bot'); } } diff --git a/tests/session/garbage_collection_test.php b/tests/session/garbage_collection_test.php index b1be958d62..e7d01785dd 100644 --- a/tests/session/garbage_collection_test.php +++ b/tests/session/garbage_collection_test.php @@ -24,29 +24,19 @@ class phpbb_session_garbage_collection_test extends phpbb_session_test_case $this->session = $this->session_factory->get_session($this->db); } - protected function assert_sessions_equal($expected, $msg) - { - $sql = 'SELECT session_id, session_user_id - FROM phpbb_sessions - ORDER BY session_user_id'; - - $this->assertSqlResultEquals($expected, $sql, $msg); - } - public function test_cleanup_all() { - $this->assert_sessions_equal( + $this->check_sessions_equals( array( - array - ( + array( 'session_id' => 'anon_session00000000000000000000', 'session_user_id' => 1, ), - array - ( + array( 'session_id' => 'bar_session000000000000000000000', 'session_user_id' => 4, - )), + ), + ), 'Before test, should have some sessions.' ); // Set session length so it clears all @@ -55,7 +45,7 @@ class phpbb_session_garbage_collection_test extends phpbb_session_test_case // There is an error unless the captcha plugin is set $config['captcha_plugin'] = 'phpbb_captcha_nogd'; $this->session->session_gc(); - $this->assert_sessions_equal( + $this->check_sessions_equals( array(), 'After setting session time to 0, should remove all.' ); diff --git a/tests/session/testable_facade.php b/tests/session/testable_facade.php index c5e58fce05..9f0a3c5f59 100644 --- a/tests/session/testable_facade.php +++ b/tests/session/testable_facade.php @@ -33,7 +33,7 @@ class phpbb_session_testable_facade $this->session_factory = $session_factory; } - function extract_current_page ( + function extract_current_page( $root_path, $php_self, $query_string, @@ -48,7 +48,7 @@ class phpbb_session_testable_facade return phpbb_session::extract_current_page($root_path); } - function extract_current_hostname ( + function extract_current_hostname( $host, $server_name_config, $cookie_domain_config @@ -75,7 +75,7 @@ class phpbb_session_testable_facade * @param request_overrides An array of overrides for the global request object * @return boolean False if the user is identified, otherwise true. */ - function session_begin ( + function session_begin( $update_session_page = true, $config_overrides = array(), $request_overrides = array(), @@ -90,7 +90,7 @@ class phpbb_session_testable_facade return $session; } - function session_create ( + function session_create( $user_id = false, $set_admin = false, $persist_login = false, diff --git a/tests/session/validate_referrer_test.php b/tests/session/validate_referrer_test.php index f78bf36c1b..a302229287 100644 --- a/tests/session/validate_referrer_test.php +++ b/tests/session/validate_referrer_test.php @@ -16,7 +16,8 @@ class phpbb_session_validate_referrer_test extends phpbb_session_test_case return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/sessions_empty.xml'); } - static function referrer_inputs() { + static function referrer_inputs() + { $ex = "example.org"; $alt = "example.com"; return array( @@ -39,8 +40,8 @@ class phpbb_session_validate_referrer_test extends phpbb_session_test_case ); } - /** @dataProvider referrer_inputs */ - function test_referrer_inputs ( + /** @dataProvider referrer_inputs */ + function test_referrer_inputs( $check_script_path, $referrer, $host, diff --git a/tests/test_framework/phpbb_session_test_case.php b/tests/test_framework/phpbb_session_test_case.php index 6ff7d8e2ef..e6a2b03bba 100644 --- a/tests/test_framework/phpbb_session_test_case.php +++ b/tests/test_framework/phpbb_session_test_case.php @@ -24,4 +24,13 @@ abstract class phpbb_session_test_case extends phpbb_database_test_case $this->session_facade = new phpbb_session_testable_facade($this->db, $this->session_factory); } + + protected function check_sessions_equals($expected_sessions, $message) + { + $sql = 'SELECT session_id, session_user_id + FROM phpbb_sessions + ORDER BY session_user_id'; + + $this->assertSqlResultEquals($expected_sessions, $sql, $message); + } } |