4 changed files with 45 additions and 2 deletions
@ -62,9 +62,43 @@ class UserTest extends CIDatabaseTestCase |
|||||||
|
|
||||||
//-------------------------------------------------------------------- |
//-------------------------------------------------------------------- |
||||||
|
|
||||||
public function testUpdateUser() |
public function testCreateUser() |
||||||
{ |
{ |
||||||
|
$this->library->createUser('[email protected]', 'password987654', 'usertest'); |
||||||
|
$this->seeInDatabase($this->config->dbTableUsers, [ |
||||||
|
'email' => '[email protected]', |
||||||
|
'username' => 'usertest', |
||||||
|
]); |
||||||
|
$this->assertEquals(lang('Aauth.infoCreateSuccess'), $this->library->getInfosArray()[0]); |
||||||
|
|
||||||
$this->library = new Aauth(null, true); |
$this->library = new Aauth(null, true); |
||||||
|
$this->assertFalse($this->library->createUser('[email protected]', 'password123456', null)); |
||||||
|
print_r($this->library->getErrorsArray()); |
||||||
|
$this->assertEquals(lang('Aauth.existsAlreadyEmail'), $this->library->getErrorsArray()[0]); |
||||||
|
|
||||||
|
$this->library = new Aauth(null, true); |
||||||
|
$this->assertFalse($this->library->createUser('adminexample.com', 'password123456', null)); |
||||||
|
$this->assertEquals(lang('Aauth.invalidEmail'), $this->library->getErrorsArray()[0]); |
||||||
|
|
||||||
|
$this->library = new Aauth(null, true); |
||||||
|
$this->assertFalse($this->library->createUser('[email protected]', 'pass', null)); |
||||||
|
$this->assertEquals(lang('Aauth.invalidPassword'), $this->library->getErrorsArray()[0]); |
||||||
|
|
||||||
|
$this->library = new Aauth(null, true); |
||||||
|
$this->assertFalse($this->library->createUser('[email protected]', 'password12345678901011121314151617', null)); |
||||||
|
$this->assertEquals(lang('Aauth.invalidPassword'), $this->library->getErrorsArray()[0]); |
||||||
|
|
||||||
|
$this->library = new Aauth(null, true); |
||||||
|
$this->assertFalse($this->library->createUser('[email protected]', 'password123456', 'admin')); |
||||||
|
$this->assertEquals(lang('Aauth.existsAlreadyUsername'), $this->library->getErrorsArray()[0]); |
||||||
|
|
||||||
|
$this->library = new Aauth(null, true); |
||||||
|
$this->assertFalse($this->library->createUser('[email protected]', 'password123456', 'user+')); |
||||||
|
$this->assertEquals(lang('Aauth.invalidUsername'), $this->library->getErrorsArray()[0]); |
||||||
|
} |
||||||
|
|
||||||
|
public function testUpdateUser() |
||||||
|
{ |
||||||
$this->seeInDatabase($this->config->dbTableUsers, [ |
$this->seeInDatabase($this->config->dbTableUsers, [ |
||||||
'id' => 2, |
'id' => 2, |
||||||
'email' => '[email protected]', |
'email' => '[email protected]', |
||||||
@ -222,6 +256,7 @@ class UserTest extends CIDatabaseTestCase |
|||||||
'id' => 1, |
'id' => 1, |
||||||
'banned' => 0, |
'banned' => 0, |
||||||
]); |
]); |
||||||
|
$this->assertFalse($this->library->isBanned()); |
||||||
} |
} |
||||||
|
|
||||||
public function testIsBanned() |
public function testIsBanned() |
||||||
|
Loading…
Reference in new issue