mirror of
https://github.com/phpbb/phpbb.git
synced 2025-04-21 16:22:22 +02:00
[feature/auth-refactor] Initial auth unit test provider_db
Initial work on a unit test for the provider_db login function. Does not work currently. PHPBB3-9734
This commit is contained in:
parent
b8610c4b98
commit
80e2d65399
33
tests/auth/fixtures/user.xml
Normal file
33
tests/auth/fixtures/user.xml
Normal file
@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<dataset>
|
||||
<table name="phpbb_users">
|
||||
<column>user_id</column>
|
||||
<column>username</column>
|
||||
<column>username_clean</column>
|
||||
<column>user_password</column>
|
||||
<column>user_passchg</column>
|
||||
<column>user_pass_convert</column>
|
||||
<column>user_email</column>
|
||||
<column>user_type</column>
|
||||
<column>user_login_attempts</column>
|
||||
<column>user_permissions</column>
|
||||
<column>user_sig</column>
|
||||
<column>user_occ</column>
|
||||
<column>user_interests</column>
|
||||
<row>
|
||||
<value>1</value>
|
||||
<value>foobar</value>
|
||||
<value>foobar</value>
|
||||
<value>$H$9E45lK6J8nLTSm9oJE5aNCSTFK9wqa/</value>
|
||||
<value>0</value>
|
||||
<value>0</value>
|
||||
<value>example@example.com</value>
|
||||
<value>0</value>
|
||||
<value>0</value>
|
||||
<value></value>
|
||||
<value></value>
|
||||
<value></value>
|
||||
<value></value>
|
||||
</row>
|
||||
</table>
|
||||
</dataset>
|
40
tests/auth/provider_db_test.php
Normal file
40
tests/auth/provider_db_test.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package testing
|
||||
* @copyright (c) 2013 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
require_once dirname(__FILE__).'/../../phpBB/includes/functions.php';
|
||||
|
||||
class phpbb_auth_provider_db_test extends phpbb_database_test_case
|
||||
{
|
||||
public function getDataSet()
|
||||
{
|
||||
return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/user.xml');
|
||||
}
|
||||
|
||||
public function test_login()
|
||||
{
|
||||
global $phpbb_root_path, $phpEx;
|
||||
|
||||
$db = $this->new_dbal();
|
||||
$config = new phpbb_config(array(
|
||||
'ip_login_limit_max' => 0,
|
||||
'ip_login_limit_use_forwarded' => 0,
|
||||
'max_login_attempts' => 0,
|
||||
));
|
||||
$request = $this->getMock('phpbb_request');
|
||||
$user = $this->getMock('phpbb_user');
|
||||
$provider = new phpbb_auth_provider_db($db, $config, $request, $user, $phpbb_root_path, $phpEx);
|
||||
|
||||
$expected = array(
|
||||
'status' => LOGIN_SUCCESS,
|
||||
'error_msg' => false,
|
||||
'user_row' => '',
|
||||
);
|
||||
$this->assertEquals($expected, $provider->login('example', 'example'));
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user