Simplify acceptance criteria checklist model
linter / quality (pull_request) Successful in 1m16s
tests / ci (8.4) (pull_request) Successful in 1m30s

This commit is contained in:
2026-05-19 22:44:28 +00:00
parent 7805bd057e
commit 689db9e41b
16 changed files with 140 additions and 363 deletions
@@ -84,7 +84,7 @@ class ProjectBacklogTest extends TestCase
->post(route('projects.tickets.store', $project), [
'title' => 'New ticket',
'description' => 'Description',
'acceptance_criteria' => 'Criteria',
'acceptance_criteria' => '- [ ] Criteria',
'ticket_type_id' => $project->ticketTypes()->firstOrFail()->id,
'ticket_priority_id' => $priority->id,
'ticket_status_id' => $backlogStatus->id,
@@ -118,7 +118,7 @@ class ProjectBacklogTest extends TestCase
$payload = [
'title' => 'Same title',
'description' => 'Description',
'acceptance_criteria' => 'Criteria',
'acceptance_criteria' => '- [ ] Criteria',
'assignee_user_id' => $assignee->id,
'story_points' => 3,
'ticket_type_id' => $project->ticketTypes()->firstOrFail()->id,
@@ -192,7 +192,7 @@ class ProjectBacklogTest extends TestCase
->post(route('projects.tickets.store', $project), [
'title' => 'New ticket',
'description' => 'Description',
'acceptance_criteria' => 'Criteria',
'acceptance_criteria' => '- [ ] Criteria',
'ticket_type_id' => $project->ticketTypes()->firstOrFail()->id,
'ticket_priority_id' => $project->ticketPriorities()->firstOrFail()->id,
'ticket_status_id' => $boardStatus->id,
@@ -56,7 +56,7 @@ class ProjectTicketControllerTest extends TestCase
'position' => 1,
]);
$legacyAcceptanceCriteria = "Review checklist\n- [ ] User can sign in\n - [x] Nested verification";
$legacyAcceptanceCriteria = "- [ ] User can sign in\n - [x] Nested verification";
$ticket = Ticket::factory()->create([
'acceptance_criteria' => $legacyAcceptanceCriteria,
@@ -110,14 +110,12 @@ class ProjectTicketControllerTest extends TestCase
->where('project.show_author', false)
->where('ticket.ticket_key', 'CORE-1')
->where('ticket.story_points', 5)
->where('ticket.acceptance_criteria.summary', 'Review checklist')
->where('ticket.acceptance_criteria.items.0.text', 'User can sign in')
->where('ticket.acceptance_criteria.items.0.checked', false)
->where('ticket.acceptance_criteria.items.0.indent', 0)
->where('ticket.acceptance_criteria.items.1.text', 'Nested verification')
->where('ticket.acceptance_criteria.items.1.checked', true)
->where('ticket.acceptance_criteria.items.1.indent', 1)
->where('ticket.acceptance_criteria_text', $legacyAcceptanceCriteria)
->where('ticket.acceptance_criteria.0.text', 'User can sign in')
->where('ticket.acceptance_criteria.0.checked', false)
->where('ticket.acceptance_criteria.0.indent', 0)
->where('ticket.acceptance_criteria.1.text', 'Nested verification')
->where('ticket.acceptance_criteria.1.checked', true)
->where('ticket.acceptance_criteria.1.indent', 1)
->where('ticket.assignee.name', 'Assigned User')
->where('ticket.author', null)
->where('ticket.author_user_id', null)
@@ -350,7 +348,7 @@ class ProjectTicketControllerTest extends TestCase
$this->actingAs($editor)
->post(route('projects.tickets.store', $project), [
'acceptance_criteria' => 'The ticket exists.',
'acceptance_criteria' => '- [ ] The ticket exists.',
'assignee_user_id' => $assignee->id,
'description' => 'Created from the dedicated page.',
'story_points' => 5,
@@ -448,7 +446,7 @@ class ProjectTicketControllerTest extends TestCase
]);
$ticket = Ticket::factory()->create([
'acceptance_criteria' => 'Old acceptance criteria',
'acceptance_criteria' => '- [ ] Old acceptance criteria',
'author_user_id' => $author->id,
'description' => 'Old description',
'project_id' => $project->id,
@@ -475,18 +473,15 @@ class ProjectTicketControllerTest extends TestCase
$this->syncProjectPermissions($project, $editor, ['write', 'view']);
$updatedAcceptanceCriteria = [
'summary' => 'Updated acceptance criteria',
'items' => [
[
'text' => 'Shows success banner',
'checked' => false,
'indent' => 0,
],
[
'text' => 'Includes nested confirmations',
'checked' => true,
'indent' => 1,
],
[
'text' => 'Shows success banner',
'checked' => false,
'indent' => 0,
],
[
'text' => 'Includes nested confirmations',
'checked' => true,
'indent' => 1,
],
];
@@ -520,7 +515,7 @@ class ProjectTicketControllerTest extends TestCase
'id' => $ticket->id,
'title' => 'Updated title',
'description' => 'Updated description',
'acceptance_criteria' => "Updated acceptance criteria\n\n- [ ] Shows success banner\n - [x] Includes nested confirmations",
'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,
@@ -531,7 +526,7 @@ class ProjectTicketControllerTest extends TestCase
$this->assertEquals(
$updatedAcceptanceCriteria,
\App\Actions\Tickets\Support\TicketAcceptanceCriteriaData::fromModels(
\App\Actions\Tickets\Support\AcceptanceCriteriaChecklist::fromModels(
$ticket->acceptanceCriteria,
$ticket->acceptance_criteria,
),