Add inline ticket property dropdowns
This commit is contained in:
@@ -155,6 +155,75 @@ class ProjectBoardControllerTest extends TestCase
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure inline status moves return the destination and its allowed follow-up transitions.
|
||||
*/
|
||||
public function test_ticket_status_moves_return_json_with_follow_up_transitions(): void
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
$project = Project::factory()->create([
|
||||
'key' => 'CORE',
|
||||
]);
|
||||
|
||||
app(InitializeProjectTicketMetadata::class)->handle($project);
|
||||
|
||||
$todoColumn = BoardColumn::factory()->for($project)->create([
|
||||
'name' => 'Todo',
|
||||
'position' => 1,
|
||||
]);
|
||||
$reviewColumn = BoardColumn::factory()->for($project)->create([
|
||||
'name' => 'Review',
|
||||
'position' => 2,
|
||||
]);
|
||||
$todoStatus = $this->createColumnStatus($todoColumn);
|
||||
$reviewStatus = $this->createColumnStatus($reviewColumn);
|
||||
$backlogStatus = $this->backlogStatus($project);
|
||||
$this->allowMove($backlogStatus, $todoStatus);
|
||||
$this->allowMove($todoStatus, $reviewStatus);
|
||||
|
||||
$priority = TicketPriority::factory()->for($project)->create([
|
||||
'name' => 'High',
|
||||
'position' => 2,
|
||||
]);
|
||||
|
||||
$ticket = Ticket::factory()->create([
|
||||
'project_id' => $project->id,
|
||||
'sequence_number' => 1,
|
||||
'ticket_key' => 'CORE-1',
|
||||
'ticket_priority_id' => $priority->id,
|
||||
'ticket_status_id' => $backlogStatus->id,
|
||||
'ticket_type_id' => $project->ticketTypes()->firstOrFail()->id,
|
||||
'title' => 'Inline status ticket',
|
||||
]);
|
||||
|
||||
$this->syncProjectPermissions($project, $user, ['edit', 'view']);
|
||||
|
||||
$this->actingAs($user)
|
||||
->patchJson(route('projects.tickets.status.update', [$project, $ticket]), [
|
||||
'redirect_to' => 'backlog',
|
||||
'ticket_status_id' => $todoStatus->id,
|
||||
])
|
||||
->assertOk()
|
||||
->assertJsonPath('message', 'CORE-1 moved to Todo.')
|
||||
->assertJsonPath('moved', true)
|
||||
->assertJsonPath('ticket_status.id', $todoStatus->id)
|
||||
->assertJsonPath('ticket_status.board_column.id', $todoColumn->id)
|
||||
->assertJsonPath('ticket_status.allowed_target_statuses.0.id', $reviewStatus->id)
|
||||
->assertJsonPath('ticket_status.allowed_target_statuses.0.board_column.id', $reviewColumn->id)
|
||||
->assertJsonPath('ticket_status_id', $todoStatus->id);
|
||||
|
||||
$this->assertDatabaseHas('tickets', [
|
||||
'id' => $ticket->id,
|
||||
'ticket_status_id' => $todoStatus->id,
|
||||
]);
|
||||
$this->assertDatabaseHas('ticket_worklog_entries', [
|
||||
'actor_id' => $user->id,
|
||||
'entry_type' => 'status_changed',
|
||||
'summary' => 'Moved from Backlog to Todo.',
|
||||
'ticket_id' => $ticket->id,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure board tickets can move between columns.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user