Gitlab Self-managed Support (#56)

* Update UI to ask for URL for Gitlab as provider.

* Create state for each source control in factory.

* Save url for SourceControl when given.

* Make Gitlab dynamically use correct URL (custom or default)

* Update SourceControlsTest to check for custom url when given.

* Style fixes.

---------

Co-authored-by: Saeed Vaziry <61919774+saeedvaziry@users.noreply.github.com>
This commit is contained in:
Koen Hendriks
2023-09-25 10:11:01 +02:00
committed by GitHub
parent 7d98986f52
commit 1e1204fe40
7 changed files with 176 additions and 14 deletions

View File

@ -17,21 +17,28 @@ class SourceControlsTest extends TestCase
/**
* @dataProvider data
*/
public function test_connect_provider(string $provider): void
public function test_connect_provider(string $provider, ?string $customUrl): void
{
$this->actingAs($this->user);
Http::fake();
Livewire::test(Connect::class)
$livewire = Livewire::test(Connect::class)
->set('token', 'token')
->set('name', 'profile')
->set('provider', $provider)
->set('provider', $provider);
if ($customUrl !== null) {
$livewire->set('url', $customUrl);
}
$livewire
->call('connect')
->assertSuccessful();
$this->assertDatabaseHas('source_controls', [
'provider' => $provider,
'url' => $customUrl,
]);
}
@ -61,9 +68,10 @@ public function test_delete_provider(string $provider): void
public static function data(): array
{
return [
['github'],
['gitlab'],
['bitbucket'],
['github', null],
['gitlab', null],
['gitlab', 'https://git.example.com/'],
['bitbucket', null],
];
}
}