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
+4 -4
View File
@@ -20,9 +20,9 @@ class TicketLinkTest extends TestCase
use RefreshDatabase;
/**
* Ensure the ticket link factory normalizes the stored source and target ticket ids.
* Ensure the ticket link factory preserves the provided source and target direction.
*/
public function test_ticket_link_factory_normalizes_ticket_order(): void
public function test_ticket_link_factory_preserves_ticket_direction(): void
{
$project = Project::factory()->create([
'key' => 'CORE',
@@ -61,8 +61,8 @@ class TicketLinkTest extends TestCase
'ticket_link_type_id' => $ticketLinkType->id,
]);
$this->assertSame($firstTicket->id, $ticketLink->source_ticket_id);
$this->assertSame($secondTicket->id, $ticketLink->target_ticket_id);
$this->assertSame($secondTicket->id, $ticketLink->source_ticket_id);
$this->assertSame($firstTicket->id, $ticketLink->target_ticket_id);
}
/**
@@ -22,6 +22,7 @@ class TicketLinkTypeTest extends TestCase
$this->assertNotNull($ticketLinkType->project_id);
$this->assertIsString($ticketLinkType->label);
$this->assertSame($ticketLinkType->label, $ticketLinkType->counterpart_label);
}
/**
@@ -39,12 +40,14 @@ class TicketLinkTypeTest extends TestCase
$this->assertDatabaseHas('ticket_link_types', [
'project_id' => $coreProject->id,
'label' => 'Relates to',
'counterpart_label' => 'Relates to',
'position' => 1,
]);
$this->assertDatabaseHas('ticket_link_types', [
'project_id' => $coreProject->id,
'label' => 'Blocks',
'counterpart_label' => 'Blocked by',
'position' => 2,
]);
}