mirror of
https://github.com/postfixadmin/postfixadmin.git
synced 2024-09-19 19:22:14 +02:00
add something to test Login::passwordChange() works
This commit is contained in:
parent
0fc3765528
commit
5b77278013
@ -39,6 +39,31 @@ class LoginTest extends \PHPUnit\Framework\TestCase {
|
||||
db_query('DELETE FROM domain');
|
||||
}
|
||||
|
||||
public function testPasswordchange() {
|
||||
$login = new Login('mailbox');
|
||||
|
||||
$this->assertTrue($login->login('test@example.com', 'foobar'));
|
||||
|
||||
// Can't change - current password wrong.
|
||||
try {
|
||||
$login->changePassword('test@example.com', 'foobar2', 'foobar2');
|
||||
$this->fail("Exception should have been thrown");
|
||||
} catch (\Exception $e) {
|
||||
$this->assertEquals("You didn't supply your current password!", $e->getMessage());
|
||||
}
|
||||
|
||||
|
||||
// Should change, current password correct.
|
||||
$this->assertTrue($login->changePassword('test@example.com', 'foobar2', 'foobar'));
|
||||
|
||||
// Can't now login with the old password
|
||||
$this->assertFalse($login->login('test@example.com', 'foobar'));
|
||||
|
||||
// Can login with the new one...
|
||||
$this->assertTrue($login->login('test@example.com', 'foobar2'));
|
||||
}
|
||||
|
||||
|
||||
public function testInvalidUsers() {
|
||||
$login = new Login('mailbox');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user