You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.0 KiB

<?php
namespace Tests\Unit\Models;
use App\User;
use fullMstr;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Tests\BrowserKitTest as TestCase;
class MasterTest extends TestCase
{
use DatabaseMigrations;
/** @test */
public function a_master_has_name_link_attribute()
{
$singleMstr = factory(Master::class)->create();
$title = __('app.show_detail_title', [
'name' => $singleMstr->name, 'type' => __('vehicle.vehicle'),
]);
$link = '<a href="'.route('vehicles.show', $singleMstr).'"';
$link .= ' title="'.$title.'">';
$link .= $singleMstr->name;
$link .= '</a>';
$this->assertEquals($link, $singleMstr->name_link);
}
/** @test */
public function a_master_has_belongs_to_creator_relation()
{
$singleMstr = factory(Master::class)->make();
$this->assertInstanceOf(User::class, $singleMstr->creator);
$this->assertEquals($singleMstr->creator_id, $singleMstr->creator->id);
}
}