Show template inheritance overrides

This commit is contained in:
2026-05-25 01:53:03 +00:00
parent 5e6426067a
commit 57711b9659
16 changed files with 334 additions and 4 deletions
@@ -3,8 +3,10 @@
namespace Tests\Feature\Projects;
use App\Actions\ProjectTicketMetadata\InitializeProjectTicketMetadata;
use App\Actions\Projects\DuplicateProjectConfiguration;
use App\Models\BoardColumn;
use App\Models\Project;
use App\Models\ProjectTemplate;
use App\Models\Ticket;
use App\Models\TicketStatus;
use App\Models\User;
@@ -31,6 +33,15 @@ class ProjectBoardSettingsControllerTest extends TestCase
'position' => 1,
]);
$template = ProjectTemplate::factory()->create([
'configuration_snapshot' => app(DuplicateProjectConfiguration::class)->export($project, [
DuplicateProjectConfiguration::COPY_BOARD_WORKFLOW,
]),
'copy_areas' => [DuplicateProjectConfiguration::COPY_BOARD_WORKFLOW],
'name' => 'Starter Workflow',
]);
$project->update(['project_template_id' => $template->id]);
$this->syncProjectPermissions($project, $user, ['edit']);
$this->actingAs($user)
@@ -41,7 +52,9 @@ class ProjectBoardSettingsControllerTest extends TestCase
->where('project.id', $project->id)
->where('backlogTicketStatuses.0.name', 'Backlog')
->where('boardColumns.0.name', 'Todo')
->where('ticketStatuses.0.name', 'Backlog'),
->where('ticketStatuses.0.name', 'Backlog')
->where('templateState.templateName', 'Starter Workflow')
->where('templateState.inheritedAreas.0.value', DuplicateProjectConfiguration::COPY_BOARD_WORKFLOW),
);
}
@@ -2,10 +2,12 @@
namespace Tests\Feature\Projects;
use App\Actions\Projects\DuplicateProjectConfiguration;
use App\Enums\NotificationChannel;
use App\Enums\NotificationEventType;
use App\Models\NotificationAction;
use App\Models\Project;
use App\Models\ProjectTemplate;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Inertia\Testing\AssertableInertia as Assert;
@@ -41,6 +43,15 @@ class ProjectNotificationSettingsControllerTest extends TestCase
],
]);
$template = ProjectTemplate::factory()->create([
'configuration_snapshot' => app(DuplicateProjectConfiguration::class)->export($project, [
DuplicateProjectConfiguration::COPY_NOTIFICATION_ACTIONS,
]),
'copy_areas' => [DuplicateProjectConfiguration::COPY_NOTIFICATION_ACTIONS],
'name' => 'Alert Template',
]);
$project->update(['project_template_id' => $template->id]);
$this->syncProjectPermissions($project, $user, ['edit']);
$this->actingAs($user)
@@ -72,6 +83,8 @@ class ProjectNotificationSettingsControllerTest extends TestCase
->where('templateVariables.6.value', '$actor_name')
->where('templateVariables.7.value', '$assignee_from')
->where('templateVariables.8.value', '$assignee_to')
->where('templateState.templateName', 'Alert Template')
->where('templateState.inheritedAreas.0.value', DuplicateProjectConfiguration::COPY_NOTIFICATION_ACTIONS)
->missing('notificationActions.0.delivery_url'),
);
}
@@ -3,7 +3,9 @@
namespace Tests\Feature\Projects;
use App\Actions\Git\GitProviderKey;
use App\Actions\Projects\DuplicateProjectConfiguration;
use App\Models\Project;
use App\Models\ProjectTemplate;
use App\Models\RepositoryConnection;
use App\Models\User;
use App\Models\UserGitConnection;
@@ -36,6 +38,15 @@ class ProjectRepositorySettingsControllerTest extends TestCase
'repository_url' => 'https://git.example.test/core-team/kanbangit',
]);
$template = ProjectTemplate::factory()->create([
'configuration_snapshot' => app(DuplicateProjectConfiguration::class)->export($project, [
DuplicateProjectConfiguration::COPY_REPOSITORY_CONNECTIONS,
]),
'copy_areas' => [DuplicateProjectConfiguration::COPY_REPOSITORY_CONNECTIONS],
'name' => 'Connected Template',
]);
$project->update(['project_template_id' => $template->id]);
$this->syncProjectPermissions($project, $user, ['edit']);
$this->actingAs($user)
@@ -46,7 +57,9 @@ class ProjectRepositorySettingsControllerTest extends TestCase
->where('project.id', $project->id)
->where('repositoryConnections.0.repository_full_name', 'core-team/kanbangit')
->where('repositoryConnections.0.has_personal_access', false)
->where('availableRepositorySources', []),
->where('availableRepositorySources', [])
->where('templateState.templateName', 'Connected Template')
->where('templateState.inheritedAreas.0.value', DuplicateProjectConfiguration::COPY_REPOSITORY_CONNECTIONS),
);
}
@@ -3,7 +3,9 @@
namespace Tests\Feature\Projects;
use App\Actions\ProjectTicketMetadata\InitializeProjectTicketMetadata;
use App\Actions\Projects\DuplicateProjectConfiguration;
use App\Models\Project;
use App\Models\ProjectTemplate;
use App\Models\Ticket;
use App\Models\TicketFieldDefinition;
use App\Models\TicketLinkType;
@@ -37,6 +39,24 @@ class ProjectTicketMetadataSettingsControllerTest extends TestCase
'position' => 1,
]);
$template = ProjectTemplate::factory()->create([
'configuration_snapshot' => app(DuplicateProjectConfiguration::class)->export($project, [
DuplicateProjectConfiguration::COPY_PROJECT_SETTINGS,
DuplicateProjectConfiguration::COPY_TICKET_TYPES,
DuplicateProjectConfiguration::COPY_TICKET_LINK_TYPES,
]),
'copy_areas' => [
DuplicateProjectConfiguration::COPY_PROJECT_SETTINGS,
DuplicateProjectConfiguration::COPY_TICKET_TYPES,
DuplicateProjectConfiguration::COPY_TICKET_LINK_TYPES,
],
'name' => 'Issue Tracker Template',
]);
$project->update([
'project_template_id' => $template->id,
'show_story_points' => false,
]);
$this->syncProjectPermissions($project, $user, ['edit']);
$this->actingAs($user)
@@ -45,12 +65,14 @@ class ProjectTicketMetadataSettingsControllerTest extends TestCase
->assertInertia(fn (Assert $page) => $page
->component('projects/settings/Metadata')
->where('project.show_author', true)
->where('project.show_story_points', true)
->where('project.show_story_points', false)
->where('ticketTypes.0.name', 'Task')
->where('ticketTypes.1.name', 'Release')
->where('ticketTypes.1.is_parent', true)
->where('ticketTypes.2.name', 'Bug')
->where('ticketLinkTypes.0.label', 'Relates to'),
->where('ticketLinkTypes.0.label', 'Relates to')
->where('templateState.templateName', 'Issue Tracker Template')
->where('templateState.overriddenAreas.0.value', DuplicateProjectConfiguration::COPY_PROJECT_SETTINGS),
);
}