Add ticket pull request visibility

This commit is contained in:
2026-03-26 09:19:56 +01:00
parent 0b95477f4e
commit 789675f83f
11 changed files with 495 additions and 3 deletions
@@ -101,14 +101,15 @@ class ProjectTicketControllerTest extends TestCase
->where('linkedTickets.0.linked_ticket.ticket_key', 'CORE-2')
->where('linkedTickets.0.ticket_link_type.label', 'Relates to')
->where('repositoryBranches', [])
->where('repositoryPullRequests', [])
->where('canEditTicket', false),
);
}
/**
* Ensure ticket details expose matching branches and inaccessible repository links.
* Ensure ticket details expose matching branches, pull requests, and inaccessible repository links.
*/
public function test_ticket_details_include_matching_branches_and_inaccessible_repository_links(): void
public function test_ticket_details_include_matching_branches_pull_requests_and_inaccessible_repository_links(): void
{
Http::preventStrayRequests();
Http::fake([
@@ -118,6 +119,38 @@ class ProjectTicketControllerTest extends TestCase
['name' => 'CORE-10-should-not-match'],
['name' => 'main'],
]),
'https://git.example.test/api/v1/repos/core-team/kanbangit/pulls*' => Http::response([
[
'number' => 42,
'title' => 'Add login form',
'state' => 'open',
'merged' => false,
'html_url' => 'https://git.example.test/core-team/kanbangit/pulls/42',
'head' => [
'ref' => 'CORE-1-login-form',
],
],
[
'number' => 43,
'title' => 'Close auth gap',
'state' => 'closed',
'merged' => true,
'html_url' => 'https://git.example.test/core-team/kanbangit/pulls/43',
'head' => [
'ref' => 'CORE-1/fix-oauth',
],
],
[
'number' => 99,
'title' => 'Other ticket change',
'state' => 'open',
'merged' => false,
'html_url' => 'https://git.example.test/core-team/kanbangit/pulls/99',
'head' => [
'ref' => 'CORE-10-should-not-match',
],
],
]),
]);
$viewer = User::factory()->create();
@@ -175,7 +208,16 @@ class ProjectTicketControllerTest extends TestCase
->where('repositoryBranches.0.branches.1.name', 'CORE-1/fix-oauth')
->where('repositoryBranches.1.repository_connection.repository_full_name', 'other-team/mobile')
->where('repositoryBranches.1.repository_connection.has_personal_access', false)
->where('repositoryBranches.1.branches', []),
->where('repositoryBranches.1.branches', [])
->has('repositoryPullRequests.0.pull_requests', 2)
->where('repositoryPullRequests.0.pull_requests.0.number', '42')
->where('repositoryPullRequests.0.pull_requests.0.title', 'Add login form')
->where('repositoryPullRequests.0.pull_requests.0.status', 'open')
->where('repositoryPullRequests.0.pull_requests.1.number', '43')
->where('repositoryPullRequests.0.pull_requests.1.status', 'merged')
->where('repositoryPullRequests.1.repository_connection.repository_full_name', 'other-team/mobile')
->where('repositoryPullRequests.1.repository_connection.has_personal_access', false)
->where('repositoryPullRequests.1.pull_requests', []),
);
}