Make projects depend on templates

This commit is contained in:
2026-09-08 10:25:52 +00:00
committed by Twyco
parent 40f9b473fc
commit fef82cb88f
19 changed files with 281 additions and 14 deletions
+7
View File
@@ -43,6 +43,7 @@ class ProjectApiTest extends TestCase
$this->withApplicationKey($user)
->postJson(route('api.projects.store'), [
'creation_mode' => 'scratch',
'key' => 'api',
'name' => 'API Project',
])
@@ -52,8 +53,11 @@ class ProjectApiTest extends TestCase
->assertJsonPath('meta.message', 'API Project was created.');
$project = Project::query()->where('key', 'API')->firstOrFail();
$project->refresh();
$this->assertSame(2, $project->ticketTypes()->count());
$this->assertSame(1, $project->ticketStatuses()->count());
$this->assertNotNull($project->project_template_id);
}
public function test_users_can_create_projects_from_templates_via_api(): void
@@ -96,6 +100,9 @@ class ProjectApiTest extends TestCase
$project = Project::query()->where('key', 'TPL1')->firstOrFail();
$project->refresh();
$this->assertSame($template->id, $project->project_template_id);
$this->assertFalse($project->show_author);
$this->assertFalse($project->show_story_points);
$this->assertSame(['Spike'], $project->ticketTypes()->pluck('name')->all());