Skip to content

Commit 45c8530

Browse files
authored
Merge branch 'main' into renovate/kelvinmo-simplejwt-1.x
2 parents ede65ee + 257e089 commit 45c8530

16 files changed

Lines changed: 64 additions & 63 deletions

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
strategy:
1212
matrix:
1313
os: [ "ubuntu-latest", "windows-latest" ]
14-
php: [ "8.1", "8.2", "8.3", "8.4" ]
14+
php: [ "8.1", "8.2", "8.3", "8.4", "8.5" ]
1515
runs-on: ${{ matrix.os }}
1616
name: PHP ${{ matrix.php }} Unit Test${{ matrix.os == 'windows-latest' && ' on Windows' || '' }}
1717
steps:

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
},
1111
"require": {
1212
"php": "^8.1",
13-
"firebase/php-jwt": "^6.0",
13+
"firebase/php-jwt": "^6.0||^7.0",
1414
"guzzlehttp/guzzle": "^7.4.5",
1515
"guzzlehttp/psr7": "^2.4.5",
1616
"psr/http-message": "^1.1||^2.0",
@@ -25,7 +25,7 @@
2525
"sebastian/comparator": ">=1.2.3",
2626
"phpseclib/phpseclib": "^3.0.35",
2727
"kelvinmo/simplejwt": "^1.1.0",
28-
"webmozart/assert": "^1.11",
28+
"webmozart/assert": "^1.11||^2.0",
2929
"symfony/process": "^6.0||^7.0",
3030
"symfony/filesystem": "^6.3||^7.3"
3131
},

tests/AccessTokenTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,9 +272,7 @@ public function testGetCertsFromUrl($certUrl)
272272
$token = new AccessToken();
273273
$reflector = new \ReflectionObject($token);
274274
$cacheKeyMethod = $reflector->getMethod('getCacheKeyFromCertLocation');
275-
$cacheKeyMethod->setAccessible(true);
276275
$getCertsMethod = $reflector->getMethod('getCerts');
277-
$getCertsMethod->setAccessible(true);
278276
$cacheKey = $cacheKeyMethod->invoke($token, $certUrl);
279277
$certs = $getCertsMethod->invoke(
280278
$token,

tests/ApplicationDefaultCredentialsTest.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ public function testGceCredentials()
135135
$this->assertInstanceOf(GCECredentials::class, $creds);
136136

137137
$uriProperty = (new ReflectionClass($creds))->getProperty('tokenUri');
138-
$uriProperty->setAccessible(true);
139138

140139
// used default scope
141140
$tokenUri = $uriProperty->getValue($creds);
@@ -174,7 +173,6 @@ public function testImpersonatedServiceAccountCredentials()
174173
$this->assertEquals('service_account_name@namespace.iam.gserviceaccount.com', $creds->getClientName());
175174

176175
$sourceCredentialsProperty = (new ReflectionClass($creds))->getProperty('sourceCredentials');
177-
$sourceCredentialsProperty->setAccessible(true);
178176

179177
// used default scope
180178
$sourceCredentials = $sourceCredentialsProperty->getValue($creds);
@@ -197,7 +195,6 @@ public function testUserRefreshCredentials()
197195
$this->assertInstanceOf(UserRefreshCredentials::class, $creds);
198196

199197
$authProperty = (new ReflectionClass($creds))->getProperty('auth');
200-
$authProperty->setAccessible(true);
201198

202199
// used default scope
203200
$auth = $authProperty->getValue($creds);
@@ -233,7 +230,6 @@ public function testServiceAccountCredentials()
233230
$this->assertInstanceOf(ServiceAccountCredentials::class, $creds);
234231

235232
$authProperty = (new ReflectionClass($creds))->getProperty('auth');
236-
$authProperty->setAccessible(true);
237233

238234
// did not use default scope
239235
$auth = $authProperty->getValue($creds);
@@ -267,7 +263,6 @@ public function testDefaultScopeArray()
267263
);
268264

269265
$authProperty = (new ReflectionClass($creds))->getProperty('auth');
270-
$authProperty->setAccessible(true);
271266

272267
// used default scope
273268
$auth = $authProperty->getValue($creds);
@@ -562,7 +557,6 @@ public function testGetIdTokenCredentialsWithUserRefreshCredentials()
562557
$this->assertInstanceOf(UserRefreshCredentials::class, $creds);
563558

