1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-03-14 04:30:29 +01:00

[ticket/12574] Adjust login tests for ldap

PHPBB3-12574
This commit is contained in:
Marc Alexander 2019-11-01 13:03:50 +01:00
parent c75502e09c
commit 149df2d7b6
No known key found for this signature in database
GPG Key ID: 50E0D2423696F995
2 changed files with 26 additions and 120 deletions

View File

@ -1,5 +1,17 @@
<?xml version="1.0" encoding="UTF-8" ?>
<dataset>
<table name="phpbb_groups">
<column>group_id</column>
<column>group_name</column>
<column>group_type</column>
<column>group_desc</column>
<row>
<value>1</value>
<value>REGISTERED</value>
<value>3</value>
<value>foobar</value>
</row>
</table>
<table name="phpbb_users">
<column>user_id</column>
<column>username</column>

View File

@ -55,36 +55,23 @@ class phpbb_auth_provider_ldap_test extends phpbb_database_test_case
{
$this->assertFalse($this->provider->init());
}
/*
public function test_login()
{
$username = 'foobar';
$password = 'example';
$this->request->expects($this->once())
->method('is_set')
->with('PHP_AUTH_USER',
\phpbb\request\request_interface::SERVER)
->will($this->returnValue(true));
$this->request->expects($this->at(1))
->method('server')
->with('PHP_AUTH_USER')
->will($this->returnValue('foobar'));
$this->request->expects($this->at(2))
->method('server')
->with('PHP_AUTH_PW')
->will($this->returnValue('example'));
$username = 'admin';
$password = 'adminadmin';
$expected = array(
'status' => LOGIN_SUCCESS,
'status' => LOGIN_SUCCESS_CREATE_PROFILE, // successful login and user created
'error_msg' => false,
'user_row' => array(
'user_id' => '1',
'username' => 'foobar',
'user_password' => $this->password_hash,
'user_passchg' => '0',
'user_email' => 'example@example.com',
'user_type' => '0',
'username' => 'admin',
'user_password' => '',
'user_email' => 'admin@example.com',
'user_type' => 0,
'group_id' => 1,
'user_new' => 0,
'user_ip' => '',
),
);
@ -93,109 +80,16 @@ class phpbb_auth_provider_ldap_test extends phpbb_database_test_case
public function test_autologin()
{
$this->request->expects($this->once())
->method('is_set')
->with('PHP_AUTH_USER',
\phpbb\request\request_interface::SERVER)
->will($this->returnValue(true));
$this->request->expects($this->at(1))
->method('server')
->with('PHP_AUTH_USER')
->will($this->returnValue('foobar'));
$this->request->expects($this->at(2))
->method('server')
->with('PHP_AUTH_PW')
->will($this->returnValue('example'));
$expected = array(
'user_id' => '1',
'user_type' => '0',
'group_id' => '3',
'user_permissions' => '',
'user_perm_from' => '0',
'user_ip' => '',
'user_regdate' => '0',
'username' => 'foobar',
'username_clean' => 'foobar',
'user_password' => $this->password_hash,
'user_passchg' => '0',
'user_email' => 'example@example.com',
'user_email_hash' => '0',
'user_birthday' => '',
'user_lastvisit' => '0',
'user_lastmark' => '0',
'user_lastpost_time' => '0',
'user_lastpage' => '',
'user_last_confirm_key' => '',
'user_last_search' => '0',
'user_warnings' => '0',
'user_last_warning' => '0',
'user_login_attempts' => '0',
'user_inactive_reason' => '0',
'user_inactive_time' => '0',
'user_posts' => '0',
'user_lang' => '',
'user_timezone' => '',
'user_dateformat' => 'd M Y H:i',
'user_style' => '0',
'user_rank' => '0',
'user_colour' => '',
'user_new_privmsg' => '0',
'user_unread_privmsg' => '0',
'user_last_privmsg' => '0',
'user_message_rules' => '0',
'user_full_folder' => '-3',
'user_emailtime' => '0',
'user_topic_show_days' => '0',
'user_topic_sortby_type' => 't',
'user_topic_sortby_dir' => 'd',
'user_post_show_days' => '0',
'user_post_sortby_type' => 't',
'user_post_sortby_dir' => 'a',
'user_notify' => '0',
'user_notify_pm' => '1',
'user_notify_type' => '0',
'user_allow_pm' => '1',
'user_allow_viewonline' => '1',
'user_allow_viewemail' => '1',
'user_allow_massemail' => '1',
'user_options' => '230271',
'user_avatar' => '',
'user_avatar_type' => '',
'user_avatar_width' => '0',
'user_avatar_height' => '0',
'user_sig' => '',
'user_sig_bbcode_uid' => '',
'user_sig_bbcode_bitfield' => '',
'user_jabber' => '',
'user_actkey' => '',
'user_newpasswd' => '',
'user_form_salt' => '',
'user_new' => '1',
'user_reminded' => '0',
'user_reminded_time' => '0',
);
$this->assertEquals($expected, $this->provider->autologin());
$this->assertNull($this->provider->autologin());
}
public function test_validate_session()
{
$user = array(
'username' => 'foobar',
'username' => 'admin',
'user_type'
);
$this->request->expects($this->once())
->method('is_set')
->with('PHP_AUTH_USER',
\phpbb\request\request_interface::SERVER)
->will($this->returnValue(true));
$this->request->expects($this->once())
->method('server')
->with('PHP_AUTH_USER')
->will($this->returnValue('foobar'));
$this->assertTrue($this->provider->validate_session($user));
$this->assertNull($this->provider->validate_session($user));
}
*/
}