admin()->create(); $this->actingAs($user)->from(route('projects.create')) ->post(route('projects.store'), ['creation_mode' => $mode, 'name' => 'New project', 'key' => 'NEW']) ->assertRedirect(route('projects.create'))->assertSessionHasErrors($field); $this->assertDatabaseMissing('projects', ['key' => 'NEW']); } /** @return array */ public static function missingSources(): array { return ['duplicate' => ['duplicate', 'source_project_id'], 'template' => ['template', 'source_template_id']]; } public function test_an_unpublished_template_cannot_be_used_to_create_a_project(): void { $user = User::factory()->admin()->create(); $template = ProjectTemplate::factory()->create(['is_published' => false]); $this->actingAs($user)->post(route('projects.store'), [ 'creation_mode' => 'template', 'source_template_id' => $template->id, 'name' => 'New project', 'key' => 'NEW', ])->assertSessionHasErrors('source_template_id'); $this->assertDatabaseMissing('projects', ['key' => 'NEW']); } public function test_creation_page_rendering_and_localization(): void { $process = new Process(['node', 'tests/Fixtures/project-creation.mjs'], base_path()); $process->setTimeout(60); $process->run(); $this->assertTrue($process->isSuccessful(), $process->getOutput().$process->getErrorOutput()); $this->assertStringContainsString('Project creation rendering checks passed.', $process->getOutput()); } }