<?php
declare(strict_types=1);
namespace GNexus\GAuth\Tests\Unit\Config;
use GNexus\GAuth\Config\GAuthConfig;
use GNexus\GAuth\Exception\ConfigurationException;
use PHPUnit\Framework\TestCase;
final class GAuthConfigTest extends TestCase
{
public function testBuildsResolvedEndpointUrls(): void
{
$config = new GAuthConfig(
baseUrl: 'https://auth.example.test/',
clientId: 'billing',
clientSecret: 'secret',
redirectUri: 'https://billing.example.test/callback',
);
self::assertSame('https://auth.example.test/oauth/authorize', $config->authorizeUrl());
self::assertSame('https://auth.example.test/oauth/token', $config->tokenUrl());
self::assertSame('https://auth.example.test/oauth/refresh', $config->refreshUrl());
self::assertSame('https://auth.example.test/oauth/revoke', $config->revokeUrl());
self::assertSame('https://auth.example.test/oauth/userinfo', $config->userInfoUrl());
}
public function testRejectsInvalidBaseUrl(): void
{
$this->expectException(ConfigurationException::class);
new GAuthConfig(
baseUrl: 'not-a-url',
clientId: 'billing',
clientSecret: 'secret',
redirectUri: 'https://billing.example.test/callback',
);
}
}