|
4 | 4 |
|
5 | 5 | namespace Tempest\Auth\Tests; |
6 | 6 |
|
| 7 | +use League\OAuth2\Client\Provider\Apple; |
7 | 8 | use League\OAuth2\Client\Provider\Facebook; |
8 | 9 | use League\OAuth2\Client\Provider\Github; |
9 | 10 | use League\OAuth2\Client\Provider\Google; |
|
12 | 13 | use League\OAuth2\Client\Provider\ResourceOwnerInterface; |
13 | 14 | use PHPUnit\Framework\Attributes\Test; |
14 | 15 | use PHPUnit\Framework\TestCase; |
| 16 | +use Tempest\Auth\OAuth\Config\AppleOAuthConfig; |
15 | 17 | use Tempest\Auth\OAuth\Config\DiscordOAuthConfig; |
16 | 18 | use Tempest\Auth\OAuth\Config\FacebookOAuthConfig; |
17 | 19 | use Tempest\Auth\OAuth\Config\GenericOAuthConfig; |
@@ -143,6 +145,26 @@ public function discord_oauth_config(): void |
143 | 145 | $this->assertStringContainsString('discord-123', $url); |
144 | 146 | } |
145 | 147 |
|
| 148 | + #[Test] |
| 149 | + public function apple_oauth_config(): void |
| 150 | + { |
| 151 | + $config = new AppleOAuthConfig( |
| 152 | + clientId: 'apple-123', |
| 153 | + teamId: 'apple-team-id', |
| 154 | + keyId: 'apple-key-id', |
| 155 | + keyFile: 'apple-key-file', |
| 156 | + redirectTo: '/auth/apple/callback', |
| 157 | + scopes: ['email', 'name'], |
| 158 | + ); |
| 159 | + |
| 160 | + $provider = $config->createProvider(); |
| 161 | + $url = $provider->getAuthorizationUrl(); |
| 162 | + |
| 163 | + $this->assertInstanceOf(Apple::class, $provider); |
| 164 | + $this->assertStringContainsString('apple.com', $url); |
| 165 | + $this->assertStringContainsString('apple-123', $url); |
| 166 | + } |
| 167 | + |
146 | 168 | #[Test] |
147 | 169 | public function oauth_user_creation(): void |
148 | 170 | { |
|
0 commit comments