<?php
|
|
|
|
namespace Tests\Feature\Collaborators\Associates;
|
|
|
|
use App\Associate;
|
|
use App\Collaborator;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Illuminate\Foundation\Testing\WithFaker;
|
|
use Livewire\Livewire;
|
|
use Tests\TestCase;
|
|
|
|
class ShowTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
/** @test */
|
|
public function a_collaborator_can_view_show_page()
|
|
{
|
|
$collaborator = factory(Collaborator::class)->create();
|
|
$this->be($collaborator, 'collaborators');
|
|
|
|
$associate = factory(Associate::class)->create();
|
|
|
|
$this->get(route('collaborators.associates.show', compact('associate')))
|
|
->assertSuccessful()
|
|
->assertSeeLivewire('collaborators.associates.show');
|
|
}
|
|
|
|
/** @test */
|
|
public function show_page_displays_correct_associate_data()
|
|
{
|
|
$collaborator = factory(Collaborator::class)->create();
|
|
$this->be($collaborator, 'collaborators');
|
|
|
|
$associate = factory(Associate::class)->create(['name' => 'José da Silva']);
|
|
factory(Associate::class)->create(['name' => 'Maria da Conceição']);
|
|
|
|
$this->get(route('collaborators.associates.show', compact('associate')))
|
|
->assertSee('José da Silva')
|
|
->assertDontSee('Maria da Conceição');
|
|
|
|
}
|
|
}
|