37 lines
1.6 KiB
PHP
37 lines
1.6 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Models\ProviderCredential;
|
|
use App\Support\Providers\ProviderConnectionType;
|
|
use App\Support\Providers\ProviderCredentialSource;
|
|
use App\Support\Providers\ProviderVerificationStatus;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
it('keeps the default provider credential path tied to a dedicated connection without extra health side effects', function (): void {
|
|
$credential = ProviderCredential::factory()->create();
|
|
$connection = $credential->providerConnection()->first();
|
|
|
|
expect($connection)->not->toBeNull()
|
|
->and($connection?->connection_type->value)->toBe(ProviderConnectionType::Dedicated->value)
|
|
->and($connection?->is_default)->toBeFalse();
|
|
});
|
|
|
|
it('can opt into a verified dedicated connection graph explicitly', function (): void {
|
|
$credential = ProviderCredential::factory()->verifiedConnection()->create();
|
|
$connection = $credential->providerConnection()->first();
|
|
|
|
expect($connection)->not->toBeNull()
|
|
->and($connection?->is_default)->toBeTrue()
|
|
->and($connection?->verification_status->value)->toBe(ProviderVerificationStatus::Healthy->value)
|
|
->and($connection?->credential?->is($credential))->toBeTrue();
|
|
});
|
|
|
|
it('keeps legacy migrated credentials available through an explicit named state', function (): void {
|
|
$credential = ProviderCredential::factory()->legacyMigrated()->create();
|
|
|
|
expect($credential->source->value)->toBe(ProviderCredentialSource::LegacyMigrated->value)
|
|
->and($credential->expires_at)->toBeNull();
|
|
}); |