64 lines
1.7 KiB
PHP
64 lines
1.7 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Modules\Helpdesk\Tests\Feature;
|
|
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Livewire\Livewire;
|
|
use Modules\Helpdesk\Livewire\KanbanBoard;
|
|
use Modules\Helpdesk\Tests\Concerns\BuildsHelpdeskFixtures;
|
|
use Tests\TestCase;
|
|
|
|
final class KanbanBoardTest extends TestCase
|
|
{
|
|
use BuildsHelpdeskFixtures;
|
|
use RefreshDatabase;
|
|
|
|
/** @test */
|
|
public function kanban_board_renders_visible_tickets_by_status(): void
|
|
{
|
|
$lookups = $this->seedLookupData();
|
|
$user = $this->admin();
|
|
|
|
$ticket = $this->ticket([
|
|
'owner' => $user,
|
|
'status_id' => $lookups['open']->id,
|
|
'priority_id' => $lookups['high']->id,
|
|
'subject' => 'Kanban visible ticket',
|
|
]);
|
|
|
|
$this->actingAs($user);
|
|
|
|
Livewire::test(KanbanBoard::class)
|
|
->assertSee('Kanban board')
|
|
->assertSee($ticket->reference)
|
|
->assertSee('Kanban visible ticket')
|
|
->assertSee('High');
|
|
}
|
|
|
|
/** @test */
|
|
public function kanban_board_can_move_ticket_to_closed_status(): void
|
|
{
|
|
$lookups = $this->seedLookupData();
|
|
$user = $this->admin();
|
|
|
|
$ticket = $this->ticket([
|
|
'owner' => $user,
|
|
'status_id' => $lookups['open']->id,
|
|
'priority_id' => $lookups['normal']->id,
|
|
]);
|
|
|
|
$this->actingAs($user);
|
|
|
|
Livewire::test(KanbanBoard::class)
|
|
->call('moveTicket', $ticket->id, $lookups['closed']->id)
|
|
->assertHasNoErrors();
|
|
|
|
$ticket->refresh();
|
|
|
|
$this->assertSame($lookups['closed']->id, $ticket->status_id);
|
|
$this->assertNotNull($ticket->completed_at);
|
|
}
|
|
}
|