2FAuth/tests/Unit/GroupModelTest.php

41 lines
843 B
PHP
Raw Normal View History

2021-11-30 17:39:33 +01:00
<?php
namespace Tests\Unit;
2022-11-22 15:15:52 +01:00
use App\Events\GroupDeleting;
2021-12-02 13:15:53 +01:00
use App\Models\Group;
use App\Models\TwoFAccount;
2021-11-30 17:39:33 +01:00
use Tests\ModelTestCase;
/**
2021-12-02 13:15:53 +01:00
* @covers \App\Models\Group
2021-11-30 17:39:33 +01:00
*/
class GroupModelTest extends ModelTestCase
{
/**
* @test
*/
public function test_model_configuration()
{
$this->runConfigurationAssertions(
new Group(),
['name'],
['created_at', 'updated_at'],
['*'],
[],
2022-11-22 15:15:52 +01:00
['id' => 'int', 'twofaccounts_count' => 'integer'],
2021-11-30 17:39:33 +01:00
['deleting' => GroupDeleting::class]
);
}
/**
* @test
*/
public function test_groups_relation()
{
2022-11-22 15:15:52 +01:00
$group = new Group();
2021-11-30 17:39:33 +01:00
$accounts = $group->twofaccounts();
$this->assertHasManyRelation($accounts, $group, new TwoFAccount());
}
2022-11-22 15:15:52 +01:00
}