'file']); Storage::fake('ssh-keys'); InstanceSettings::unguarded(fn () => InstanceSettings::firstOrCreate(['id' => 0])); $this->team = Team::factory()->create(); $this->user = User::factory()->create(); $this->team->members()->attach($this->user->id, ['role' => 'owner']); session(['currentTeam' => $this->team]); $this->bearerToken = $this->user->createToken('public-ssh-url-api-test', ['*'])->plainTextToken; $this->server = Server::factory()->create(['team_id' => $this->team->id]); $this->destination = StandaloneDocker::where('server_id', $this->server->id)->first(); $this->project = Project::factory()->create(['team_id' => $this->team->id]); $this->environment = Environment::factory()->create(['project_id' => $this->project->id]); }); test('public application api converts ssh urls to https', function (string $gitRepository) { $response = $this->withHeaders([ 'Authorization' => 'Bearer '.$this->bearerToken, 'Content-Type' => 'application/json', ])->postJson('/api/v1/applications/public', [ 'project_uuid' => $this->project->uuid, 'environment_uuid' => $this->environment->uuid, 'server_uuid' => $this->server->uuid, 'git_repository' => $gitRepository, 'git_branch' => 'main', 'build_pack' => 'nixpacks', 'ports_exposes' => '3000', 'autogenerate_domain' => false, ]); $response->assertCreated(); $application = Application::where('uuid', $response->json('uuid'))->firstOrFail(); expect($application->git_repository)->toBe('https://git.example.com/organization/repository.git'); })->with([ 'scp-style with port' => 'custom-user@git.example.com:2222/organization/repository.git', 'ssh scheme with port' => 'ssh://custom-user@git.example.com:2222/organization/repository.git', ]);