Fix KAN-3 project template flows

This commit is contained in:
2026-09-08 10:25:52 +00:00
parent db8855a056
commit fed6a282a4
13 changed files with 143 additions and 91 deletions
@@ -192,15 +192,32 @@ class ProjectTemplateControllerTest extends TestCase
'show_author' => false,
'show_story_points' => false,
]);
TicketType::factory()->create([
'project_id' => $sourceProject->id,
'name' => 'Feature',
'position' => 1,
'is_parent' => false,
]);
$template = ProjectTemplate::factory()->create([
'name' => 'Platform Template',
'slug' => 'platform-template',
'copy_areas' => [DuplicateProjectConfiguration::COPY_PROJECT_SETTINGS],
'copy_areas' => [
DuplicateProjectConfiguration::COPY_PROJECT_SETTINGS,
DuplicateProjectConfiguration::COPY_TICKET_TYPES,
],
'configuration_snapshot' => [
DuplicateProjectConfiguration::COPY_PROJECT_SETTINGS => [
'show_author' => false,
'show_story_points' => false,
],
DuplicateProjectConfiguration::COPY_TICKET_TYPES => [
[
'name' => 'Bug',
'position' => 1,
'is_parent' => false,
],
],
],
'source_project_id' => $sourceProject->id,
]);
@@ -214,6 +231,18 @@ class ProjectTemplateControllerTest extends TestCase
'show_author' => true,
'show_story_points' => false,
]);
TicketType::factory()->create([
'project_id' => $inheritingProject->id,
'name' => 'Bug',
'position' => 1,
'is_parent' => false,
]);
TicketType::factory()->create([
'project_id' => $overriddenProject->id,
'name' => 'Custom',
'position' => 1,
'is_parent' => false,
]);
$sourceProject->forceFill([
'show_author' => true,
@@ -226,7 +255,10 @@ class ProjectTemplateControllerTest extends TestCase
->patch(route('project-templates.update', $template), [
'name' => 'Platform Template v2',
'slug' => 'should-not-change',
'copy_areas' => [DuplicateProjectConfiguration::COPY_PROJECT_SETTINGS],
'copy_areas' => [
DuplicateProjectConfiguration::COPY_PROJECT_SETTINGS,
DuplicateProjectConfiguration::COPY_TICKET_TYPES,
],
'confirm_linked_projects_update' => true,
])
->assertRedirect('/project-templates');
@@ -242,12 +274,26 @@ class ProjectTemplateControllerTest extends TestCase
'show_author' => true,
'show_story_points' => true,
],
DuplicateProjectConfiguration::COPY_TICKET_TYPES => [
[
'name' => 'Feature',
'position' => 1,
'is_parent' => false,
],
],
], $template->configuration_snapshot);
$this->assertTrue($inheritingProject->show_author);
$this->assertTrue($inheritingProject->show_story_points);
$this->assertSame(['Feature'], $inheritingProject->ticketTypes()->pluck('name')->all());
$this->assertDatabaseHas('ticket_types', [
'project_id' => $inheritingProject->id,
'project_template_id' => $template->id,
'name' => 'Feature',
]);
$this->assertTrue($overriddenProject->show_author);
$this->assertFalse($overriddenProject->show_story_points);
$this->assertSame(['Custom'], $overriddenProject->ticketTypes()->pluck('name')->all());
}
}