4 changed files with 13 additions and 14 deletions
@ -101,6 +101,7 @@ class LoginTest extends CIDatabaseTestCase
|
||||
|
||||
$userVariableModel = new UserVariableModel(); |
||||
$userVariableModel->save(1, 'verification_code', '12345678', true); |
||||
$this->library->clearErrors(); |
||||
$this->assertFalse($this->library->login('[email protected]', 'password123456')); |
||||
$this->assertEquals(lang('Aauth.notVerified'), $this->library->getErrorsArray()[0]); |
||||
|
||||
@ -109,7 +110,6 @@ class LoginTest extends CIDatabaseTestCase
|
||||
$this->assertFalse($this->library->login('[email protected]', 'password123456')); |
||||
$this->assertEquals(lang('Aauth.invalidUserBanned'), $this->library->getErrorsArray()[0]); |
||||
|
||||
|
||||
$this->library->clearErrors(); |
||||
$this->assertFalse($this->library->login('[email protected]', 'password1234567')); |
||||
$this->assertEquals(lang('Aauth.loginFailedAll'), $this->library->getErrorsArray()[0]); |
||||
|
@ -65,13 +65,13 @@ class UserTest extends CIDatabaseTestCase
|
||||
|
||||
public function testUpdateUser() |
||||
{ |
||||
$this->seeInDatabase($this->config->dbTableUserVariables, [ |
||||
$this->seeInDatabase($this->config->dbTableUsers, [ |
||||
'id' => 2, |
||||
'email' => '[email protected]', |
||||
'username' => 'user', |
||||
]); |
||||
$this->library->updateUser(2, '[email protected]', 'password987654', 'user1'); |
||||
$this->seeInDatabase($this->config->dbTableUserVariables, [ |
||||
$this->seeInDatabase($this->config->dbTableUsers, [ |
||||
'id' => 2, |
||||
'email' => '[email protected]', |
||||
'username' => 'user1', |
||||
@ -113,9 +113,9 @@ class UserTest extends CIDatabaseTestCase
|
||||
|
||||
public function testDeleteUser() |
||||
{ |
||||
$this->seeNumRecords(2, $this->config->dbTableUsers); |
||||
$this->seeNumRecords(2, $this->config->dbTableUsers, []); |
||||
$this->library->deleteUser(2); |
||||
$this->seeNumRecords(1, $this->config->dbTableUsers); |
||||
$this->seeNumRecords(1, $this->config->dbTableUsers, []); |
||||
|
||||
$this->assertFalse($this->library->deleteUser(99)); |
||||
$this->assertEquals(lang('Aauth.notFoundUser'), $this->library->getErrorsArray()[0]); |
||||
@ -143,7 +143,7 @@ class UserTest extends CIDatabaseTestCase
|
||||
$session = $this->getInstance(); |
||||
$this->library = new Aauth(NULL, $session); |
||||
$session->set('user', [ |
||||
'id' => 1, |
||||
'id' => 1, |
||||
]); |
||||
$userIdNone = $this->library->getUser(); |
||||
$this->assertEquals('admin', $userIdNone['username']); |
||||
@ -163,13 +163,12 @@ class UserTest extends CIDatabaseTestCase
|
||||
$session = $this->getInstance(); |
||||
$this->library = new Aauth(NULL, $session); |
||||
$session->set('user', [ |
||||
'id' => 1, |
||||
'id' => 1, |
||||
]); |
||||
$userIdNone = $this->library->getUserId(); |
||||
$this->assertEquals('1', $userIdNone); |
||||
|
||||
$this->assertFalse($this->library->getUserId('[email protected]')); |
||||
$this->assertEquals(lang('Aauth.notFoundUser'), $this->library->getErrorsArray()[0]); |
||||
} |
||||
|
||||
public function testBanUser() |
||||
@ -226,11 +225,11 @@ class UserTest extends CIDatabaseTestCase
|
||||
|
||||
public function testIsBanned() |
||||
{ |
||||
$this->assertFalse($this->library->isBanned(1)); |
||||
|
||||
$this->library->banUser(1); |
||||
$this->assertTrue($this->library->isBanned(1)); |
||||
|
||||
$this->assertFalse($this->library->isBanned(1)); |
||||
|
||||
$this->assertTrue($this->library->isBanned(99)); |
||||
} |
||||
} |
||||
|
Loading…
Reference in new issue