Remove legacy acceptance criteria storage
linter / quality (pull_request) Successful in 2m4s
tests / ci (8.4) (pull_request) Successful in 1m52s

This commit is contained in:
2026-05-19 23:12:15 +00:00
parent 689db9e41b
commit 5aebd4f9ef
16 changed files with 109 additions and 145 deletions
+1 -1
View File
@@ -136,7 +136,7 @@ class TicketApiTest extends TestCase
$this->withApplicationKey($writer)
->patchJson(route('api.projects.tickets.update', [$project, $ticket]), [
'acceptance_criteria' => $ticket->acceptance_criteria,
'acceptance_criteria' => [],
'blocked_comment' => $ticket->blocked_comment,
'description' => $ticket->description,
'is_blocked' => $ticket->is_blocked,
@@ -110,7 +110,11 @@ class TicketCreatedNotificationDispatchTest extends TestCase
$response = $this->actingAs($user)
->post(route('projects.tickets.store', $project), [
'acceptance_criteria' => '- [ ] Ship it.',
'acceptance_criteria' => [[
'checked' => false,
'indent' => 0,
'text' => 'Ship it.',
]],
'assignee_user_id' => null,
'description' => 'Created from notification dispatch test.',
'story_points' => 3,
+15 -3
View File
@@ -84,7 +84,11 @@ class ProjectBacklogTest extends TestCase
->post(route('projects.tickets.store', $project), [
'title' => 'New ticket',
'description' => 'Description',
'acceptance_criteria' => '- [ ] Criteria',
'acceptance_criteria' => [[
'checked' => false,
'indent' => 0,
'text' => 'Criteria',
]],
'ticket_type_id' => $project->ticketTypes()->firstOrFail()->id,
'ticket_priority_id' => $priority->id,
'ticket_status_id' => $backlogStatus->id,
@@ -118,7 +122,11 @@ class ProjectBacklogTest extends TestCase
$payload = [
'title' => 'Same title',
'description' => 'Description',
'acceptance_criteria' => '- [ ] Criteria',
'acceptance_criteria' => [[
'checked' => false,
'indent' => 0,
'text' => 'Criteria',
]],
'assignee_user_id' => $assignee->id,
'story_points' => 3,
'ticket_type_id' => $project->ticketTypes()->firstOrFail()->id,
@@ -192,7 +200,11 @@ class ProjectBacklogTest extends TestCase
->post(route('projects.tickets.store', $project), [
'title' => 'New ticket',
'description' => 'Description',
'acceptance_criteria' => '- [ ] Criteria',
'acceptance_criteria' => [[
'checked' => false,
'indent' => 0,
'text' => 'Criteria',
]],
'ticket_type_id' => $project->ticketTypes()->firstOrFail()->id,
'ticket_priority_id' => $project->ticketPriorities()->firstOrFail()->id,
'ticket_status_id' => $boardStatus->id,
@@ -3,6 +3,7 @@
namespace Tests\Feature\Projects;
use App\Actions\ProjectTicketMetadata\InitializeProjectTicketMetadata;
use App\Models\AcceptanceCriterion;
use App\Models\BoardColumn;
use App\Models\Project;
use App\Models\RepositoryConnection;
@@ -56,10 +57,7 @@ class ProjectTicketControllerTest extends TestCase
'position' => 1,
]);
$legacyAcceptanceCriteria = "- [ ] User can sign in\n - [x] Nested verification";
$ticket = Ticket::factory()->create([
'acceptance_criteria' => $legacyAcceptanceCriteria,
'assignee_user_id' => $assignee->id,
'author_user_id' => $author->id,
'project_id' => $project->id,
@@ -70,6 +68,20 @@ class ProjectTicketControllerTest extends TestCase
'ticket_type_id' => $this->nonParentType($project)->id,
'title' => 'Ticket detail test',
]);
$rootCriterion = AcceptanceCriterion::query()->create([
'ticket_id' => $ticket->id,
'parent_acceptance_criterion_id' => null,
'position' => 0,
'text' => 'User can sign in',
'is_checked' => false,
]);
AcceptanceCriterion::query()->create([
'ticket_id' => $ticket->id,
'parent_acceptance_criterion_id' => $rootCriterion->id,
'position' => 0,
'text' => 'Nested verification',
'is_checked' => true,
]);
$linkedTicket = Ticket::factory()->create([
'author_user_id' => $author->id,
'project_id' => $project->id,
@@ -348,7 +360,11 @@ class ProjectTicketControllerTest extends TestCase
$this->actingAs($editor)
->post(route('projects.tickets.store', $project), [
'acceptance_criteria' => '- [ ] The ticket exists.',
'acceptance_criteria' => [[
'checked' => false,
'indent' => 0,
'text' => 'The ticket exists.',
]],
'assignee_user_id' => $assignee->id,
'description' => 'Created from the dedicated page.',
'story_points' => 5,
@@ -446,7 +462,6 @@ class ProjectTicketControllerTest extends TestCase
]);
$ticket = Ticket::factory()->create([
'acceptance_criteria' => '- [ ] Old acceptance criteria',
'author_user_id' => $author->id,
'description' => 'Old description',
'project_id' => $project->id,
@@ -515,7 +530,6 @@ class ProjectTicketControllerTest extends TestCase
'id' => $ticket->id,
'title' => 'Updated title',
'description' => 'Updated description',
'acceptance_criteria' => "- [ ] Shows success banner\n - [x] Includes nested confirmations",
'assignee_user_id' => $assignee->id,
'story_points' => 8,
'ticket_type_id' => $this->parentType($project)->id,
@@ -526,10 +540,7 @@ class ProjectTicketControllerTest extends TestCase
$this->assertEquals(
$updatedAcceptanceCriteria,
\App\Actions\Tickets\Support\AcceptanceCriteriaChecklist::fromModels(
$ticket->acceptanceCriteria,
$ticket->acceptance_criteria,
),
\App\Actions\Tickets\Support\AcceptanceCriteriaChecklist::fromModels($ticket->acceptanceCriteria),
);
$this->assertDatabaseHas('acceptance_criteria', [
'ticket_id' => $ticket->id,
@@ -968,7 +979,9 @@ class ProjectTicketControllerTest extends TestCase
private function updatePayload(Ticket $ticket, array $overrides = []): array
{
return array_merge([
'acceptance_criteria' => $ticket->acceptance_criteria,
'acceptance_criteria' => \App\Actions\Tickets\Support\AcceptanceCriteriaChecklist::fromModels(
$ticket->acceptanceCriteria()->get(),
),
'assignee_user_id' => $ticket->assignee_user_id,
'author_user_id' => $ticket->author_user_id,
'blocked_comment' => $ticket->blocked_comment,