31 lines
897 B
PHP
31 lines
897 B
PHP
<?php
|
|
|
|
namespace Tests\Feature\Models;
|
|
|
|
use App\Enums\InstitutionLinkType;
|
|
use App\Models\Institution;
|
|
use App\Models\InstitutionLink;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Tests\TestCase;
|
|
|
|
class InstitutionLinkTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
public function test_type_is_cast_to_enum(): void
|
|
{
|
|
$link = InstitutionLink::factory()->create(['type' => InstitutionLinkType::Ticketing]);
|
|
|
|
$this->assertInstanceOf(InstitutionLinkType::class, $link->fresh()->type);
|
|
$this->assertSame(InstitutionLinkType::Ticketing, $link->fresh()->type);
|
|
}
|
|
|
|
public function test_it_belongs_to_an_institution(): void
|
|
{
|
|
$institution = Institution::factory()->create();
|
|
$link = InstitutionLink::factory()->create(['institution_id' => $institution->id]);
|
|
|
|
$this->assertTrue($link->institution->is($institution));
|
|
}
|
|
}
|