Model ticket link counterparts explicitly
linter / quality (pull_request) Successful in 3m5s
tests / ci (8.4) (pull_request) Failing after 1m41s

This commit is contained in:
2026-05-23 10:29:22 +00:00
parent d60c33fa7c
commit 486994e441
22 changed files with 312 additions and 66 deletions
@@ -33,7 +33,8 @@ class ProjectTicketLinkControllerTest extends TestCase
->orderBy('position')
->firstOrFail();
$ticketLinkType = TicketLinkType::factory()->for($project)->create([
'label' => 'Relates to',
'label' => 'Blocks',
'counterpart_label' => 'Blocked by',
'position' => 1,
]);
$ticket = Ticket::factory()->create([
@@ -59,11 +60,11 @@ class ProjectTicketLinkControllerTest extends TestCase
'ticket_link_type_id' => $ticketLinkType->id,
])
->assertRedirect(route('projects.tickets.show', [$project, $ticket]))
->assertSessionHas('status', 'Relates to link was saved.');
->assertSessionHas('status', 'Blocks link was saved.');
$this->assertDatabaseHas('ticket_links', [
'source_ticket_id' => min($ticket->id, $linkedTicket->id),
'target_ticket_id' => max($ticket->id, $linkedTicket->id),
'source_ticket_id' => $ticket->id,
'target_ticket_id' => $linkedTicket->id,
'ticket_link_type_id' => $ticketLinkType->id,
]);
@@ -71,7 +72,14 @@ class ProjectTicketLinkControllerTest extends TestCase
'ticket_id' => $ticket->id,
'actor_id' => $user->id,
'entry_type' => 'link_updated',
'summary' => 'Linked CORE-2 as Relates to.',
'summary' => 'Linked CORE-2 as Blocks.',
]);
$this->assertDatabaseHas('ticket_worklog_entries', [
'ticket_id' => $linkedTicket->id,
'actor_id' => $user->id,
'entry_type' => 'link_updated',
'summary' => 'Linked CORE-1 as Blocked by.',
]);
}
@@ -99,6 +107,7 @@ class ProjectTicketLinkControllerTest extends TestCase
->firstOrFail();
$ticketLinkType = TicketLinkType::factory()->for($project)->create([
'label' => 'Relates to',
'counterpart_label' => 'Relates to',
'position' => 1,
]);
$ticket = Ticket::factory()->create([
@@ -155,7 +164,8 @@ class ProjectTicketLinkControllerTest extends TestCase
->orderBy('position')
->firstOrFail();
$ticketLinkType = TicketLinkType::factory()->for($project)->create([
'label' => 'Relates to',
'label' => 'Blocks',
'counterpart_label' => 'Blocked by',
'position' => 1,
]);
$ticket = Ticket::factory()->create([
@@ -173,8 +183,8 @@ class ProjectTicketLinkControllerTest extends TestCase
'ticket_type_id' => $taskType->id,
]);
$ticketLink = TicketLink::factory()->create([
'source_ticket_id' => min($ticket->id, $linkedTicket->id),
'target_ticket_id' => max($ticket->id, $linkedTicket->id),
'source_ticket_id' => $ticket->id,
'target_ticket_id' => $linkedTicket->id,
'ticket_link_type_id' => $ticketLinkType->id,
]);
@@ -183,7 +193,7 @@ class ProjectTicketLinkControllerTest extends TestCase
$this->actingAs($user)
->delete(route('projects.tickets.links.destroy', [$project, $ticket, $ticketLink]))
->assertRedirect(route('projects.tickets.show', [$project, $ticket]))
->assertSessionHas('status', 'Relates to link was removed.');
->assertSessionHas('status', 'Blocks link was removed.');
$this->assertDatabaseMissing('ticket_links', [
'id' => $ticketLink->id,
@@ -193,7 +203,14 @@ class ProjectTicketLinkControllerTest extends TestCase
'ticket_id' => $ticket->id,
'actor_id' => $user->id,
'entry_type' => 'link_removed',
'summary' => 'Removed Relates to link to CORE-2.',
'summary' => 'Removed Blocks link to CORE-2.',
]);
$this->assertDatabaseHas('ticket_worklog_entries', [
'ticket_id' => $linkedTicket->id,
'actor_id' => $user->id,
'entry_type' => 'link_removed',
'summary' => 'Removed Blocked by link to CORE-1.',
]);
}
}