27 lines
710 B
PHP
27 lines
710 B
PHP
<?php
|
|
|
|
use App\Models\Room;
|
|
use App\Models\RoomUser;
|
|
use App\Models\User;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
beforeEach(function () {
|
|
$this->user = User::factory()->create();
|
|
$this->room = Room::factory()->create();
|
|
$this->roomUser = RoomUser::create(['user_id' => $this->user->id, 'room_id' => $this->room->id]);
|
|
});
|
|
|
|
it('has a user', function () {
|
|
expect($this->roomUser->user->first_name)->toBe($this->user->first_name);
|
|
});
|
|
|
|
it('has a judge', function () {
|
|
expect($this->roomUser->judge->first_name)->toBe($this->user->first_name);
|
|
});
|
|
|
|
it('has a room', function () {
|
|
expect($this->roomUser->room->name)->toBe($this->room->name);
|
|
});
|