5 changed files with 41 additions and 5 deletions
@ -0,0 +1,21 @@ |
|||||||
|
<?php namespace Tests\Aauth\Libraries\Aauth; |
||||||
|
|
||||||
|
use App\Libraries\Aauth; |
||||||
|
|
||||||
|
class CallTest extends \CIUnitTestCase |
||||||
|
{ |
||||||
|
public function setUp() |
||||||
|
{ |
||||||
|
parent::setUp(); |
||||||
|
|
||||||
|
$this->library = new Aauth(); |
||||||
|
} |
||||||
|
|
||||||
|
//-------------------------------------------------------------------- |
||||||
|
|
||||||
|
public function testFailCall() |
||||||
|
{ |
||||||
|
$this->expectException('ErrorException'); // Or whichever exception it is |
||||||
|
$this->library->getNotExistingFunc(); |
||||||
|
} |
||||||
|
} |
@ -94,7 +94,6 @@ class TOTPTest extends CIDatabaseTestCase |
|||||||
|
|
||||||
$totp = TOTP::create('JBSWY3DPEHPK3PXP'); |
$totp = TOTP::create('JBSWY3DPEHPK3PXP'); |
||||||
$totpCode = $totp->now(); |
$totpCode = $totp->now(); |
||||||
usleep(1000); |
|
||||||
$this->assertTrue($this->library->login('[email protected]', 'password123456', null, $totpCode)); |
$this->assertTrue($this->library->login('[email protected]', 'password123456', null, $totpCode)); |
||||||
|
|
||||||
$userModel = new UserModel(); |
$userModel = new UserModel(); |
||||||
@ -110,6 +109,8 @@ class TOTPTest extends CIDatabaseTestCase |
|||||||
$this->library = new Aauth($config, $session); |
$this->library = new Aauth($config, $session); |
||||||
|
|
||||||
$this->library = new Aauth($config, $session); |
$this->library = new Aauth($config, $session); |
||||||
|
$totp = TOTP::create('JBSWY3DPEHPK3PXP'); |
||||||
|
$totpCode = $totp->now(); |
||||||
$this->assertTrue($this->library->login('[email protected]', 'password123456', null, $totpCode)); |
$this->assertTrue($this->library->login('[email protected]', 'password123456', null, $totpCode)); |
||||||
|
|
||||||
$userModel->protect(false)->update(1, ['last_ip_address' => '99.99.99.99']); |
$userModel->protect(false)->update(1, ['last_ip_address' => '99.99.99.99']); |
||||||
@ -202,7 +203,6 @@ class TOTPTest extends CIDatabaseTestCase |
|||||||
|
|
||||||
$totp = TOTP::create('JBSWY3DPEHPK3PXP'); |
$totp = TOTP::create('JBSWY3DPEHPK3PXP'); |
||||||
$totpCode = $totp->now(); |
$totpCode = $totp->now(); |
||||||
usleep(1000); |
|
||||||
|
|
||||||
$this->assertTrue($this->library->verifyUserTotpCode($totpCode)); |
$this->assertTrue($this->library->verifyUserTotpCode($totpCode)); |
||||||
$this->assertTrue($this->library->verifyUserTotpCode($totpCode, 1)); |
$this->assertTrue($this->library->verifyUserTotpCode($totpCode, 1)); |
||||||
|
Loading…
Reference in new issue