mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-10 13:28:55 +00:00
[ticket/11620] Minor changes to tests for coding standards
PHPBB3-11620
This commit is contained in:
parent
3999d7ec7c
commit
cd1fe789d2
4 changed files with 28 additions and 20 deletions
|
@ -33,11 +33,11 @@ class phpbb_session_create_test extends phpbb_database_test_case
|
||||||
return array(array(
|
return array(array(
|
||||||
'bot_agent' => $bot_agent,
|
'bot_agent' => $bot_agent,
|
||||||
'user_id' => $user_id,
|
'user_id' => $user_id,
|
||||||
'bot_ip' => $bot_ip
|
'bot_ip' => $bot_ip,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_bot_session ()
|
function test_bot_session()
|
||||||
{
|
{
|
||||||
$output = $this->session_facade->session_create(
|
$output = $this->session_facade->session_create(
|
||||||
false,
|
false,
|
||||||
|
@ -50,6 +50,6 @@ class phpbb_session_create_test extends phpbb_database_test_case
|
||||||
self::bot('user agent', 13, '127.0.0.1'),
|
self::bot('user agent', 13, '127.0.0.1'),
|
||||||
''
|
''
|
||||||
);
|
);
|
||||||
$this->assertEquals($output->data['is_bot'], true, "should be a bot");
|
$this->assertEquals($output->data['is_bot'], true, 'should be a bot');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,19 @@ class phpbb_session_extract_page_test extends phpbb_database_test_case
|
||||||
public $db;
|
public $db;
|
||||||
public $session_facade;
|
public $session_facade;
|
||||||
|
|
||||||
|
public function getDataSet()
|
||||||
|
{
|
||||||
|
return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/sessions_empty.xml');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setUp()
|
||||||
|
{
|
||||||
|
$this->session_factory = new phpbb_session_testable_factory;
|
||||||
|
$this->db = $this->new_dbal();
|
||||||
|
$this->session_facade =
|
||||||
|
new phpbb_session_testable_facade($this->db, $this->session_factory);
|
||||||
|
}
|
||||||
|
|
||||||
static public function extract_current_page_data()
|
static public function extract_current_page_data()
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
|
@ -97,19 +110,6 @@ class phpbb_session_extract_page_test extends phpbb_database_test_case
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDataSet()
|
|
||||||
{
|
|
||||||
return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/sessions_empty.xml');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setUp()
|
|
||||||
{
|
|
||||||
$this->session_factory = new phpbb_session_testable_factory;
|
|
||||||
$this->db = $this->new_dbal();
|
|
||||||
$this->session_facade =
|
|
||||||
new phpbb_session_testable_facade($this->db, $this->session_factory);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @dataProvider extract_current_page_data */
|
/** @dataProvider extract_current_page_data */
|
||||||
function test_extract_current_page($root_path, $php_self, $query_string, $request_uri, $expected)
|
function test_extract_current_page($root_path, $php_self, $query_string, $request_uri, $expected)
|
||||||
{
|
{
|
||||||
|
|
|
@ -65,8 +65,16 @@ class phpbb_session_testable_facade
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** This function has a *lot* of dependencies, so instead of naming them all,
|
/**
|
||||||
* just ask for overrides */
|
*
|
||||||
|
* This function has a lot of dependencies, so instead of naming them all,
|
||||||
|
* just ask for overrides
|
||||||
|
*
|
||||||
|
* @param update_session_page Boolean of whether to set page of the session
|
||||||
|
* @param config_overrides An array of overrides for the global config object
|
||||||
|
* @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,
|
$update_session_page = true,
|
||||||
$config_overrides = array(),
|
$config_overrides = array(),
|
||||||
|
|
|
@ -63,8 +63,8 @@ class phpbb_session_validate_referrer_test extends phpbb_database_test_case
|
||||||
$pass_or_fail
|
$pass_or_fail
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//Referrer needs http:// because it's going to get stripped in function.
|
// Referrer needs http:// because it's going to get stripped in function.
|
||||||
$referrer = ($referrer? 'http://'.$referrer : '');
|
$referrer = $referrer ? 'http://'.$referrer : '';
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
$pass_or_fail,
|
$pass_or_fail,
|
||||||
$this->session_facade->validate_referer(
|
$this->session_facade->validate_referer(
|
||||||
|
|
Loading…
Add table
Reference in a new issue