diff --git a/tests/Attributes/Provider.php b/tests/Attributes/Provider.php new file mode 100644 index 0000000..987b718 --- /dev/null +++ b/tests/Attributes/Provider.php @@ -0,0 +1,30 @@ + + * @copyright 2024 smiley + * @license MIT + */ +declare(strict_types = 1); + +namespace chillerlan\OAuthTest\Attributes; + +use Attribute; + +/** + * Supplies the provider class name + */ +#[Attribute(Attribute::TARGET_CLASS)] +final class Provider{ + + public function __construct( + private readonly string $className, + ){} + + public function className():string{ + return $this->className; + } + +} diff --git a/tests/Providers/Live/AmazonAPITest.php b/tests/Providers/Live/AmazonAPITest.php index 1636c0b..bc91e6a 100644 --- a/tests/Providers/Live/AmazonAPITest.php +++ b/tests/Providers/Live/AmazonAPITest.php @@ -14,18 +14,16 @@ use chillerlan\OAuth\Core\{AccessToken, AuthenticatedUser, UnauthorizedAccessException}; use chillerlan\OAuth\Providers\Amazon; use chillerlan\OAuth\Storage\MemoryStorage; +use chillerlan\OAuthTest\Attributes\Provider; use PHPUnit\Framework\Attributes\Group; /** * @property \chillerlan\OAuth\Providers\Amazon $provider */ #[Group('providerLiveTest')] +#[Provider(Amazon::class)] final class AmazonAPITest extends OAuth2ProviderLiveTestAbstract{ - protected function getProviderFQCN():string{ - return Amazon::class; - } - protected function assertMeResponse(AuthenticatedUser $user):void{ $this::assertMatchesRegularExpression('/[a-z\d.]+/i', $user->id); } diff --git a/tests/Providers/Live/BattleNetAPITest.php b/tests/Providers/Live/BattleNetAPITest.php index 94b6bfd..e4a94a8 100644 --- a/tests/Providers/Live/BattleNetAPITest.php +++ b/tests/Providers/Live/BattleNetAPITest.php @@ -13,6 +13,7 @@ use chillerlan\OAuth\Core\AuthenticatedUser; use chillerlan\OAuth\Providers\BattleNet; +use chillerlan\OAuthTest\Attributes\Provider; use PHPUnit\Framework\Attributes\Group; use function explode; @@ -21,12 +22,9 @@ */ #[Group('shortTokenExpiry')] #[Group('providerLiveTest')] +#[Provider(BattleNet::class)] final class BattleNetAPITest extends OAuth2ProviderLiveTestAbstract{ - protected function getProviderFQCN():string{ - return BattleNet::class; - } - protected function assertMeResponse(AuthenticatedUser $user):void{ $this::assertSame($this->TEST_USER, explode('#', $user->handle)[0]); } diff --git a/tests/Providers/Live/BigCartelAPITest.php b/tests/Providers/Live/BigCartelAPITest.php index acf4af0..04c6c1e 100644 --- a/tests/Providers/Live/BigCartelAPITest.php +++ b/tests/Providers/Live/BigCartelAPITest.php @@ -12,16 +12,14 @@ namespace chillerlan\OAuthTest\Providers\Live; use chillerlan\OAuth\Providers\BigCartel; +use chillerlan\OAuthTest\Attributes\Provider; use PHPUnit\Framework\Attributes\Group; /** * @property \chillerlan\OAuth\Providers\BigCartel $provider */ #[Group('providerLiveTest')] +#[Provider(BigCartel::class)] final class BigCartelAPITest extends OAuth2ProviderLiveTestAbstract{ - protected function getProviderFQCN():string{ - return BigCartel::class; - } - } diff --git a/tests/Providers/Live/BitbucketAPITest.php b/tests/Providers/Live/BitbucketAPITest.php index ec9e508..397f5e8 100644 --- a/tests/Providers/Live/BitbucketAPITest.php +++ b/tests/Providers/Live/BitbucketAPITest.php @@ -12,16 +12,14 @@ namespace chillerlan\OAuthTest\Providers\Live; use chillerlan\OAuth\Providers\Bitbucket; +use chillerlan\OAuthTest\Attributes\Provider; use PHPUnit\Framework\Attributes\Group; /** * @property \chillerlan\OAuth\Providers\Bitbucket $provider */ #[Group('providerLiveTest')] +#[Provider(Bitbucket::class)] final class BitbucketAPITest extends OAuth2ProviderLiveTestAbstract{ - protected function getProviderFQCN():string{ - return Bitbucket::class; - } - } diff --git a/tests/Providers/Live/CodebergAPITest.php b/tests/Providers/Live/CodebergAPITest.php index 86b5771..f5a9b26 100644 --- a/tests/Providers/Live/CodebergAPITest.php +++ b/tests/Providers/Live/CodebergAPITest.php @@ -12,16 +12,14 @@ namespace chillerlan\OAuthTest\Providers\Live; use chillerlan\OAuth\Providers\Codeberg; +use chillerlan\OAuthTest\Attributes\Provider; use PHPUnit\Framework\Attributes\Group; /** * @property \chillerlan\OAuth\Providers\Codeberg $provider */ #[Group('providerLiveTest')] +#[Provider(Codeberg::class)] class CodebergAPITest extends OAuth2ProviderLiveTestAbstract{ - protected function getProviderFQCN():string{ - return Codeberg::class; - } - } diff --git a/tests/Providers/Live/DeezerAPITest.php b/tests/Providers/Live/DeezerAPITest.php index de31860..b173467 100644 --- a/tests/Providers/Live/DeezerAPITest.php +++ b/tests/Providers/Live/DeezerAPITest.php @@ -12,6 +12,7 @@ namespace chillerlan\OAuthTest\Providers\Live; use chillerlan\OAuth\Providers\Deezer; +use chillerlan\OAuthTest\Attributes\Provider; use PHPUnit\Framework\Attributes\Group; /** @@ -19,10 +20,7 @@ */ #[Group('shortTokenExpiry')] #[Group('providerLiveTest')] +#[Provider(Deezer::class)] final class DeezerAPITest extends OAuth2ProviderLiveTestAbstract{ - protected function getProviderFQCN():string{ - return Deezer::class; - } - } diff --git a/tests/Providers/Live/DeviantArtAPITest.php b/tests/Providers/Live/DeviantArtAPITest.php index ae7fc0d..c43b0be 100644 --- a/tests/Providers/Live/DeviantArtAPITest.php +++ b/tests/Providers/Live/DeviantArtAPITest.php @@ -12,6 +12,7 @@ namespace chillerlan\OAuthTest\Providers\Live; use chillerlan\OAuth\Providers\DeviantArt; +use chillerlan\OAuthTest\Attributes\Provider; use PHPUnit\Framework\Attributes\Group; /** @@ -19,10 +20,7 @@ */ #[Group('shortTokenExpiry')] #[Group('providerLiveTest')] +#[Provider(DeviantArt::class)] final class DeviantArtAPITest extends OAuth2ProviderLiveTestAbstract{ - protected function getProviderFQCN():string{ - return DeviantArt::class; - } - } diff --git a/tests/Providers/Live/DiscogsAPITest.php b/tests/Providers/Live/DiscogsAPITest.php index 86f78c2..c21d51d 100644 --- a/tests/Providers/Live/DiscogsAPITest.php +++ b/tests/Providers/Live/DiscogsAPITest.php @@ -12,16 +12,14 @@ namespace chillerlan\OAuthTest\Providers\Live; use chillerlan\OAuth\Providers\Discogs; +use chillerlan\OAuthTest\Attributes\Provider; use PHPUnit\Framework\Attributes\Group; /** * @property \chillerlan\OAuth\Providers\Discogs $provider */ #[Group('providerLiveTest')] +#[Provider(Discogs::class)] final class DiscogsAPITest extends OAuth1ProviderLiveTestAbstract{ - protected function getProviderFQCN():string{ - return Discogs::class; - } - } diff --git a/tests/Providers/Live/DiscordAPITest.php b/tests/Providers/Live/DiscordAPITest.php index c92efcc..8cf8661 100644 --- a/tests/Providers/Live/DiscordAPITest.php +++ b/tests/Providers/Live/DiscordAPITest.php @@ -13,18 +13,16 @@ use chillerlan\OAuth\Core\AccessToken; use chillerlan\OAuth\Providers\Discord; +use chillerlan\OAuthTest\Attributes\Provider; use PHPUnit\Framework\Attributes\Group; /** * @property \chillerlan\OAuth\Providers\Discord $provider */ #[Group('providerLiveTest')] +#[Provider(Discord::class)] final class DiscordAPITest extends OAuth2ProviderLiveTestAbstract{ - protected function getProviderFQCN():string{ - return Discord::class; - } - public function testRequestCredentialsToken():void{ $token = $this->provider->getClientCredentialsToken([Discord::SCOPE_CONNECTIONS, Discord::SCOPE_IDENTIFY]); diff --git a/tests/Providers/Live/FlickrAPITest.php b/tests/Providers/Live/FlickrAPITest.php index d2d2b81..a825e4f 100644 --- a/tests/Providers/Live/FlickrAPITest.php +++ b/tests/Providers/Live/FlickrAPITest.php @@ -12,19 +12,17 @@ namespace chillerlan\OAuthTest\Providers\Live; use chillerlan\OAuth\Providers\Flickr; +use chillerlan\OAuthTest\Attributes\Provider; use PHPUnit\Framework\Attributes\Group; /** * @property \chillerlan\OAuth\Providers\Flickr $provider */ #[Group('providerLiveTest')] +#[Provider(Flickr::class)] final class FlickrAPITest extends OAuth1ProviderLiveTestAbstract{ protected string $test_name; protected string $test_id; - protected function getProviderFQCN():string{ - return Flickr::class; - } - } diff --git a/tests/Providers/Live/FoursquareAPITest.php b/tests/Providers/Live/FoursquareAPITest.php index f4d670e..cff619c 100644 --- a/tests/Providers/Live/FoursquareAPITest.php +++ b/tests/Providers/Live/FoursquareAPITest.php @@ -12,16 +12,14 @@ namespace chillerlan\OAuthTest\Providers\Live; use chillerlan\OAuth\Providers\Foursquare; +use chillerlan\OAuthTest\Attributes\Provider; use PHPUnit\Framework\Attributes\Group; /** * @property \chillerlan\OAuth\Providers\Foursquare $provider */ #[Group('providerLiveTest')] +#[Provider(Foursquare::class)] final class FoursquareAPITest extends OAuth2ProviderLiveTestAbstract{ - protected function getProviderFQCN():string{ - return Foursquare::class; - } - } diff --git a/tests/Providers/Live/GitHubAPITest.php b/tests/Providers/Live/GitHubAPITest.php index cec077f..86465ce 100644 --- a/tests/Providers/Live/GitHubAPITest.php +++ b/tests/Providers/Live/GitHubAPITest.php @@ -12,16 +12,14 @@ namespace chillerlan\OAuthTest\Providers\Live; use chillerlan\OAuth\Providers\GitHub; +use chillerlan\OAuthTest\Attributes\Provider; use PHPUnit\Framework\Attributes\Group; /** * @property \chillerlan\OAuth\Providers\GitHub $provider */ #[Group('providerLiveTest')] +#[Provider(GitHub::class)] final class GitHubAPITest extends OAuth2ProviderLiveTestAbstract{ - protected function getProviderFQCN():string{ - return GitHub::class; - } - } diff --git a/tests/Providers/Live/GitLabAPITest.php b/tests/Providers/Live/GitLabAPITest.php index 050ebd6..91e971a 100644 --- a/tests/Providers/Live/GitLabAPITest.php +++ b/tests/Providers/Live/GitLabAPITest.php @@ -12,6 +12,7 @@ namespace chillerlan\OAuthTest\Providers\Live; use chillerlan\OAuth\Providers\GitLab; +use chillerlan\OAuthTest\Attributes\Provider; use PHPUnit\Framework\Attributes\Group; /** @@ -19,10 +20,7 @@ */ #[Group('shortTokenExpiry')] #[Group('providerLiveTest')] +#[Provider(GitLab::class)] final class GitLabAPITest extends OAuth2ProviderLiveTestAbstract{ - protected function getProviderFQCN():string{ - return GitLab::class; - } - } diff --git a/tests/Providers/Live/GiteaAPITest.php b/tests/Providers/Live/GiteaAPITest.php index 83c7a10..c31cf1f 100644 --- a/tests/Providers/Live/GiteaAPITest.php +++ b/tests/Providers/Live/GiteaAPITest.php @@ -12,16 +12,14 @@ namespace chillerlan\OAuthTest\Providers\Live; use chillerlan\OAuth\Providers\Gitea; +use chillerlan\OAuthTest\Attributes\Provider; use PHPUnit\Framework\Attributes\Group; /** * @property \chillerlan\OAuth\Providers\Gitea $provider */ #[Group('providerLiveTest')] +#[Provider(Gitea::class)] class GiteaAPITest extends OAuth2ProviderLiveTestAbstract{ - protected function getProviderFQCN():string{ - return Gitea::class; - } - } diff --git a/tests/Providers/Live/GoogleAPITest.php b/tests/Providers/Live/GoogleAPITest.php index 06e3d8f..0e699f4 100644 --- a/tests/Providers/Live/GoogleAPITest.php +++ b/tests/Providers/Live/GoogleAPITest.php @@ -13,6 +13,7 @@ use chillerlan\OAuth\Core\AuthenticatedUser; use chillerlan\OAuth\Providers\Google; +use chillerlan\OAuthTest\Attributes\Provider; use PHPUnit\Framework\Attributes\Group; /** @@ -20,12 +21,9 @@ */ #[Group('shortTokenExpiry')] #[Group('providerLiveTest')] +#[Provider(Google::class)] final class GoogleAPITest extends OAuth2ProviderLiveTestAbstract{ - protected function getProviderFQCN():string{ - return Google::class; - } - protected function assertMeResponse(AuthenticatedUser $user):void{ $this::assertSame($this->TEST_USER, $user->email); } diff --git a/tests/Providers/Live/GuildWars2APITest.php b/tests/Providers/Live/GuildWars2APITest.php index 9d10be8..a6a0acb 100644 --- a/tests/Providers/Live/GuildWars2APITest.php +++ b/tests/Providers/Live/GuildWars2APITest.php @@ -14,21 +14,19 @@ use chillerlan\OAuth\Core\AccessToken; use chillerlan\OAuth\Core\AuthenticatedUser; use chillerlan\OAuth\Providers\GuildWars2; +use chillerlan\OAuthTest\Attributes\Provider; use PHPUnit\Framework\Attributes\Group; /** * @property \chillerlan\OAuth\Providers\GuildWars2 $provider */ #[Group('providerLiveTest')] +#[Provider(GuildWars2::class)] final class GuildWars2APITest extends OAuth2ProviderLiveTestAbstract{ protected AccessToken $token; protected string $tokenname; - protected function getProviderFQCN():string{ - return GuildWars2::class; - } - protected function setUp():void{ parent::setUp(); diff --git a/tests/Providers/Live/ImgurAPITest.php b/tests/Providers/Live/ImgurAPITest.php index c88ed31..68a2607 100644 --- a/tests/Providers/Live/ImgurAPITest.php +++ b/tests/Providers/Live/ImgurAPITest.php @@ -12,16 +12,14 @@ namespace chillerlan\OAuthTest\Providers\Live; use chillerlan\OAuth\Providers\Imgur; +use chillerlan\OAuthTest\Attributes\Provider; use PHPUnit\Framework\Attributes\Group; /** * @property \chillerlan\OAuth\Providers\Imgur $provider */ #[Group('providerLiveTest')] +#[Provider(Imgur::class)] final class ImgurAPITest extends OAuth2ProviderLiveTestAbstract{ - protected function getProviderFQCN():string{ - return Imgur::class; - } - } diff --git a/tests/Providers/Live/LastFMAPITest.php b/tests/Providers/Live/LastFMAPITest.php index 986631e..60e19aa 100644 --- a/tests/Providers/Live/LastFMAPITest.php +++ b/tests/Providers/Live/LastFMAPITest.php @@ -12,16 +12,14 @@ namespace chillerlan\OAuthTest\Providers\Live; use chillerlan\OAuth\Providers\LastFM; +use chillerlan\OAuthTest\Attributes\Provider; use PHPUnit\Framework\Attributes\Group; /** * @property \chillerlan\OAuth\Providers\LastFM $provider */ #[Group('providerLiveTest')] +#[Provider(LastFM::class)] final class LastFMAPITest extends OAuthProviderLiveTestAbstract{ - protected function getProviderFQCN():string{ - return LastFM::class; - } - } diff --git a/tests/Providers/Live/MailChimpAPITest.php b/tests/Providers/Live/MailChimpAPITest.php index 0469e14..7c39126 100644 --- a/tests/Providers/Live/MailChimpAPITest.php +++ b/tests/Providers/Live/MailChimpAPITest.php @@ -12,18 +12,16 @@ namespace chillerlan\OAuthTest\Providers\Live; use chillerlan\OAuth\Providers\MailChimp; +use chillerlan\OAuthTest\Attributes\Provider; use PHPUnit\Framework\Attributes\Group; /** * @property \chillerlan\OAuth\Providers\MailChimp $provider */ #[Group('providerLiveTest')] +#[Provider(MailChimp::class)] final class MailChimpAPITest extends OAuth2ProviderLiveTestAbstract{ - protected function getProviderFQCN():string{ - return MailChimp::class; - } - public function testGetTokenMetadata():void{ $token = $this->storage->getAccessToken($this->provider->name); $token = $this->provider->getTokenMetadata($token); diff --git a/tests/Providers/Live/MastodonAPITest.php b/tests/Providers/Live/MastodonAPITest.php index a2bbfe1..99eb55e 100644 --- a/tests/Providers/Live/MastodonAPITest.php +++ b/tests/Providers/Live/MastodonAPITest.php @@ -12,20 +12,18 @@ namespace chillerlan\OAuthTest\Providers\Live; use chillerlan\OAuth\Providers\Mastodon; +use chillerlan\OAuthTest\Attributes\Provider; use PHPUnit\Framework\Attributes\Group; /** * @property \chillerlan\OAuth\Providers\Mastodon $provider */ #[Group('providerLiveTest')] +#[Provider(Mastodon::class)] final class MastodonAPITest extends OAuth2ProviderLiveTestAbstract{ protected string $testInstance; - protected function getProviderFQCN():string{ - return Mastodon::class; - } - protected function setUp():void{ parent::setUp(); diff --git a/tests/Providers/Live/MicrosoftGraphAPITest.php b/tests/Providers/Live/MicrosoftGraphAPITest.php index d7b22a3..fe1de7a 100644 --- a/tests/Providers/Live/MicrosoftGraphAPITest.php +++ b/tests/Providers/Live/MicrosoftGraphAPITest.php @@ -12,6 +12,7 @@ namespace chillerlan\OAuthTest\Providers\Live; use chillerlan\OAuth\Providers\MicrosoftGraph; +use chillerlan\OAuthTest\Attributes\Provider; use PHPUnit\Framework\Attributes\Group; /** @@ -19,10 +20,7 @@ */ #[Group('shortTokenExpiry')] #[Group('providerLiveTest')] +#[Provider(MicrosoftGraph::class)] final class MicrosoftGraphAPITest extends OAuth2ProviderLiveTestAbstract{ - protected function getProviderFQCN():string{ - return MicrosoftGraph::class; - } - } diff --git a/tests/Providers/Live/MixcloudAPITest.php b/tests/Providers/Live/MixcloudAPITest.php index 932c6ba..c532c1a 100644 --- a/tests/Providers/Live/MixcloudAPITest.php +++ b/tests/Providers/Live/MixcloudAPITest.php @@ -12,16 +12,14 @@ namespace chillerlan\OAuthTest\Providers\Live; use chillerlan\OAuth\Providers\Mixcloud; +use chillerlan\OAuthTest\Attributes\Provider; use PHPUnit\Framework\Attributes\Group; /** * @property \chillerlan\OAuth\Providers\Mixcloud $provider */ #[Group('providerLiveTest')] +#[Provider(Mixcloud::class)] final class MixcloudAPITest extends OAuth2ProviderLiveTestAbstract{ - protected function getProviderFQCN():string{ - return Mixcloud::class; - } - } diff --git a/tests/Providers/Live/MusicBrainzAPITest.php b/tests/Providers/Live/MusicBrainzAPITest.php index a90c838..dd6a23a 100644 --- a/tests/Providers/Live/MusicBrainzAPITest.php +++ b/tests/Providers/Live/MusicBrainzAPITest.php @@ -14,18 +14,16 @@ use chillerlan\HTTP\Utils\MessageUtil; use chillerlan\OAuth\Providers\MusicBrainz; use chillerlan\OAuth\Providers\ProviderException; +use chillerlan\OAuthTest\Attributes\Provider; use PHPUnit\Framework\Attributes\Group; /** * @property \chillerlan\OAuth\Providers\MusicBrainz $provider */ #[Group('providerLiveTest')] +#[Provider(MusicBrainz::class)] final class MusicBrainzAPITest extends OAuth2ProviderLiveTestAbstract{ - protected function getProviderFQCN():string{ - return MusicBrainz::class; - } - public function testArtistId():void{ try{ $response = $this->provider->request( diff --git a/tests/Providers/Live/NPROneAPITest.php b/tests/Providers/Live/NPROneAPITest.php index 7c69cc5..340a2ec 100644 --- a/tests/Providers/Live/NPROneAPITest.php +++ b/tests/Providers/Live/NPROneAPITest.php @@ -13,6 +13,7 @@ use chillerlan\OAuth\Core\AuthenticatedUser; use chillerlan\OAuth\Providers\NPROne; +use chillerlan\OAuthTest\Attributes\Provider; use PHPUnit\Framework\Attributes\Group; /** @@ -20,12 +21,9 @@ */ #[Group('shortTokenExpiry')] #[Group('providerLiveTest')] +#[Provider(NPROne::class)] final class NPROneAPITest extends OAuth2ProviderLiveTestAbstract{ - protected function getProviderFQCN():string{ - return NPROne::class; - } - protected function assertMeResponse(AuthenticatedUser $user):void{ $this::assertSame($this->TEST_USER, $user->email); } diff --git a/tests/Providers/Live/OpenCachingAPITest.php b/tests/Providers/Live/OpenCachingAPITest.php index 96b6e6a..610725b 100644 --- a/tests/Providers/Live/OpenCachingAPITest.php +++ b/tests/Providers/Live/OpenCachingAPITest.php @@ -12,16 +12,14 @@ namespace chillerlan\OAuthTest\Providers\Live; use chillerlan\OAuth\Providers\OpenCaching; +use chillerlan\OAuthTest\Attributes\Provider; use PHPUnit\Framework\Attributes\Group; /** * @property \chillerlan\OAuth\Providers\OpenCaching $provider */ #[Group('providerLiveTest')] +#[Provider(OpenCaching::class)] final class OpenCachingAPITest extends OAuth1ProviderLiveTestAbstract{ - protected function getProviderFQCN():string{ - return OpenCaching::class; - } - } diff --git a/tests/Providers/Live/OpenStreetmap2APITest.php b/tests/Providers/Live/OpenStreetmap2APITest.php index b0a430e..381b419 100644 --- a/tests/Providers/Live/OpenStreetmap2APITest.php +++ b/tests/Providers/Live/OpenStreetmap2APITest.php @@ -13,18 +13,16 @@ use chillerlan\OAuth\Core\AuthenticatedUser; use chillerlan\OAuth\Providers\OpenStreetmap2; +use chillerlan\OAuthTest\Attributes\Provider; use PHPUnit\Framework\Attributes\Group; /** * @property \chillerlan\OAuth\Providers\OpenStreetmap2 $provider */ #[Group('providerLiveTest')] +#[Provider(OpenStreetmap2::class)] final class OpenStreetmap2APITest extends OAuth2ProviderLiveTestAbstract{ - protected function getProviderFQCN():string{ - return OpenStreetmap2::class; - } - protected function assertMeResponse(AuthenticatedUser $user):void{ $this::assertSame($this->TEST_USER, $user->displayName); } diff --git a/tests/Providers/Live/OpenStreetmapAPITest.php b/tests/Providers/Live/OpenStreetmapAPITest.php index 63a920a..764de63 100644 --- a/tests/Providers/Live/OpenStreetmapAPITest.php +++ b/tests/Providers/Live/OpenStreetmapAPITest.php @@ -13,18 +13,16 @@ use chillerlan\OAuth\Core\AuthenticatedUser; use chillerlan\OAuth\Providers\OpenStreetmap; +use chillerlan\OAuthTest\Attributes\Provider; use PHPUnit\Framework\Attributes\Group; /** * @property \chillerlan\OAuth\Providers\OpenStreetmap $provider */ #[Group('providerLiveTest')] +#[Provider(OpenStreetmap::class)] final class OpenStreetmapAPITest extends OAuth1ProviderLiveTestAbstract{ - protected function getProviderFQCN():string{ - return OpenStreetmap::class; - } - protected function assertMeResponse(AuthenticatedUser $user):void{ $this::assertSame($this->TEST_USER, $user->displayName); } diff --git a/tests/Providers/Live/PatreonAPITest.php b/tests/Providers/Live/PatreonAPITest.php index 5864e2b..13bbf45 100644 --- a/tests/Providers/Live/PatreonAPITest.php +++ b/tests/Providers/Live/PatreonAPITest.php @@ -12,6 +12,7 @@ namespace chillerlan\OAuthTest\Providers\Live; use chillerlan\OAuth\Providers\Patreon; +use chillerlan\OAuthTest\Attributes\Provider; use PHPUnit\Framework\Attributes\Group; /** @@ -19,10 +20,7 @@ */ #[Group('shortTokenExpiry')] #[Group('providerLiveTest')] +#[Provider(Patreon::class)] final class PatreonAPITest extends OAuth2ProviderLiveTestAbstract{ - protected function getProviderFQCN():string{ - return Patreon::class; - } - } diff --git a/tests/Providers/Live/PayPalAPITest.php b/tests/Providers/Live/PayPalAPITest.php index f6d1cae..590a385 100644 --- a/tests/Providers/Live/PayPalAPITest.php +++ b/tests/Providers/Live/PayPalAPITest.php @@ -13,6 +13,7 @@ use chillerlan\OAuth\Core\AuthenticatedUser; use chillerlan\OAuth\Providers\PayPal; +use chillerlan\OAuthTest\Attributes\Provider; use PHPUnit\Framework\Attributes\Group; /** @@ -20,12 +21,9 @@ */ #[Group('shortTokenExpiry')] #[Group('providerLiveTest')] +#[Provider(PayPal::class)] final class PayPalAPITest extends OAuth2ProviderLiveTestAbstract{ - protected function getProviderFQCN():string{ - return PayPal::class; - } - protected function assertMeResponse(AuthenticatedUser $user):void{ $this::assertSame($this->TEST_USER, $user->email); } diff --git a/tests/Providers/Live/PinterestAPITest.php b/tests/Providers/Live/PinterestAPITest.php index 8425f9c..a7d32aa 100644 --- a/tests/Providers/Live/PinterestAPITest.php +++ b/tests/Providers/Live/PinterestAPITest.php @@ -12,16 +12,14 @@ namespace chillerlan\OAuthTest\Providers\Live; use chillerlan\OAuth\Providers\Pinterest; +use chillerlan\OAuthTest\Attributes\Provider; use PHPUnit\Framework\Attributes\Group; /** * @property \chillerlan\OAuth\Providers\Pinterest $provider */ #[Group('providerLiveTest')] +#[Provider(Pinterest::class)] class PinterestAPITest extends OAuth2ProviderLiveTestAbstract{ - protected function getProviderFQCN():string{ - return Pinterest::class; - } - } diff --git a/tests/Providers/Live/RedditAPITest.php b/tests/Providers/Live/RedditAPITest.php index cfa81a9..c6ea7c1 100644 --- a/tests/Providers/Live/RedditAPITest.php +++ b/tests/Providers/Live/RedditAPITest.php @@ -12,6 +12,7 @@ namespace chillerlan\OAuthTest\Providers\Live; use chillerlan\OAuth\Providers\Reddit; +use chillerlan\OAuthTest\Attributes\Provider; use PHPUnit\Framework\Attributes\Group; /** @@ -19,10 +20,7 @@ */ #[Group('shortTokenExpiry')] #[Group('providerLiveTest')] +#[Provider(Reddit::class)] class RedditAPITest extends OAuth2ProviderLiveTestAbstract{ - protected function getProviderFQCN():string{ - return Reddit::class; - } - } diff --git a/tests/Providers/Live/SlackAPITest.php b/tests/Providers/Live/SlackAPITest.php index d2dff1d..3419bc4 100644 --- a/tests/Providers/Live/SlackAPITest.php +++ b/tests/Providers/Live/SlackAPITest.php @@ -13,18 +13,16 @@ use chillerlan\OAuth\Core\AuthenticatedUser; use chillerlan\OAuth\Providers\Slack; +use chillerlan\OAuthTest\Attributes\Provider; use PHPUnit\Framework\Attributes\Group; /** * @property \chillerlan\OAuth\Providers\Slack $provider */ #[Group('providerLiveTest')] +#[Provider(Slack::class)] final class SlackAPITest extends OAuth2ProviderLiveTestAbstract{ - protected function getProviderFQCN():string{ - return Slack::class; - } - protected function assertMeResponse(AuthenticatedUser $user):void{ $this::assertSame($this->TEST_USER, $user->email); } diff --git a/tests/Providers/Live/SoundcloudAPITest.php b/tests/Providers/Live/SoundcloudAPITest.php index ce974da..b0cd150 100644 --- a/tests/Providers/Live/SoundcloudAPITest.php +++ b/tests/Providers/Live/SoundcloudAPITest.php @@ -12,18 +12,16 @@ namespace chillerlan\OAuthTest\Providers\Live; use chillerlan\OAuth\Providers\SoundCloud; +use chillerlan\OAuthTest\Attributes\Provider; use PHPUnit\Framework\Attributes\Group; /** * @property \chillerlan\OAuth\Providers\SoundCloud $provider */ #[Group('providerLiveTest')] +#[Provider(SoundCloud::class)] final class SoundcloudAPITest extends OAuth2ProviderLiveTestAbstract{ - protected function getProviderFQCN():string{ - return SoundCloud::class; - } - public function testRequestCredentialsToken():void{ $this::markTestSkipped('may fail because SoundCloud deleted older applications'); } diff --git a/tests/Providers/Live/SpotifyAPITest.php b/tests/Providers/Live/SpotifyAPITest.php index 1f363b2..5729cc8 100644 --- a/tests/Providers/Live/SpotifyAPITest.php +++ b/tests/Providers/Live/SpotifyAPITest.php @@ -12,16 +12,14 @@ namespace chillerlan\OAuthTest\Providers\Live; use chillerlan\OAuth\Providers\Spotify; +use chillerlan\OAuthTest\Attributes\Provider; use PHPUnit\Framework\Attributes\Group; /** * @property \chillerlan\OAuth\Providers\Spotify $provider */ #[Group('providerLiveTest')] +#[Provider(Spotify::class)] final class SpotifyAPITest extends OAuth2ProviderLiveTestAbstract{ - protected function getProviderFQCN():string{ - return Spotify::class; - } - } diff --git a/tests/Providers/Live/SteamAPITest.php b/tests/Providers/Live/SteamAPITest.php index 5c2cff9..0f3fcac 100644 --- a/tests/Providers/Live/SteamAPITest.php +++ b/tests/Providers/Live/SteamAPITest.php @@ -13,20 +13,18 @@ use chillerlan\OAuth\Core\AuthenticatedUser; use chillerlan\OAuth\Providers\Steam; +use chillerlan\OAuthTest\Attributes\Provider; use PHPUnit\Framework\Attributes\Group; /** * @property \chillerlan\OAuth\Providers\Steam $provider */ #[Group('providerLiveTest')] +#[Provider(Steam::class)] final class SteamAPITest extends OAuthProviderLiveTestAbstract{ protected int $id; - protected function getProviderFQCN():string{ - return Steam::class; - } - protected function setUp():void{ parent::setUp(); diff --git a/tests/Providers/Live/StripeAPITest.php b/tests/Providers/Live/StripeAPITest.php index 39ed054..87f2608 100644 --- a/tests/Providers/Live/StripeAPITest.php +++ b/tests/Providers/Live/StripeAPITest.php @@ -13,18 +13,16 @@ use chillerlan\OAuth\Core\AuthenticatedUser; use chillerlan\OAuth\Providers\Stripe; +use chillerlan\OAuthTest\Attributes\Provider; use PHPUnit\Framework\Attributes\Group; /** * @property \chillerlan\OAuth\Providers\Stripe $provider */ #[Group('providerLiveTest')] +#[Provider(Stripe::class)] final class StripeAPITest extends OAuth2ProviderLiveTestAbstract{ - protected function getProviderFQCN():string{ - return Stripe::class; - } - protected function assertMeResponse(AuthenticatedUser $user):void{ $this::assertSame($this->TEST_USER, $user->id); } diff --git a/tests/Providers/Live/Tumblr2APITest.php b/tests/Providers/Live/Tumblr2APITest.php index 5ba08f2..5311269 100644 --- a/tests/Providers/Live/Tumblr2APITest.php +++ b/tests/Providers/Live/Tumblr2APITest.php @@ -12,16 +12,14 @@ namespace chillerlan\OAuthTest\Providers\Live; use chillerlan\OAuth\Providers\Tumblr2; +use chillerlan\OAuthTest\Attributes\Provider; use PHPUnit\Framework\Attributes\Group; /** * @property \chillerlan\OAuth\Providers\Tumblr2 $provider */ #[Group('providerLiveTest')] +#[Provider(Tumblr2::class)] final class Tumblr2APITest extends OAuth2ProviderLiveTestAbstract{ - protected function getProviderFQCN():string{ - return Tumblr2::class; - } - } diff --git a/tests/Providers/Live/TumblrAPITest.php b/tests/Providers/Live/TumblrAPITest.php index d16e6ca..b9d157c 100644 --- a/tests/Providers/Live/TumblrAPITest.php +++ b/tests/Providers/Live/TumblrAPITest.php @@ -12,18 +12,16 @@ namespace chillerlan\OAuthTest\Providers\Live; use chillerlan\OAuth\Providers\Tumblr; +use chillerlan\OAuthTest\Attributes\Provider; use PHPUnit\Framework\Attributes\Group; /** * @property \chillerlan\OAuth\Providers\Tumblr $provider */ #[Group('providerLiveTest')] +#[Provider(Tumblr::class)] final class TumblrAPITest extends OAuth1ProviderLiveTestAbstract{ - protected function getProviderFQCN():string{ - return Tumblr::class; - } - public function testTokenExchange():void{ // only outcomment if wou want to deliberately invaildate your current token $this::markTestSkipped('N/A - will invalidate the current token'); diff --git a/tests/Providers/Live/TwitchAPITest.php b/tests/Providers/Live/TwitchAPITest.php index e5a2296..d966225 100644 --- a/tests/Providers/Live/TwitchAPITest.php +++ b/tests/Providers/Live/TwitchAPITest.php @@ -12,16 +12,14 @@ namespace chillerlan\OAuthTest\Providers\Live; use chillerlan\OAuth\Providers\Twitch; +use chillerlan\OAuthTest\Attributes\Provider; use PHPUnit\Framework\Attributes\Group; /** * @property \chillerlan\OAuth\Providers\Twitch $provider */ #[Group('providerLiveTest')] +#[Provider(Twitch::class)] final class TwitchAPITest extends OAuth2ProviderLiveTestAbstract{ - protected function getProviderFQCN():string{ - return Twitch::class; - } - } diff --git a/tests/Providers/Live/TwitterAPITest.php b/tests/Providers/Live/TwitterAPITest.php index d521da4..6cfa5bc 100644 --- a/tests/Providers/Live/TwitterAPITest.php +++ b/tests/Providers/Live/TwitterAPITest.php @@ -12,19 +12,17 @@ namespace chillerlan\OAuthTest\Providers\Live; use chillerlan\OAuth\Providers\Twitter; +use chillerlan\OAuthTest\Attributes\Provider; use PHPUnit\Framework\Attributes\Group; /** * @property \chillerlan\OAuth\Providers\Twitter $provider */ #[Group('providerLiveTest')] +#[Provider(Twitter::class)] final class TwitterAPITest extends OAuth1ProviderLiveTestAbstract{ protected string $screen_name; protected int $user_id; - protected function getProviderFQCN():string{ - return Twitter::class; - } - } diff --git a/tests/Providers/Live/TwitterCCAPITest.php b/tests/Providers/Live/TwitterCCAPITest.php index db27551..7a3feb3 100644 --- a/tests/Providers/Live/TwitterCCAPITest.php +++ b/tests/Providers/Live/TwitterCCAPITest.php @@ -12,18 +12,16 @@ namespace chillerlan\OAuthTest\Providers\Live; use chillerlan\OAuth\Providers\TwitterCC; +use chillerlan\OAuthTest\Attributes\Provider; use PHPUnit\Framework\Attributes\Group; /** * @property \chillerlan\OAuth\Providers\TwitterCC $provider */ #[Group('providerLiveTest')] +#[Provider(TwitterCC::class)] final class TwitterCCAPITest extends OAuth2ProviderLiveTestAbstract{ - protected function getProviderFQCN():string{ - return TwitterCC::class; - } - public function testMeUnauthorizedAccessException():void{ $this::markTestSkipped('N/A'); } diff --git a/tests/Providers/Live/VimeoAPITest.php b/tests/Providers/Live/VimeoAPITest.php index 46b1b2f..7352d85 100644 --- a/tests/Providers/Live/VimeoAPITest.php +++ b/tests/Providers/Live/VimeoAPITest.php @@ -12,16 +12,14 @@ namespace chillerlan\OAuthTest\Providers\Live; use chillerlan\OAuth\Providers\Vimeo; +use chillerlan\OAuthTest\Attributes\Provider; use PHPUnit\Framework\Attributes\Group; /** * @property \chillerlan\OAuth\Providers\Vimeo $provider */ #[Group('providerLiveTest')] +#[Provider(Vimeo::class)] final class VimeoAPITest extends OAuth2ProviderLiveTestAbstract{ - protected function getProviderFQCN():string{ - return Vimeo::class; - } - } diff --git a/tests/Providers/Live/WordpressAPITest.php b/tests/Providers/Live/WordpressAPITest.php index 34c4673..6d7a2d9 100644 --- a/tests/Providers/Live/WordpressAPITest.php +++ b/tests/Providers/Live/WordpressAPITest.php @@ -12,16 +12,14 @@ namespace chillerlan\OAuthTest\Providers\Live; use chillerlan\OAuth\Providers\WordPress; +use chillerlan\OAuthTest\Attributes\Provider; use PHPUnit\Framework\Attributes\Group; /** * @property \chillerlan\OAuth\Providers\WordPress $provider */ #[Group('providerLiveTest')] +#[Provider(WordPress::class)] final class WordpressAPITest extends OAuth2ProviderLiveTestAbstract{ - protected function getProviderFQCN():string{ - return WordPress::class; - } - } diff --git a/tests/Providers/Live/YouTubeAPITest.php b/tests/Providers/Live/YouTubeAPITest.php index 81370a8..cb2a8fe 100644 --- a/tests/Providers/Live/YouTubeAPITest.php +++ b/tests/Providers/Live/YouTubeAPITest.php @@ -13,6 +13,7 @@ use chillerlan\OAuth\Core\AuthenticatedUser; use chillerlan\OAuth\Providers\YouTube; +use chillerlan\OAuthTest\Attributes\Provider; use PHPUnit\Framework\Attributes\Group; /** @@ -20,12 +21,9 @@ */ #[Group('shortTokenExpiry')] #[Group('providerLiveTest')] +#[Provider(YouTube::class)] final class YouTubeAPITest extends OAuth2ProviderLiveTestAbstract{ - protected function getProviderFQCN():string{ - return YouTube::class; - } - protected function assertMeResponse(AuthenticatedUser $user):void{ $this::assertSame($this->TEST_USER, $user->email); } diff --git a/tests/Providers/ProviderUnitTestAbstract.php b/tests/Providers/ProviderUnitTestAbstract.php index 2136713..a86a210 100644 --- a/tests/Providers/ProviderUnitTestAbstract.php +++ b/tests/Providers/ProviderUnitTestAbstract.php @@ -17,6 +17,7 @@ use chillerlan\OAuth\OAuthProviderFactory; use chillerlan\OAuth\Storage\MemoryStorage; use chillerlan\OAuth\Storage\OAuthStorageInterface; +use chillerlan\OAuthTest\Attributes\Provider; use chillerlan\PHPUnitHttp\HttpFactoryTrait; use InvalidArgumentException; use PHPUnit\Framework\TestCase; @@ -25,7 +26,9 @@ use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\StreamInterface; use Psr\Log\LoggerInterface; -use ReflectionClass; +use ReflectionAttribute; +use ReflectionObject; +use RuntimeException; use Throwable; use function constant; use function defined; @@ -44,7 +47,7 @@ abstract class ProviderUnitTestAbstract extends TestCase{ protected OAuthOptions $options; protected OAuthStorageInterface $storage; protected OAuthInterface $provider; - protected ReflectionClass $reflection; // reflection of the test subject + protected ReflectionObject $reflection; // reflection of the test subject protected string $HTTP_CLIENT_FACTORY = ProviderUnitTestHttpClientFactory::class; @@ -77,7 +80,7 @@ protected function setUp():void{ ); $this->provider = $this->providerFactory->getProvider($this->getProviderFQCN(), $this->options, $this->storage); - $this->reflection = new ReflectionClass($this->provider); + $this->reflection = new ReflectionObject($this->provider); } catch(Throwable $e){ $this->markTestSkipped(sprintf("unable to init provider test: %s\n\n%s", $e->getMessage(), $e->getTraceAsString())); @@ -86,16 +89,6 @@ protected function setUp():void{ } - /* - * abstract methods - */ - - /** - * returns the fully qualified class name (FQCN) of the test subject - */ - abstract protected function getProviderFQCN():string; - - /* * init dependencies */ @@ -142,6 +135,21 @@ final protected function invokeReflectionMethod(string $method, array $args = [] return $this->reflection->getMethod($method)->invokeArgs($this->provider, $args); } + /** + * returns the fully qualified class name (FQCN) of the test subject + * + * @see \chillerlan\OAuthTest\Attributes\Provider + */ + final protected function getProviderFQCN():string{ + $attributes = (new ReflectionObject($this))->getAttributes(Provider::class, ReflectionAttribute::IS_INSTANCEOF); + + if(empty($attributes)){ + throw new RuntimeException('attribute "Provider" not set'); + } + + return $attributes[0]->newInstance()->className(); + } + /* * misc helpers diff --git a/tests/Providers/Unit/AmazonTest.php b/tests/Providers/Unit/AmazonTest.php index eb9dfa8..ad8ff2c 100644 --- a/tests/Providers/Unit/AmazonTest.php +++ b/tests/Providers/Unit/AmazonTest.php @@ -12,14 +12,12 @@ namespace chillerlan\OAuthTest\Providers\Unit; use chillerlan\OAuth\Providers\Amazon; +use chillerlan\OAuthTest\Attributes\Provider; /** * @property \chillerlan\OAuth\Providers\Amazon $provider */ +#[Provider(Amazon::class)] final class AmazonTest extends OAuth2ProviderUnitTestAbstract{ - protected function getProviderFQCN():string{ - return Amazon::class; - } - } diff --git a/tests/Providers/Unit/BattleNetTest.php b/tests/Providers/Unit/BattleNetTest.php index 20cc77f..db8a06e 100644 --- a/tests/Providers/Unit/BattleNetTest.php +++ b/tests/Providers/Unit/BattleNetTest.php @@ -13,17 +13,15 @@ use chillerlan\OAuth\Providers\BattleNet; use chillerlan\OAuth\Providers\ProviderException; +use chillerlan\OAuthTest\Attributes\Provider; use PHPUnit\Framework\Attributes\DataProvider; /** * @property \chillerlan\OAuth\Providers\BattleNet $provider */ +#[Provider(BattleNet::class)] final class BattleNetTest extends OAuth2ProviderUnitTestAbstract{ - protected function getProviderFQCN():string{ - return BattleNet::class; - } - public function testSetRegion():void{ $this->provider->setRegion('cn'); $this::assertSame('https://gateway.battlenet.com.cn', $this->provider->apiURL); diff --git a/tests/Providers/Unit/BigCartelTest.php b/tests/Providers/Unit/BigCartelTest.php index 588b855..49ffbf8 100644 --- a/tests/Providers/Unit/BigCartelTest.php +++ b/tests/Providers/Unit/BigCartelTest.php @@ -13,16 +13,14 @@ use chillerlan\OAuth\Core\{AccessToken, TokenInvalidate}; use chillerlan\OAuth\Providers\BigCartel; +use chillerlan\OAuthTest\Attributes\Provider; /** * @property \chillerlan\OAuth\Providers\BigCartel $provider */ +#[Provider(BigCartel::class)] final class BigCartelTest extends OAuth2ProviderUnitTestAbstract{ - protected function getProviderFQCN():string{ - return BigCartel::class; - } - public function testTokenInvalidate():void{ if(!$this->provider instanceof TokenInvalidate){ diff --git a/tests/Providers/Unit/BitbucketTest.php b/tests/Providers/Unit/BitbucketTest.php index 4b52052..639f770 100644 --- a/tests/Providers/Unit/BitbucketTest.php +++ b/tests/Providers/Unit/BitbucketTest.php @@ -12,14 +12,12 @@ namespace chillerlan\OAuthTest\Providers\Unit; use chillerlan\OAuth\Providers\Bitbucket; +use chillerlan\OAuthTest\Attributes\Provider; /** * @property \chillerlan\OAuth\Providers\Bitbucket $provider */ +#[Provider(Bitbucket::class)] final class BitbucketTest extends OAuth2ProviderUnitTestAbstract{ - protected function getProviderFQCN():string{ - return Bitbucket::class; - } - } diff --git a/tests/Providers/Unit/CodebergTest.php b/tests/Providers/Unit/CodebergTest.php index 1e48cc4..754b352 100644 --- a/tests/Providers/Unit/CodebergTest.php +++ b/tests/Providers/Unit/CodebergTest.php @@ -12,14 +12,12 @@ namespace chillerlan\OAuthTest\Providers\Unit; use chillerlan\OAuth\Providers\Codeberg; +use chillerlan\OAuthTest\Attributes\Provider; /** * @property \chillerlan\OAuth\Providers\Codeberg $provider */ +#[Provider(Codeberg::class)] class CodebergTest extends OAuth2ProviderUnitTestAbstract{ - protected function getProviderFQCN():string{ - return Codeberg::class; - } - } diff --git a/tests/Providers/Unit/DeezerTest.php b/tests/Providers/Unit/DeezerTest.php index 07d6ae7..ca42706 100644 --- a/tests/Providers/Unit/DeezerTest.php +++ b/tests/Providers/Unit/DeezerTest.php @@ -15,19 +15,18 @@ use chillerlan\OAuth\Core\UnauthorizedAccessException; use chillerlan\OAuth\Providers\Deezer; use chillerlan\OAuth\Providers\ProviderException; +use chillerlan\OAuthTest\Attributes\Provider; use function implode; /** * @property \chillerlan\OAuth\Providers\Deezer $provider */ +#[Provider(Deezer::class)] final class DeezerTest extends OAuth2ProviderUnitTestAbstract{ protected const TEST_TOKEN = 'access_token=2YotnFZFEjr1zCsicMWpAA&token_type=example&expires=3600&'. 'refresh_token=tGzv3JOkF0XG5Qx2TlKWIA&example_parameter=example_value'; - protected function getProviderFQCN():string{ - return Deezer::class; - } public function testParseTokenResponseWithScopes():void{ $this::markTestSkipped('N/A'); diff --git a/tests/Providers/Unit/DeviantArtTest.php b/tests/Providers/Unit/DeviantArtTest.php index e749fc6..c5dab9e 100644 --- a/tests/Providers/Unit/DeviantArtTest.php +++ b/tests/Providers/Unit/DeviantArtTest.php @@ -13,16 +13,14 @@ use chillerlan\OAuth\Core\{AccessToken, TokenInvalidate}; use chillerlan\OAuth\Providers\DeviantArt; +use chillerlan\OAuthTest\Attributes\Provider; /** * @property \chillerlan\OAuth\Providers\DeviantArt $provider */ +#[Provider(DeviantArt::class)] final class DeviantArtTest extends OAuth2ProviderUnitTestAbstract{ - protected function getProviderFQCN():string{ - return DeviantArt::class; - } - public function testTokenInvalidate():void{ if(!$this->provider instanceof TokenInvalidate){ diff --git a/tests/Providers/Unit/DiscogsTest.php b/tests/Providers/Unit/DiscogsTest.php index 1942aa1..e9f7488 100644 --- a/tests/Providers/Unit/DiscogsTest.php +++ b/tests/Providers/Unit/DiscogsTest.php @@ -12,14 +12,12 @@ namespace chillerlan\OAuthTest\Providers\Unit; use chillerlan\OAuth\Providers\Discogs; +use chillerlan\OAuthTest\Attributes\Provider; /** * @property \chillerlan\OAuth\Providers\Discogs $provider */ +#[Provider(Discogs::class)] final class DiscogsTest extends OAuth1ProviderUnitTestAbstract{ - protected function getProviderFQCN():string{ - return Discogs::class; - } - } diff --git a/tests/Providers/Unit/DiscordTest.php b/tests/Providers/Unit/DiscordTest.php index a55ca16..942f9f8 100644 --- a/tests/Providers/Unit/DiscordTest.php +++ b/tests/Providers/Unit/DiscordTest.php @@ -12,14 +12,12 @@ namespace chillerlan\OAuthTest\Providers\Unit; use chillerlan\OAuth\Providers\Discord; +use chillerlan\OAuthTest\Attributes\Provider; /** * @property \chillerlan\OAuth\Providers\Discord $provider */ +#[Provider(Discord::class)] final class DiscordTest extends OAuth2ProviderUnitTestAbstract{ - protected function getProviderFQCN():string{ - return Discord::class; - } - } diff --git a/tests/Providers/Unit/FlickrTest.php b/tests/Providers/Unit/FlickrTest.php index 6261ab3..21e47b9 100644 --- a/tests/Providers/Unit/FlickrTest.php +++ b/tests/Providers/Unit/FlickrTest.php @@ -12,16 +12,14 @@ namespace chillerlan\OAuthTest\Providers\Unit; use chillerlan\OAuth\Providers\Flickr; +use chillerlan\OAuthTest\Attributes\Provider; /** * @property \chillerlan\OAuth\Providers\Flickr $provider */ +#[Provider(Flickr::class)] final class FlickrTest extends OAuth1ProviderUnitTestAbstract{ - protected function getProviderFQCN():string{ - return Flickr::class; - } - public function testRequest():void{ $this::markTestIncomplete(); } diff --git a/tests/Providers/Unit/FoursquareTest.php b/tests/Providers/Unit/FoursquareTest.php index 72c919d..40e8995 100644 --- a/tests/Providers/Unit/FoursquareTest.php +++ b/tests/Providers/Unit/FoursquareTest.php @@ -12,14 +12,12 @@ namespace chillerlan\OAuthTest\Providers\Unit; use chillerlan\OAuth\Providers\Foursquare; +use chillerlan\OAuthTest\Attributes\Provider; /** * @property \chillerlan\OAuth\Providers\Foursquare $provider */ +#[Provider(Foursquare::class)] final class FoursquareTest extends OAuth2ProviderUnitTestAbstract{ - protected function getProviderFQCN():string{ - return Foursquare::class; - } - } diff --git a/tests/Providers/Unit/GitHubTest.php b/tests/Providers/Unit/GitHubTest.php index 7c3384d..df26632 100644 --- a/tests/Providers/Unit/GitHubTest.php +++ b/tests/Providers/Unit/GitHubTest.php @@ -12,14 +12,12 @@ namespace chillerlan\OAuthTest\Providers\Unit; use chillerlan\OAuth\Providers\GitHub; +use chillerlan\OAuthTest\Attributes\Provider; /** * @property \chillerlan\OAuth\Providers\GitHub $provider */ +#[Provider(GitHub::class)] final class GitHubTest extends OAuth2ProviderUnitTestAbstract{ - protected function getProviderFQCN():string{ - return GitHub::class; - } - } diff --git a/tests/Providers/Unit/GitLabTest.php b/tests/Providers/Unit/GitLabTest.php index 24da2a2..cbac762 100644 --- a/tests/Providers/Unit/GitLabTest.php +++ b/tests/Providers/Unit/GitLabTest.php @@ -12,14 +12,12 @@ namespace chillerlan\OAuthTest\Providers\Unit; use chillerlan\OAuth\Providers\GitLab; +use chillerlan\OAuthTest\Attributes\Provider; /** * @property \chillerlan\OAuth\Providers\GitLab $provider */ +#[Provider(GitLab::class)] final class GitLabTest extends OAuth2ProviderUnitTestAbstract{ - protected function getProviderFQCN():string{ - return GitLab::class; - } - } diff --git a/tests/Providers/Unit/GiteaTest.php b/tests/Providers/Unit/GiteaTest.php index 09cf99e..894b091 100644 --- a/tests/Providers/Unit/GiteaTest.php +++ b/tests/Providers/Unit/GiteaTest.php @@ -12,14 +12,12 @@ namespace chillerlan\OAuthTest\Providers\Unit; use chillerlan\OAuth\Providers\Gitea; +use chillerlan\OAuthTest\Attributes\Provider; /** * @property \chillerlan\OAuth\Providers\Gitea $provider */ +#[Provider(Gitea::class)] class GiteaTest extends OAuth2ProviderUnitTestAbstract{ - protected function getProviderFQCN():string{ - return Gitea::class; - } - } diff --git a/tests/Providers/Unit/GoogleTest.php b/tests/Providers/Unit/GoogleTest.php index 38a2e2e..5f43271 100644 --- a/tests/Providers/Unit/GoogleTest.php +++ b/tests/Providers/Unit/GoogleTest.php @@ -12,14 +12,12 @@ namespace chillerlan\OAuthTest\Providers\Unit; use chillerlan\OAuth\Providers\Google; +use chillerlan\OAuthTest\Attributes\Provider; /** * @property \chillerlan\OAuth\Providers\Google $provider */ +#[Provider(Google::class)] final class GoogleTest extends OAuth2ProviderUnitTestAbstract{ - protected function getProviderFQCN():string{ - return Google::class; - } - } diff --git a/tests/Providers/Unit/GuildWars2Test.php b/tests/Providers/Unit/GuildWars2Test.php index 42701d3..68516cd 100644 --- a/tests/Providers/Unit/GuildWars2Test.php +++ b/tests/Providers/Unit/GuildWars2Test.php @@ -12,16 +12,14 @@ namespace chillerlan\OAuthTest\Providers\Unit; use chillerlan\OAuth\Providers\GuildWars2; +use chillerlan\OAuthTest\Attributes\Provider; /** * @property \chillerlan\OAuth\Providers\GuildWars2 $provider */ +#[Provider(GuildWars2::class)] final class GuildWars2Test extends OAuth2ProviderUnitTestAbstract{ - protected function getProviderFQCN():string{ - return GuildWars2::class; - } - public function testGetAuthURL():void{ $this::markTestSkipped('N/A'); } diff --git a/tests/Providers/Unit/ImgurTest.php b/tests/Providers/Unit/ImgurTest.php index ebcf4af..babe60e 100644 --- a/tests/Providers/Unit/ImgurTest.php +++ b/tests/Providers/Unit/ImgurTest.php @@ -12,14 +12,12 @@ namespace chillerlan\OAuthTest\Providers\Unit; use chillerlan\OAuth\Providers\Imgur; +use chillerlan\OAuthTest\Attributes\Provider; /** * @property \chillerlan\OAuth\Providers\Imgur $provider */ +#[Provider(Imgur::class)] final class ImgurTest extends OAuth2ProviderUnitTestAbstract{ - protected function getProviderFQCN():string{ - return Imgur::class; - } - } diff --git a/tests/Providers/Unit/LastFMTest.php b/tests/Providers/Unit/LastFMTest.php index f1225e6..e3a89f9 100644 --- a/tests/Providers/Unit/LastFMTest.php +++ b/tests/Providers/Unit/LastFMTest.php @@ -12,12 +12,14 @@ namespace chillerlan\OAuthTest\Providers\Unit; use chillerlan\HTTP\Utils\MessageUtil; +use chillerlan\OAuthTest\Attributes\Provider; use chillerlan\OAuth\Providers\{LastFM, ProviderException}; use InvalidArgumentException; /** * @property \chillerlan\OAuth\Providers\LastFM $provider */ +#[Provider(LastFM::class)] final class LastFMTest extends OAuthProviderUnitTestAbstract{ protected const TEST_TOKEN = '{"session":{"name":"lfm-user","key":"sk","subscriber":0}}'; @@ -36,11 +38,6 @@ final class LastFMTest extends OAuthProviderUnitTestAbstract{ '"@attr":{"ignored":0,"accepted":2}}}'; - - protected function getProviderFQCN():string{ - return LastFM::class; - } - /* * auth URL */ diff --git a/tests/Providers/Unit/MailChimpTest.php b/tests/Providers/Unit/MailChimpTest.php index 011e181..370ff5d 100644 --- a/tests/Providers/Unit/MailChimpTest.php +++ b/tests/Providers/Unit/MailChimpTest.php @@ -12,14 +12,12 @@ namespace chillerlan\OAuthTest\Providers\Unit; use chillerlan\OAuth\Providers\MailChimp; +use chillerlan\OAuthTest\Attributes\Provider; /** * @property \chillerlan\OAuth\Providers\MailChimp $provider */ +#[Provider(MailChimp::class)] final class MailChimpTest extends OAuth2ProviderUnitTestAbstract{ - protected function getProviderFQCN():string{ - return MailChimp::class; - } - } diff --git a/tests/Providers/Unit/MastodonTest.php b/tests/Providers/Unit/MastodonTest.php index dbf9ebb..6a8f7b0 100644 --- a/tests/Providers/Unit/MastodonTest.php +++ b/tests/Providers/Unit/MastodonTest.php @@ -13,16 +13,14 @@ use chillerlan\OAuth\OAuthException; use chillerlan\OAuth\Providers\Mastodon; +use chillerlan\OAuthTest\Attributes\Provider; /** * @property \chillerlan\OAuth\Providers\Mastodon $provider */ +#[Provider(Mastodon::class)] final class MastodonTest extends OAuth2ProviderUnitTestAbstract{ - protected function getProviderFQCN():string{ - return Mastodon::class; - } - public function testSetInvalidInstance():void{ $this->expectException(OAuthException::class); $this->expectExceptionMessage('invalid instance URL'); diff --git a/tests/Providers/Unit/MicrosoftGraphTest.php b/tests/Providers/Unit/MicrosoftGraphTest.php index 4467f6a..c2a062e 100644 --- a/tests/Providers/Unit/MicrosoftGraphTest.php +++ b/tests/Providers/Unit/MicrosoftGraphTest.php @@ -12,14 +12,12 @@ namespace chillerlan\OAuthTest\Providers\Unit; use chillerlan\OAuth\Providers\MicrosoftGraph; +use chillerlan\OAuthTest\Attributes\Provider; /** * @property \chillerlan\OAuth\Providers\MicrosoftGraph $provider */ +#[Provider(MicrosoftGraph::class)] final class MicrosoftGraphTest extends OAuth2ProviderUnitTestAbstract{ - protected function getProviderFQCN():string{ - return MicrosoftGraph::class; - } - } diff --git a/tests/Providers/Unit/MixcloudTest.php b/tests/Providers/Unit/MixcloudTest.php index 6866010..f72f43d 100644 --- a/tests/Providers/Unit/MixcloudTest.php +++ b/tests/Providers/Unit/MixcloudTest.php @@ -12,14 +12,12 @@ namespace chillerlan\OAuthTest\Providers\Unit; use chillerlan\OAuth\Providers\Mixcloud; +use chillerlan\OAuthTest\Attributes\Provider; /** * @property \chillerlan\OAuth\Providers\Mixcloud $provider */ +#[Provider(Mixcloud::class)] final class MixcloudTest extends OAuth2ProviderUnitTestAbstract{ - protected function getProviderFQCN():string{ - return Mixcloud::class; - } - } diff --git a/tests/Providers/Unit/MusicBrainzTest.php b/tests/Providers/Unit/MusicBrainzTest.php index da2488f..45fae72 100644 --- a/tests/Providers/Unit/MusicBrainzTest.php +++ b/tests/Providers/Unit/MusicBrainzTest.php @@ -13,16 +13,14 @@ use chillerlan\OAuth\Core\TokenRefresh; use chillerlan\OAuth\Providers\MusicBrainz; +use chillerlan\OAuthTest\Attributes\Provider; /** * @property \chillerlan\OAuth\Providers\MusicBrainz $provider */ +#[Provider(MusicBrainz::class)] final class MusicBrainzTest extends OAuth2ProviderUnitTestAbstract{ - protected function getProviderFQCN():string{ - return MusicBrainz::class; - } - public function testGetRefreshAccessTokenRequestBodyParams():void{ if(!$this->provider instanceof TokenRefresh){ diff --git a/tests/Providers/Unit/NPROneTest.php b/tests/Providers/Unit/NPROneTest.php index 59d6053..a280e0f 100644 --- a/tests/Providers/Unit/NPROneTest.php +++ b/tests/Providers/Unit/NPROneTest.php @@ -12,16 +12,14 @@ namespace chillerlan\OAuthTest\Providers\Unit; use chillerlan\OAuth\Providers\NPROne; +use chillerlan\OAuthTest\Attributes\Provider; /** * @property \chillerlan\OAuth\Providers\NPROne $provider */ +#[Provider(NPROne::class)] final class NPROneTest extends OAuth2ProviderUnitTestAbstract{ - protected function getProviderFQCN():string{ - return NPROne::class; - } - public function testSetAPI():void{ $this::assertSame('https://listening.api.npr.org', $this->getReflectionProperty('apiURL')); diff --git a/tests/Providers/Unit/OAuth1Test.php b/tests/Providers/Unit/OAuth1Test.php index 0536c9b..dce8b10 100644 --- a/tests/Providers/Unit/OAuth1Test.php +++ b/tests/Providers/Unit/OAuth1Test.php @@ -11,6 +11,7 @@ namespace chillerlan\OAuthTest\Providers\Unit; +use chillerlan\OAuthTest\Attributes\Provider; use chillerlan\OAuthTest\Providers\DummyOAuth1Provider; /** @@ -18,12 +19,9 @@ * * @property \chillerlan\OAuthTest\Providers\DummyOAuth1Provider $provider */ +#[Provider(DummyOAuth1Provider::class)] final class OAuth1Test extends OAuth1ProviderUnitTestAbstract{ - protected function getProviderFQCN():string{ - return DummyOAuth1Provider::class; - } - public function testMeUnknownErrorException():void{ $this->markTestSkipped('N/A'); } diff --git a/tests/Providers/Unit/OAuth2Test.php b/tests/Providers/Unit/OAuth2Test.php index 5e9d6cf..c090d0b 100644 --- a/tests/Providers/Unit/OAuth2Test.php +++ b/tests/Providers/Unit/OAuth2Test.php @@ -11,6 +11,7 @@ namespace chillerlan\OAuthTest\Providers\Unit; +use chillerlan\OAuthTest\Attributes\Provider; use chillerlan\OAuthTest\Providers\DummyOAuth2Provider; /** @@ -18,12 +19,9 @@ * * @property \chillerlan\OAuthTest\Providers\DummyOAuth2Provider $provider */ +#[Provider(DummyOAuth2Provider::class)] final class OAuth2Test extends OAuth2ProviderUnitTestAbstract{ - protected function getProviderFQCN():string{ - return DummyOAuth2Provider::class; - } - public function testMeUnknownErrorException():void{ $this->markTestSkipped('N/A'); } diff --git a/tests/Providers/Unit/OpenCachingTest.php b/tests/Providers/Unit/OpenCachingTest.php index d6ab823..86ab487 100644 --- a/tests/Providers/Unit/OpenCachingTest.php +++ b/tests/Providers/Unit/OpenCachingTest.php @@ -12,14 +12,12 @@ namespace chillerlan\OAuthTest\Providers\Unit; use chillerlan\OAuth\Providers\OpenCaching; +use chillerlan\OAuthTest\Attributes\Provider; /** * @property \chillerlan\OAuth\Providers\OpenCaching $provider */ +#[Provider(OpenCaching::class)] final class OpenCachingTest extends OAuth1ProviderUnitTestAbstract{ - protected function getProviderFQCN():string{ - return OpenCaching::class; - } - } diff --git a/tests/Providers/Unit/OpenStreetmap2Test.php b/tests/Providers/Unit/OpenStreetmap2Test.php index 9d56578..1e62735 100644 --- a/tests/Providers/Unit/OpenStreetmap2Test.php +++ b/tests/Providers/Unit/OpenStreetmap2Test.php @@ -12,14 +12,12 @@ namespace chillerlan\OAuthTest\Providers\Unit; use chillerlan\OAuth\Providers\OpenStreetmap2; +use chillerlan\OAuthTest\Attributes\Provider; /** * @property \chillerlan\OAuth\Providers\OpenStreetmap $provider */ +#[Provider(OpenStreetmap2::class)] final class OpenStreetmap2Test extends OAuth2ProviderUnitTestAbstract{ - protected function getProviderFQCN():string{ - return OpenStreetmap2::class; - } - } diff --git a/tests/Providers/Unit/OpenStreetmapTest.php b/tests/Providers/Unit/OpenStreetmapTest.php index 2b0d0d6..a25bca7 100644 --- a/tests/Providers/Unit/OpenStreetmapTest.php +++ b/tests/Providers/Unit/OpenStreetmapTest.php @@ -12,14 +12,12 @@ namespace chillerlan\OAuthTest\Providers\Unit; use chillerlan\OAuth\Providers\OpenStreetmap; +use chillerlan\OAuthTest\Attributes\Provider; /** * @property \chillerlan\OAuth\Providers\OpenStreetmap $provider */ +#[Provider(OpenStreetmap::class)] final class OpenStreetmapTest extends OAuth1ProviderUnitTestAbstract{ - protected function getProviderFQCN():string{ - return OpenStreetmap::class; - } - } diff --git a/tests/Providers/Unit/PatreonTest.php b/tests/Providers/Unit/PatreonTest.php index a70f4b7..9b325f0 100644 --- a/tests/Providers/Unit/PatreonTest.php +++ b/tests/Providers/Unit/PatreonTest.php @@ -12,17 +12,15 @@ namespace chillerlan\OAuthTest\Providers\Unit; use chillerlan\OAuth\Core\AccessToken; +use chillerlan\OAuthTest\Attributes\Provider; use chillerlan\OAuth\Providers\{Patreon, ProviderException}; /** * @property \chillerlan\OAuth\Providers\Patreon $provider */ +#[Provider(Patreon::class)] final class PatreonTest extends OAuth2ProviderUnitTestAbstract{ - protected function getProviderFQCN():string{ - return Patreon::class; - } - public function testMeInvalidScopesException():void{ $this->expectException(ProviderException::class); $this->expectExceptionMessage('invalid scopes for the identity endpoint'); diff --git a/tests/Providers/Unit/PayPalTest.php b/tests/Providers/Unit/PayPalTest.php index 5391278..1b740b7 100644 --- a/tests/Providers/Unit/PayPalTest.php +++ b/tests/Providers/Unit/PayPalTest.php @@ -12,14 +12,12 @@ namespace chillerlan\OAuthTest\Providers\Unit; use chillerlan\OAuth\Providers\PayPal; +use chillerlan\OAuthTest\Attributes\Provider; /** * @property \chillerlan\OAuth\Providers\PayPal $provider */ +#[Provider(PayPal::class)] final class PayPalTest extends OAuth2ProviderUnitTestAbstract{ - protected function getProviderFQCN():string{ - return PayPal::class; - } - } diff --git a/tests/Providers/Unit/PinterestTest.php b/tests/Providers/Unit/PinterestTest.php index 26122d9..6677475 100644 --- a/tests/Providers/Unit/PinterestTest.php +++ b/tests/Providers/Unit/PinterestTest.php @@ -12,14 +12,12 @@ namespace chillerlan\OAuthTest\Providers\Unit; use chillerlan\OAuth\Providers\Pinterest; +use chillerlan\OAuthTest\Attributes\Provider; /** * @property \chillerlan\OAuth\Providers\Pinterest $provider */ +#[Provider(Pinterest::class)] class PinterestTest extends OAuth2ProviderUnitTestAbstract{ - protected function getProviderFQCN():string{ - return Pinterest::class; - } - } diff --git a/tests/Providers/Unit/RedditTest.php b/tests/Providers/Unit/RedditTest.php index f37c5d1..df2b552 100644 --- a/tests/Providers/Unit/RedditTest.php +++ b/tests/Providers/Unit/RedditTest.php @@ -13,16 +13,14 @@ use chillerlan\OAuth\Core\{AccessToken, TokenInvalidate}; use chillerlan\OAuth\Providers\Reddit; +use chillerlan\OAuthTest\Attributes\Provider; /** * @property \chillerlan\OAuth\Providers\Reddit $provider */ +#[Provider(Reddit::class)] class RedditTest extends OAuth2ProviderUnitTestAbstract{ - protected function getProviderFQCN():string{ - return Reddit::class; - } - public function testTokenInvalidate():void{ if(!$this->provider instanceof TokenInvalidate){ diff --git a/tests/Providers/Unit/SlackTest.php b/tests/Providers/Unit/SlackTest.php index 1e1842f..db6c095 100644 --- a/tests/Providers/Unit/SlackTest.php +++ b/tests/Providers/Unit/SlackTest.php @@ -12,14 +12,12 @@ namespace chillerlan\OAuthTest\Providers\Unit; use chillerlan\OAuth\Providers\Slack; +use chillerlan\OAuthTest\Attributes\Provider; /** * @property \chillerlan\OAuth\Providers\Slack $provider */ +#[Provider(Slack::class)] final class SlackTest extends OAuth2ProviderUnitTestAbstract{ - protected function getProviderFQCN():string{ - return Slack::class; - } - } diff --git a/tests/Providers/Unit/SoundCloudTest.php b/tests/Providers/Unit/SoundCloudTest.php index fc7de32..83ad3c7 100644 --- a/tests/Providers/Unit/SoundCloudTest.php +++ b/tests/Providers/Unit/SoundCloudTest.php @@ -12,14 +12,12 @@ namespace chillerlan\OAuthTest\Providers\Unit; use chillerlan\OAuth\Providers\SoundCloud; +use chillerlan\OAuthTest\Attributes\Provider; /** * @property \chillerlan\OAuth\Providers\SoundCloud $provider */ +#[Provider(SoundCloud::class)] final class SoundCloudTest extends OAuth2ProviderUnitTestAbstract{ - protected function getProviderFQCN():string{ - return SoundCloud::class; - } - } diff --git a/tests/Providers/Unit/SpotifyTest.php b/tests/Providers/Unit/SpotifyTest.php index 6c8ba3c..3eb542d 100644 --- a/tests/Providers/Unit/SpotifyTest.php +++ b/tests/Providers/Unit/SpotifyTest.php @@ -12,14 +12,12 @@ namespace chillerlan\OAuthTest\Providers\Unit; use chillerlan\OAuth\Providers\Spotify; +use chillerlan\OAuthTest\Attributes\Provider; /** * @property \chillerlan\OAuth\Providers\Spotify $provider */ +#[Provider(Spotify::class)] final class SpotifyTest extends OAuth2ProviderUnitTestAbstract{ - protected function getProviderFQCN():string{ - return Spotify::class; - } - } diff --git a/tests/Providers/Unit/SteamTest.php b/tests/Providers/Unit/SteamTest.php index 8c889a6..109be32 100644 --- a/tests/Providers/Unit/SteamTest.php +++ b/tests/Providers/Unit/SteamTest.php @@ -14,11 +14,13 @@ use chillerlan\HTTP\Utils\MessageUtil; use chillerlan\OAuth\Providers\ProviderException; use chillerlan\OAuth\Providers\Steam; +use chillerlan\OAuthTest\Attributes\Provider; use function rawurlencode, sprintf; /** * @property \chillerlan\OAuth\Providers\Steam $provider */ +#[Provider(Steam::class)] final class SteamTest extends OAuthProviderUnitTestAbstract{ protected const ID_VALID = "ns:http://specs.openid.net/auth/2.0\x0ais_valid:true\x0a"; @@ -39,10 +41,6 @@ final class SteamTest extends OAuthProviderUnitTestAbstract{ ]; - protected function getProviderFQCN():string{ - return Steam::class; - } - /* * auth URL */ diff --git a/tests/Providers/Unit/StripeTest.php b/tests/Providers/Unit/StripeTest.php index af41c38..f2c2ed0 100644 --- a/tests/Providers/Unit/StripeTest.php +++ b/tests/Providers/Unit/StripeTest.php @@ -12,14 +12,12 @@ namespace chillerlan\OAuthTest\Providers\Unit; use chillerlan\OAuth\Providers\Stripe; +use chillerlan\OAuthTest\Attributes\Provider; /** * @property \chillerlan\OAuth\Providers\Stripe $provider */ +#[Provider(Stripe::class)] final class StripeTest extends OAuth2ProviderUnitTestAbstract{ - protected function getProviderFQCN():string{ - return Stripe::class; - } - } diff --git a/tests/Providers/Unit/Tumblr2Test.php b/tests/Providers/Unit/Tumblr2Test.php index 69e80d8..b074de1 100644 --- a/tests/Providers/Unit/Tumblr2Test.php +++ b/tests/Providers/Unit/Tumblr2Test.php @@ -12,14 +12,12 @@ namespace chillerlan\OAuthTest\Providers\Unit; use chillerlan\OAuth\Providers\Tumblr2; +use chillerlan\OAuthTest\Attributes\Provider; /** * @property \chillerlan\OAuth\Providers\Tumblr2 $provider */ +#[Provider(Tumblr2::class)] final class Tumblr2Test extends OAuth2ProviderUnitTestAbstract{ - protected function getProviderFQCN():string{ - return Tumblr2::class; - } - } diff --git a/tests/Providers/Unit/TumblrTest.php b/tests/Providers/Unit/TumblrTest.php index e221d7a..1966950 100644 --- a/tests/Providers/Unit/TumblrTest.php +++ b/tests/Providers/Unit/TumblrTest.php @@ -12,14 +12,12 @@ namespace chillerlan\OAuthTest\Providers\Unit; use chillerlan\OAuth\Providers\Tumblr; +use chillerlan\OAuthTest\Attributes\Provider; /** * @property \chillerlan\OAuth\Providers\Tumblr $provider */ +#[Provider(Tumblr::class)] final class TumblrTest extends OAuth1ProviderUnitTestAbstract{ - protected function getProviderFQCN():string{ - return Tumblr::class; - } - } diff --git a/tests/Providers/Unit/TwitchTest.php b/tests/Providers/Unit/TwitchTest.php index 318f8d0..e4ae1c8 100644 --- a/tests/Providers/Unit/TwitchTest.php +++ b/tests/Providers/Unit/TwitchTest.php @@ -13,17 +13,15 @@ use chillerlan\HTTP\Utils\MessageUtil; use chillerlan\OAuth\Providers\Twitch; +use chillerlan\OAuthTest\Attributes\Provider; use function implode; /** * @property \chillerlan\OAuth\Providers\Twitch $provider */ +#[Provider(Twitch::class)] final class TwitchTest extends OAuth2ProviderUnitTestAbstract{ - protected function getProviderFQCN():string{ - return Twitch::class; - } - public function testGetClientCredentialsTokenRequestBodyParams():void{ $scopes = ['scope1', 'scope2', 'scope3']; diff --git a/tests/Providers/Unit/TwitterCCTest.php b/tests/Providers/Unit/TwitterCCTest.php index eea0675..91e1c7b 100644 --- a/tests/Providers/Unit/TwitterCCTest.php +++ b/tests/Providers/Unit/TwitterCCTest.php @@ -12,16 +12,14 @@ namespace chillerlan\OAuthTest\Providers\Unit; use chillerlan\OAuth\Providers\TwitterCC; +use chillerlan\OAuthTest\Attributes\Provider; /** * @property \chillerlan\OAuth\Providers\TwitterCC $provider */ +#[Provider(TwitterCC::class)] final class TwitterCCTest extends OAuth2ProviderUnitTestAbstract{ - protected function getProviderFQCN():string{ - return TwitterCC::class; - } - public function testGetAuthURL():void{ $this->markTestSkipped('N/A'); } diff --git a/tests/Providers/Unit/TwitterTest.php b/tests/Providers/Unit/TwitterTest.php index 770afe0..0e9967a 100644 --- a/tests/Providers/Unit/TwitterTest.php +++ b/tests/Providers/Unit/TwitterTest.php @@ -12,14 +12,12 @@ namespace chillerlan\OAuthTest\Providers\Unit; use chillerlan\OAuth\Providers\Twitter; +use chillerlan\OAuthTest\Attributes\Provider; /** * @property \chillerlan\OAuth\Providers\Twitter $provider */ +#[Provider(Twitter::class)] final class TwitterTest extends OAuth1ProviderUnitTestAbstract{ - protected function getProviderFQCN():string{ - return Twitter::class; - } - } diff --git a/tests/Providers/Unit/VimeoTest.php b/tests/Providers/Unit/VimeoTest.php index e839220..9addf3b 100644 --- a/tests/Providers/Unit/VimeoTest.php +++ b/tests/Providers/Unit/VimeoTest.php @@ -13,16 +13,14 @@ use chillerlan\OAuth\Core\{AccessToken, TokenInvalidate}; use chillerlan\OAuth\Providers\Vimeo; +use chillerlan\OAuthTest\Attributes\Provider; /** * @property \chillerlan\OAuth\Providers\Vimeo $provider */ +#[Provider(Vimeo::class)] final class VimeoTest extends OAuth2ProviderUnitTestAbstract{ - protected function getProviderFQCN():string{ - return Vimeo::class; - } - public function testTokenInvalidate():void{ if(!$this->provider instanceof TokenInvalidate){ diff --git a/tests/Providers/Unit/WordPressTest.php b/tests/Providers/Unit/WordPressTest.php index 978bd44..de79e1d 100644 --- a/tests/Providers/Unit/WordPressTest.php +++ b/tests/Providers/Unit/WordPressTest.php @@ -12,14 +12,12 @@ namespace chillerlan\OAuthTest\Providers\Unit; use chillerlan\OAuth\Providers\WordPress; +use chillerlan\OAuthTest\Attributes\Provider; /** * @property \chillerlan\OAuth\Providers\WordPress $provider */ +#[Provider(WordPress::class)] final class WordPressTest extends OAuth2ProviderUnitTestAbstract{ - protected function getProviderFQCN():string{ - return WordPress::class; - } - } diff --git a/tests/Providers/Unit/YouTubeTest.php b/tests/Providers/Unit/YouTubeTest.php index c063b14..0431a3a 100644 --- a/tests/Providers/Unit/YouTubeTest.php +++ b/tests/Providers/Unit/YouTubeTest.php @@ -12,14 +12,12 @@ namespace chillerlan\OAuthTest\Providers\Unit; use chillerlan\OAuth\Providers\YouTube; +use chillerlan\OAuthTest\Attributes\Provider; /** * @property \chillerlan\OAuth\Providers\YouTube $provider */ +#[Provider(YouTube::class)] final class YouTubeTest extends OAuth2ProviderUnitTestAbstract{ - protected function getProviderFQCN():string{ - return YouTube::class; - } - }