22 lines
474 B
PHP
22 lines
474 B
PHP
<?php
|
|
|
|
namespace Tests\Feature\Models;
|
|
|
|
use App\Models\User;
|
|
use App\Models\UserAffiliation;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Tests\TestCase;
|
|
|
|
class UserTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
public function test_it_has_many_affiliations(): void
|
|
{
|
|
$user = User::factory()->create();
|
|
UserAffiliation::factory()->create(['user_id' => $user->id]);
|
|
|
|
$this->assertCount(1, $user->refresh()->affiliations);
|
|
}
|
|
}
|