GroupModelTest.php 867 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace Tests\Unit;
  3. use App\Group;
  4. use App\TwoFAccount;
  5. use App\Events\GroupDeleting;
  6. use Illuminate\Database\Eloquent\Relations\HasMany;
  7. use Tests\ModelTestCase;
  8. /**
  9. * @covers \App\Group
  10. */
  11. class GroupModelTest extends ModelTestCase
  12. {
  13. /**
  14. * @test
  15. */
  16. public function test_model_configuration()
  17. {
  18. $this->runConfigurationAssertions(
  19. new Group(),
  20. ['name'],
  21. ['created_at', 'updated_at'],
  22. ['*'],
  23. [],
  24. ['id' => 'int', 'twofaccounts_count' => 'integer',],
  25. ['deleting' => GroupDeleting::class]
  26. );
  27. }
  28. /**
  29. * @test
  30. */
  31. public function test_groups_relation()
  32. {
  33. $group = new Group();
  34. $accounts = $group->twofaccounts();
  35. $this->assertHasManyRelation($accounts, $group, new TwoFAccount());
  36. }
  37. }