From 8baf334754aec01c59cb38172bffe359f7794447 Mon Sep 17 00:00:00 2001 From: Gabriel Caruso Date: Tue, 5 Dec 2017 23:32:16 -0200 Subject: [PATCH] Updated to PHPUnit 4.8 (#175) --- composer.json | 2 +- tests/ApplicationDefaultCredentialsTest.php | 5 +++-- tests/BaseTest.php | 3 ++- tests/Cache/ItemTest.php | 3 ++- tests/Cache/MemoryCacheItemPoolTest.php | 3 ++- tests/CacheTraitTest.php | 3 ++- .../AppIndentityCredentialsTest.php | 7 ++++--- tests/Credentials/GCECredentialsTest.php | 9 +++++---- tests/Credentials/IAMCredentialsTest.php | 5 +++-- .../ServiceAccountCredentialsTest.php | 15 ++++++++------- .../UserRefreshCredentialsTest.php | 11 ++++++----- tests/OAuth2Test.php | 19 ++++++++++--------- 12 files changed, 48 insertions(+), 37 deletions(-) diff --git a/composer.json b/composer.json index 1bd9869e4..0b01cf3e1 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ "require-dev": { "guzzlehttp/promises": "0.1.1|^1.3", "friendsofphp/php-cs-fixer": "^1.11", - "phpunit/phpunit": "^4.8", + "phpunit/phpunit": "^4.8.36", "sebastian/comparator": ">=1.2.3" }, "autoload": { diff --git a/tests/ApplicationDefaultCredentialsTest.php b/tests/ApplicationDefaultCredentialsTest.php index b7cda07e8..48ad3e6e9 100644 --- a/tests/ApplicationDefaultCredentialsTest.php +++ b/tests/ApplicationDefaultCredentialsTest.php @@ -21,8 +21,9 @@ use Google\Auth\Credentials\GCECredentials; use Google\Auth\Credentials\ServiceAccountCredentials; use GuzzleHttp\Psr7; +use PHPUnit\Framework\TestCase; -class ADCGetTest extends \PHPUnit_Framework_TestCase +class ADCGetTest extends TestCase { private $originalHome; @@ -101,7 +102,7 @@ public function testSuccedsIfNoDefaultFilesButIsOnGCE() } } -class ADCGetMiddlewareTest extends \PHPUnit_Framework_TestCase +class ADCGetMiddlewareTest extends TestCase { private $originalHome; diff --git a/tests/BaseTest.php b/tests/BaseTest.php index b005e3418..05bded0ab 100644 --- a/tests/BaseTest.php +++ b/tests/BaseTest.php @@ -3,8 +3,9 @@ namespace Google\Auth\tests; use GuzzleHttp\ClientInterface; +use PHPUnit\Framework\TestCase; -abstract class BaseTest extends \PHPUnit_Framework_TestCase +abstract class BaseTest extends TestCase { public function onlyGuzzle6() { diff --git a/tests/Cache/ItemTest.php b/tests/Cache/ItemTest.php index 2d00f36c1..ed52176a2 100644 --- a/tests/Cache/ItemTest.php +++ b/tests/Cache/ItemTest.php @@ -18,8 +18,9 @@ namespace Google\Auth\Tests; use Google\Auth\Cache\Item; +use PHPUnit\Framework\TestCase; -class ItemTest extends \PHPUnit_Framework_TestCase +class ItemTest extends TestCase { public function getItem($key) { diff --git a/tests/Cache/MemoryCacheItemPoolTest.php b/tests/Cache/MemoryCacheItemPoolTest.php index e8cb93b7c..153e70dfa 100644 --- a/tests/Cache/MemoryCacheItemPoolTest.php +++ b/tests/Cache/MemoryCacheItemPoolTest.php @@ -18,9 +18,10 @@ namespace Google\Auth\Tests; use Google\Auth\Cache\MemoryCacheItemPool; +use PHPUnit\Framework\TestCase; use Psr\Cache\InvalidArgumentException; -class MemoryCacheItemPoolTest extends \PHPUnit_Framework_TestCase +class MemoryCacheItemPoolTest extends TestCase { private $pool; diff --git a/tests/CacheTraitTest.php b/tests/CacheTraitTest.php index 30ba924f7..86d36e196 100644 --- a/tests/CacheTraitTest.php +++ b/tests/CacheTraitTest.php @@ -18,8 +18,9 @@ namespace Google\Auth\Tests; use Google\Auth\CacheTrait; +use PHPUnit\Framework\TestCase; -class CacheTraitTest extends \PHPUnit_Framework_TestCase +class CacheTraitTest extends TestCase { private $mockFetcher; private $mockCacheItem; diff --git a/tests/Credentials/AppIndentityCredentialsTest.php b/tests/Credentials/AppIndentityCredentialsTest.php index 07e12ea55..d43714aaa 100644 --- a/tests/Credentials/AppIndentityCredentialsTest.php +++ b/tests/Credentials/AppIndentityCredentialsTest.php @@ -20,8 +20,9 @@ use google\appengine\api\app_identity\AppIdentityService; // included from tests\mocks\AppIdentityService.php use Google\Auth\Credentials\AppIdentityCredentials; +use PHPUnit\Framework\TestCase; -class AppIdentityCredentialsOnAppEngineTest extends \PHPUnit_Framework_TestCase +class AppIdentityCredentialsOnAppEngineTest extends TestCase { public function testIsFalseByDefault() { @@ -41,7 +42,7 @@ public function testIsTrueWhenAppEngineRuntimeIsPhp() } } -class AppIdentityCredentialsGetCacheKeyTest extends \PHPUnit_Framework_TestCase +class AppIdentityCredentialsGetCacheKeyTest extends TestCase { public function testShouldBeEmpty() { @@ -50,7 +51,7 @@ public function testShouldBeEmpty() } } -class AppIdentityCredentialsFetchAuthTokenTest extends \PHPUnit_Framework_TestCase +class AppIdentityCredentialsFetchAuthTokenTest extends TestCase { public function testShouldBeEmptyIfNotOnAppEngine() { diff --git a/tests/Credentials/GCECredentialsTest.php b/tests/Credentials/GCECredentialsTest.php index fe2bb25a8..8e23a0ffc 100644 --- a/tests/Credentials/GCECredentialsTest.php +++ b/tests/Credentials/GCECredentialsTest.php @@ -20,8 +20,9 @@ use Google\Auth\Credentials\GCECredentials; use GuzzleHttp\Psr7; use GuzzleHttp\Psr7\Response; +use PHPUnit\Framework\TestCase; -class GCECredentialsOnGCETest extends \PHPUnit_Framework_TestCase +class GCECredentialsOnGCETest extends TestCase { public function testIsFalseOnClientErrorStatus() { @@ -56,7 +57,7 @@ public function testIsOkIfGoogleIsTheFlavor() } } -class GCECredentialsOnAppEngineFlexibleTest extends \PHPUnit_Framework_TestCase +class GCECredentialsOnAppEngineFlexibleTest extends TestCase { public function testIsFalseByDefault() { @@ -70,7 +71,7 @@ public function testIsTrueWhenGaeVmIsTrue() } } -class GCECredentialsGetCacheKeyTest extends \PHPUnit_Framework_TestCase +class GCECredentialsGetCacheKeyTest extends TestCase { public function testShouldNotBeEmpty() { @@ -79,7 +80,7 @@ public function testShouldNotBeEmpty() } } -class GCECredentialsFetchAuthTokenTest extends \PHPUnit_Framework_TestCase +class GCECredentialsFetchAuthTokenTest extends TestCase { public function testShouldBeEmptyIfNotOnGCE() { diff --git a/tests/Credentials/IAMCredentialsTest.php b/tests/Credentials/IAMCredentialsTest.php index fc9c86507..c0d0435e0 100644 --- a/tests/Credentials/IAMCredentialsTest.php +++ b/tests/Credentials/IAMCredentialsTest.php @@ -18,8 +18,9 @@ namespace Google\Auth\Tests; use Google\Auth\Credentials\IAMCredentials; +use PHPUnit\Framework\TestCase; -class IAMConstructorTest extends \PHPUnit_Framework_TestCase +class IAMConstructorTest extends TestCase { /** * @expectedException InvalidArgumentException @@ -53,7 +54,7 @@ public function testInitializeSuccess() } } -class IAMUpdateMetadataCallbackTest extends \PHPUnit_Framework_TestCase +class IAMUpdateMetadataCallbackTest extends TestCase { public function testUpdateMetadataFunc() { diff --git a/tests/Credentials/ServiceAccountCredentialsTest.php b/tests/Credentials/ServiceAccountCredentialsTest.php index d7066dac3..2418140c1 100644 --- a/tests/Credentials/ServiceAccountCredentialsTest.php +++ b/tests/Credentials/ServiceAccountCredentialsTest.php @@ -23,6 +23,7 @@ use Google\Auth\CredentialsLoader; use Google\Auth\OAuth2; use GuzzleHttp\Psr7; +use PHPUnit\Framework\TestCase; // Creates a standard JSON auth object for testing. function createTestJson() @@ -36,7 +37,7 @@ function createTestJson() ]; } -class SACGetCacheKeyTest extends \PHPUnit_Framework_TestCase +class SACGetCacheKeyTest extends TestCase { public function testShouldBeTheSameAsOAuth2WithTheSameScope() { @@ -87,7 +88,7 @@ public function testShouldBeTheSameAsOAuth2WithTheSameScopeWithSubAddedLater() } } -class SACConstructorTest extends \PHPUnit_Framework_TestCase +class SACConstructorTest extends TestCase { /** * @expectedException InvalidArgumentException @@ -148,7 +149,7 @@ public function testInitalizeFromAFile() } } -class SACFromEnvTest extends \PHPUnit_Framework_TestCase +class SACFromEnvTest extends TestCase { protected function tearDown() { @@ -178,7 +179,7 @@ public function testSucceedIfFileExists() } } -class SACFromWellKnownFileTest extends \PHPUnit_Framework_TestCase +class SACFromWellKnownFileTest extends TestCase { private $originalHome; @@ -211,7 +212,7 @@ public function testSucceedIfFileIsPresent() } } -class SACFetchAuthTokenTest extends \PHPUnit_Framework_TestCase +class SACFetchAuthTokenTest extends TestCase { private $privateKey; @@ -307,7 +308,7 @@ public function testUpdateMetadataFunc() } } -class SACJwtAccessTest extends \PHPUnit_Framework_TestCase +class SACJwtAccessTest extends TestCase { private $privateKey; @@ -433,7 +434,7 @@ public function testUpdateMetadataFunc() } } -class SACJwtAccessComboTest extends \PHPUnit_Framework_TestCase +class SACJwtAccessComboTest extends TestCase { private $privateKey; diff --git a/tests/Credentials/UserRefreshCredentialsTest.php b/tests/Credentials/UserRefreshCredentialsTest.php index accf448dd..1a3678b2d 100644 --- a/tests/Credentials/UserRefreshCredentialsTest.php +++ b/tests/Credentials/UserRefreshCredentialsTest.php @@ -21,6 +21,7 @@ use Google\Auth\Credentials\UserRefreshCredentials; use Google\Auth\OAuth2; use GuzzleHttp\Psr7; +use PHPUnit\Framework\TestCase; // Creates a standard JSON auth object for testing. function createURCTestJson() @@ -33,7 +34,7 @@ function createURCTestJson() ]; } -class URCGetCacheKeyTest extends \PHPUnit_Framework_TestCase +class URCGetCacheKeyTest extends TestCase { public function testShouldBeTheSameAsOAuth2WithTheSameScope() { @@ -50,7 +51,7 @@ public function testShouldBeTheSameAsOAuth2WithTheSameScope() } } -class URCConstructorTest extends \PHPUnit_Framework_TestCase +class URCConstructorTest extends TestCase { /** * @expectedException InvalidArgumentException @@ -111,7 +112,7 @@ public function testInitalizeFromAFile() } } -class URCFromEnvTest extends \PHPUnit_Framework_TestCase +class URCFromEnvTest extends TestCase { protected function tearDown() { @@ -141,7 +142,7 @@ public function testSucceedIfFileExists() } } -class URCFromWellKnownFileTest extends \PHPUnit_Framework_TestCase +class URCFromWellKnownFileTest extends TestCase { private $originalHome; @@ -174,7 +175,7 @@ public function testSucceedIfFileIsPresent() } } -class URCFetchAuthTokenTest extends \PHPUnit_Framework_TestCase +class URCFetchAuthTokenTest extends TestCase { /** * @expectedException GuzzleHttp\Exception\ClientException diff --git a/tests/OAuth2Test.php b/tests/OAuth2Test.php index 0d372e988..7dc7ec68e 100644 --- a/tests/OAuth2Test.php +++ b/tests/OAuth2Test.php @@ -20,8 +20,9 @@ use Google\Auth\OAuth2; use GuzzleHttp\Psr7; use GuzzleHttp\Psr7\Response; +use PHPUnit\Framework\TestCase; -class OAuth2AuthorizationUriTest extends \PHPUnit_Framework_TestCase +class OAuth2AuthorizationUriTest extends TestCase { private $minimal = [ 'authorizationUri' => 'https://accounts.test.org/insecure/url', @@ -170,7 +171,7 @@ public function testRedirectUriPostmessageIsAllowed() } } -class OAuth2GrantTypeTest extends \PHPUnit_Framework_TestCase +class OAuth2GrantTypeTest extends TestCase { private $minimal = [ 'authorizationUri' => 'https://accounts.test.org/insecure/url', @@ -232,7 +233,7 @@ public function testSetsUrlAsGrantType() } } -class OAuth2GetCacheKeyTest extends \PHPUnit_Framework_TestCase +class OAuth2GetCacheKeyTest extends TestCase { private $minimal = [ 'clientID' => 'aClientID', @@ -259,7 +260,7 @@ public function testIsAllScopesWhenScopeIsArray() } } -class OAuth2TimingTest extends \PHPUnit_Framework_TestCase +class OAuth2TimingTest extends TestCase { private $minimal = [ 'authorizationUri' => 'https://accounts.test.org/insecure/url', @@ -319,7 +320,7 @@ public function testIsNotExpiredIfExpiresAtIsOld() } } -class OAuth2GeneralTest extends \PHPUnit_Framework_TestCase +class OAuth2GeneralTest extends TestCase { private $minimal = [ 'authorizationUri' => 'https://accounts.test.org/insecure/url', @@ -363,7 +364,7 @@ public function testAllowsUrnRedirectUri() } } -class OAuth2JwtTest extends \PHPUnit_Framework_TestCase +class OAuth2JwtTest extends TestCase { private $signingMinimal = [ 'signingKey' => 'example_key', @@ -481,7 +482,7 @@ private function jwtDecode() } } -class OAuth2GenerateAccessTokenRequestTest extends \PHPUnit_Framework_TestCase +class OAuth2GenerateAccessTokenRequestTest extends TestCase { private $tokenRequestMinimal = [ 'tokenCredentialUri' => 'https://tokens_r_us/test', @@ -629,7 +630,7 @@ public function testGeneratesExtendedRequests() } } -class OAuth2FetchAuthTokenTest extends \PHPUnit_Framework_TestCase +class OAuth2FetchAuthTokenTest extends TestCase { private $fetchAuthTokenMinimal = [ 'tokenCredentialUri' => 'https://tokens_r_us/test', @@ -774,7 +775,7 @@ public function testUpdatesTokenFieldsOnFetchMissingRefreshToken() } } -class OAuth2VerifyIdTokenTest extends \PHPUnit_Framework_TestCase +class OAuth2VerifyIdTokenTest extends TestCase { private $publicKey; private $privateKey;