<?php

namespace Tests\Unit\Models;

use App\User;
use fullMstr;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\BrowserKitTest as TestCase;

class MasterTest extends TestCase
{
    use RefreshDatabase;

    /** @test */
    public function a_master_has_title_link_attribute()
    {
        $singleMstr = Master::factory()->create();

        $this->assertEquals(
            link_to_route('masters.show', $singleMstr->title, [$singleMstr], [
                'title' => __(
                    'app.show_detail_title',
                    ['title' => $singleMstr->title, 'type' => __('master.master')]
                ),
            ]), $singleMstr->title_link
        );
    }

    /** @test */
    public function a_master_has_belongs_to_creator_relation()
    {
        $singleMstr = Master::factory()->make();

        $this->assertInstanceOf(User::class, $singleMstr->creator);
        $this->assertEquals($singleMstr->creator_id, $singleMstr->creator->id);
    }
}
