mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-08-09 05:54:34 +02:00
Update & Complete API controllers tests and Unit tests
This commit is contained in:
@ -2,9 +2,12 @@
|
||||
|
||||
namespace Tests\Unit;
|
||||
|
||||
use App\Events\GroupDeleted;
|
||||
use App\Events\GroupDeleting;
|
||||
use App\Models\User;
|
||||
use App\Models\Group;
|
||||
use App\Models\TwoFAccount;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Tests\ModelTestCase;
|
||||
|
||||
/**
|
||||
@ -23,18 +26,33 @@ class GroupModelTest extends ModelTestCase
|
||||
['created_at', 'updated_at'],
|
||||
['*'],
|
||||
[],
|
||||
['id' => 'int', 'twofaccounts_count' => 'integer'],
|
||||
['deleting' => GroupDeleting::class]
|
||||
['id' => 'int', 'twofaccounts_count' => 'integer'],
|
||||
[
|
||||
'deleting' => GroupDeleting::class,
|
||||
'deleted' => GroupDeleted::class
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function test_groups_relation()
|
||||
public function test_twofaccounts_relation()
|
||||
{
|
||||
$group = new Group();
|
||||
$accounts = $group->twofaccounts();
|
||||
$this->assertHasManyRelation($accounts, $group, new TwoFAccount());
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function test_user_relation()
|
||||
{
|
||||
$model = new Group;
|
||||
$relation = $model->user();
|
||||
|
||||
$this->assertInstanceOf(BelongsTo::class, $relation);
|
||||
$this->assertEquals('user_id', $relation->getForeignKeyName());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user