An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
<?php
use App\Models\Application;
it('generates commit links for direct repository remotes', function (string $repository, string $expected) {
$application = new Application;
$application->setRelation('source', null);
$application->git_repository = $repository;
expect($application->gitCommitLink('1234567890abcdef'))->toBe($expected);
})->with([
'HTTPS remote' => [
'https://github.com/coollabsio/coolify.git',
'https://github.com/coollabsio/coolify/commit/1234567890abcdef',
],
'SSH remote' => [
'[email protected]:coollabsio/coolify.git',
'https://github.com/coollabsio/coolify/commit/1234567890abcdef',
],
'SSH remote with custom username' => [
'[email protected]:coollabsio/coolify.git',
'https://git.example.com/coollabsio/coolify/commit/1234567890abcdef',
],
'SSH remote with custom username and port' => [
'[email protected]:2222/coollabsio/coolify.git',
'https://git.example.com/coollabsio/coolify/commit/1234567890abcdef',
],
'SSH URL' => [
'ssh://[email protected]/coollabsio/coolify.git',
'https://gitlab.com/coollabsio/coolify/commit/1234567890abcdef',
],
'Bitbucket HTTPS remote' => [
'https://bitbucket.org/coollabsio/coolify.git',
'https://bitbucket.org/coollabsio/coolify/commits/1234567890abcdef',
],
]);
it('does not generate commit links from incomplete repository URLs', function (string $repository) {
$application = new Application;
$application->setRelation('source', null);
$application->git_repository = $repository;
expect($application->gitCommitLink('1234567890abcdef'))->toBeNull();
})->with([
'missing host' => 'https://',
'missing scheme' => 'github.com/coollabsio/coolify',
'git protocol' => 'git://git.example.com/coollabsio/coolify.git',
]);
it('converts ssh remotes with generic usernames into https repository links', function (string $repository, string $expectedBranch, string $expectedCommits, string $expectedWebhook) {
$application = new Application;
$application->setRelation('source', null);
$application->git_repository = $repository;
$application->git_branch = 'main';
$application->base_directory = '/';
expect($application->gitBranchLocation)->toBe($expectedBranch)
->and($application->gitCommits)->toBe($expectedCommits)
->and($application->gitWebhook)->toBe($expectedWebhook);
})->with([
'git username' => [
'[email protected]:coollabsio/coolify.git',
'https://github.com/coollabsio/coolify/tree/main/',
'https://github.com/coollabsio/coolify/commits/main',
'https://github.com/coollabsio/coolify/settings/hooks',
],
'custom username' => [
'[email protected]:organization/repository.git',
'https://git.example.com/organization/repository/tree/main/',
'https://git.example.com/organization/repository/commits/main',
'https://git.example.com/organization/repository/settings/hooks',
],
'custom username and port' => [
'[email protected]:2222/organization/repository.git',
'https://git.example.com/organization/repository/tree/main/',
'https://git.example.com/organization/repository/commits/main',
'https://git.example.com/organization/repository/settings/hooks',
],
'ssh scheme with port' => [
'ssh://[email protected]:2222/organization/repository.git',
'https://gitea.example.com/organization/repository/tree/main/',
'https://gitea.example.com/organization/repository/commits/main',
'https://gitea.example.com/organization/repository/settings/hooks',
],
]);