564559
$authProperty = (new ReflectionClass($creds))->getProperty('auth');
565-
$authProperty->setAccessible(true);
566560

567561
// used default scope
568562
$auth = $authProperty->getValue($creds);
@@ -770,12 +764,10 @@ public function testExternalAccountCredentials(string $jsonFile, string $expecte
770764

771765
$credsReflection = new \ReflectionClass($creds);
772766
$credsProp = $credsReflection->getProperty('auth');
773-
$credsProp->setAccessible(true);
774767

775768
$oauth = $credsProp->getValue($creds);
776769
$oauthReflection = new \ReflectionClass($oauth);
777770
$oauthProp = $oauthReflection->getProperty('subjectTokenFetcher');
778-
$oauthProp->setAccessible(true);
779771

780772
$subjectTokenFetcher = $oauthProp->getValue($oauth);
781773
$this->assertInstanceOf($expectedCredSource, $subjectTokenFetcher);

tests/Credentials/ExternalAccountCredentialsTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,22 +61,19 @@ public function testCredentialSourceFromCredentials(
6161

6262
$credsReflection = new \ReflectionClass(ExternalAccountCredentials::class);
6363
$credsProp = $credsReflection->getProperty('auth');
64-
$credsProp->setAccessible(true);
6564

6665
$creds = new ExternalAccountCredentials('a-scope', $jsonCreds);
6766
$oauth = $credsProp->getValue($creds);
6867

6968
$oauthReflection = new \ReflectionClass(OAuth2::class);
7069
$oauthProp = $oauthReflection->getProperty('subjectTokenFetcher');
71-
$oauthProp->setAccessible(true);
7270
$subjectTokenFetcher = $oauthProp->getValue($oauth);
7371

7472
$this->assertInstanceOf($expectedSourceClass, $subjectTokenFetcher);
7573

7674
$sourceReflection = new \ReflectionClass($subjectTokenFetcher);
7775
foreach ($expectedProperties as $propName => $expectedPropValue) {
7876
$sourceProp = $sourceReflection->getProperty($propName);
79-
$sourceProp->setAccessible(true);
8077
$this->assertEquals($expectedPropValue, $sourceProp->getValue($subjectTokenFetcher));
8178
}
8279
}

tests/Credentials/GCECredentialsTest.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ public function testCheckProductNameFile()
100100

101101
$method = (new ReflectionClass(GCECredentials::class))
102102
->getMethod('detectResidencyLinux');
103-
$method->setAccessible(true);
104103

105104
$this->assertFalse($method->invoke(null, '/nonexistant/file'));
106105

@@ -139,7 +138,6 @@ public function testOnWindowsGceWithResidencyWithNoCom()
139138
$method = (new ReflectionClass(GCECredentials::class))
140139
->getMethod('detectResidencyWindows');
141140

142-
$method->setAccessible(true);
143141

144142
$this->assertFalse($method->invoke(null, 'thisShouldBeFalse'));
145143
}
@@ -159,7 +157,6 @@ public function testOnWindowsGceWithResidencyNotOnGCE()
159157

160158
$method = (new ReflectionClass(GCECredentials::class))
161159
->getMethod('detectResidencyWindows');
162-
$method->setAccessible(true);
163160

164161
$this->assertFalse($method->invoke(null, $keyPathProperty . $keyName));
165162
}
@@ -183,7 +180,6 @@ public function testOnWindowsGceWithResidency()
183180

184181
$method = (new ReflectionClass(GCECredentials::class))
185182
->getMethod('detectResidencyWindows');
186-
$method->setAccessible(true);
187183

188184
$this->assertTrue($method->invoke(null, $keyPathProperty . $keyName));
189185
}

tests/Credentials/ImpersonatedServiceAccountCredentialsTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class ImpersonatedServiceAccountCredentialsTest extends TestCase
6363
'service_account_impersonation_url' => self::IMPERSONATION_URL,
6464
'source_credentials' => [
6565
'client_email' => 'clientemail@clientemail.com',
66-
'private_key' => "-----BEGIN RSA PRIVATE KEY-----\nMIICWgIBAAKBgGhw1WMos5gp2YjV7+fNwXN1tI4/DFXKzwY6TDWsPxkbyfjHgunX\n/sijlnJt3Qs1gBxiwEEjzFFlp39O3/gEbIoYWHR/4sZdqNRFzbhJcTpnUvRlZDBL\nE5h8f5uu4aL4D32WyiELF/vpr533lZCBwWsnN3zIYJxThgRF9i/R7F8tAgMBAAEC\ngYAgUyv4cNSFOA64J18FY82IKtojXKg4tXi1+L01r4YoA03TzgxazBtzhg4+hHpx\nybFJF9dhUe8fElNxN7xiSxw8i5MnfPl+piwbfoENhgrzU0/N14AV/4Pq+WAJQe2M\nxPcI1DPYMEwGjX2PmxqnkC47MyR9agX21YZVc9rpRCgPgQJBALodH492I0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Y-----\n",
6767
'type' => 'service_account',
6868
]
6969
];
@@ -138,7 +138,6 @@ public function testSourceCredentialsClass(array $json, string $credClass)
138138
$creds = new ImpersonatedServiceAccountCredentials(['scope/1', 'scope/2'], $json);
139139

140140
$sourceCredentialsProperty = (new ReflectionClass($creds))->getProperty('sourceCredentials');
141-
$sourceCredentialsProperty->setAccessible(true);
142141
$this->assertInstanceOf($credClass, $sourceCredentialsProperty->getValue($creds));
143142
}
144143

tests/Credentials/ServiceAccountCredentialsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ private function createTestJson()
4141
'client_id' => 'client123',
4242
'type' => 'service_account',
4343
'project_id' => 'example_project',
44-
'private_key' => file_get_contents(__DIR__ . '/../fixtures' . '/private.pem'),
44+
'private_key' => file_get_contents(__DIR__ . '/../fixtures/private.pem'),
4545
];
4646
}
4747

tests/FetchAuthTokenTest.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ public function testAppIdentityCredentialsGetLastReceivedToken()
123123
'Google\Auth\Credentials\AppIdentityCredentials'
124124
);
125125
$property = $class->getProperty('lastReceivedToken');
126-
$property->setAccessible(true);
127126

128127
$credentials = new AppIdentityCredentials();
129128
$property->setValue($credentials, [
@@ -140,7 +139,6 @@ public function testGCECredentialsGetLastReceivedToken()
140139
'Google\Auth\Credentials\GCECredentials'
141140
);
142141
$property = $class->getProperty('lastReceivedToken');
143-
$property->setAccessible(true);
144142

145143
$credentials = new GCECredentials();
146144
$property->setValue($credentials, [
@@ -163,7 +161,6 @@ public function testServiceAccountCredentialsGetLastReceivedToken()
163161
'Google\Auth\Credentials\ServiceAccountCredentials'
164162
);
165163
$property = $class->getProperty('auth');
166-
$property->setAccessible(true);
167164

168165
$oauth2Mock = $this->getOAuth2Mock();
169166
$oauth2Mock->getScope()
@@ -191,7 +188,6 @@ public function testServiceAccountJwtAccessCredentialsGetLastReceivedToken()
191188
'Google\Auth\Credentials\ServiceAccountJwtAccessCredentials'
192189
);
193190
$property = $class->getProperty('auth');
194-
$property->setAccessible(true);
195191

196192
$credentials = new ServiceAccountJwtAccessCredentials($jsonPath);
197193
$property->setValue($credentials, $this->getOAuth2Mock()->reveal());
@@ -211,7 +207,6 @@ public function testUserRefreshCredentialsGetLastReceivedToken()
211207
'Google\Auth\Credentials\UserRefreshCredentials'
212208
);
213209
$property = $class->getProperty('auth');
214-
$property->setAccessible(true);
215210

216211
$credentials = new UserRefreshCredentials($this->scopes, $jsonPath);
217212
$property->setValue($credentials, $this->getOAuth2Mock()->reveal());

tests/HttpHandler/HttpHandlerFactoryTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,9 @@ public function testBuildsGuzzle7HandlerWithExtendedTruncation()
6666
// Get access to the default middleware stack so we can add it to our mock handler
6767
$handler = HttpHandlerFactory::build();
6868
$clientProp = (new ReflectionClass($handler))->getParentClass()->getProperty('client');
69-
$clientProp->setAccessible(true);
7069

7170
$handlerStack = $clientProp->getValue($handler)->getConfig('handler');
7271
$stackProp = (new ReflectionClass($handlerStack))->getProperty('stack');
73-
$stackProp->setAccessible(true);
7472

7573
foreach ($stackProp->getValue($handlerStack) as $idx => $middleware) {
7674
$newStack->push($middleware[0], $middleware[1]);

0 commit comments

Comments
 (0)