Implement ticket statuses
This commit is contained in:
@@ -9,6 +9,7 @@ use App\Models\TicketFieldDefinition;
|
||||
use App\Models\TicketFieldValue;
|
||||
use App\Models\TicketLink;
|
||||
use App\Models\TicketLinkType;
|
||||
use App\Models\TicketStatus;
|
||||
use App\Models\TicketWorklogEntry;
|
||||
use App\Models\User;
|
||||
use Database\Seeders\BoardColumnSeeder;
|
||||
@@ -29,7 +30,7 @@ class TicketTest extends TestCase
|
||||
{
|
||||
$ticket = Ticket::factory()->create();
|
||||
|
||||
$this->assertNull($ticket->board_column_id);
|
||||
$this->assertNull($ticket->ticketStatus?->board_column_id);
|
||||
$this->assertStringContainsString('-', $ticket->ticket_key);
|
||||
$this->assertSame(1, $ticket->sequence_number);
|
||||
}
|
||||
@@ -47,19 +48,22 @@ class TicketTest extends TestCase
|
||||
]);
|
||||
|
||||
$coreProject = Project::query()->where('key', 'CORE')->firstOrFail();
|
||||
$backlogStatus = $coreProject->ticketStatuses()
|
||||
->whereNull('board_column_id')
|
||||
->firstOrFail();
|
||||
|
||||
$this->assertDatabaseHas('tickets', [
|
||||
'project_id' => $coreProject->id,
|
||||
'ticket_key' => 'CORE-1',
|
||||
'title' => 'Seed backlog item',
|
||||
'board_column_id' => null,
|
||||
'ticket_status_id' => $backlogStatus->id,
|
||||
]);
|
||||
|
||||
$this->assertDatabaseHas('tickets', [
|
||||
'project_id' => $coreProject->id,
|
||||
'ticket_key' => 'CORE-2',
|
||||
'title' => 'Seed backlog item',
|
||||
'board_column_id' => null,
|
||||
'ticket_status_id' => $backlogStatus->id,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -200,6 +204,22 @@ class TicketTest extends TestCase
|
||||
$this->assertSame($author->id, $ticket->fresh()->author?->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure tickets expose their status relation.
|
||||
*/
|
||||
public function test_ticket_status_relation_is_available(): void
|
||||
{
|
||||
$ticketStatus = TicketStatus::factory()->create([
|
||||
'name' => 'Backlog',
|
||||
]);
|
||||
$ticket = Ticket::factory()->create([
|
||||
'project_id' => $ticketStatus->project_id,
|
||||
'ticket_status_id' => $ticketStatus->id,
|
||||
]);
|
||||
|
||||
$this->assertSame($ticketStatus->id, $ticket->fresh()->ticketStatus?->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure tickets expose incoming and outgoing link relations.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user