mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-08-08 21:44:32 +02:00
Update & Complete API controllers tests and Unit tests
This commit is contained in:
@ -2,6 +2,8 @@
|
||||
|
||||
namespace Tests\Unit;
|
||||
|
||||
use App\Models\Group;
|
||||
use App\Models\TwoFAccount;
|
||||
use App\Models\User;
|
||||
use Tests\ModelTestCase;
|
||||
|
||||
@ -20,7 +22,13 @@ class UserModelTest extends ModelTestCase
|
||||
['password', 'remember_token'],
|
||||
['*'],
|
||||
[],
|
||||
['id' => 'int', 'email_verified_at' => 'datetime']
|
||||
[
|
||||
'id' => 'int',
|
||||
'email_verified_at' => 'datetime',
|
||||
'is_admin' => 'boolean',
|
||||
'twofaccounts_count' => 'integer',
|
||||
'groups_count' => 'integer',
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -35,4 +43,24 @@ class UserModelTest extends ModelTestCase
|
||||
|
||||
$this->assertEquals(strtolower('UPPERCASE@example.COM'), $user->email);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function test_twofaccounts_relation()
|
||||
{
|
||||
$user = new User();
|
||||
$accounts = $user->twofaccounts();
|
||||
$this->assertHasManyRelation($accounts, $user, new TwoFAccount());
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function test_groups_relation()
|
||||
{
|
||||
$user = new User();
|
||||
$groups = $user->groups();
|
||||
$this->assertHasManyRelation($groups, $user, new Group());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user