-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for Guzzle 7 (#256)
- Loading branch information
1 parent
a996e46
commit a229c26
Showing
15 changed files
with
236 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,6 +48,27 @@ jobs: | |
command: composer update --prefer-lowest | ||
- name: Run Script | ||
run: vendor/bin/phpunit | ||
guzzle6: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
operating-system: [ ubuntu-latest ] | ||
php: [ "5.6", "7.2" ] | ||
name: PHP ${{ matrix.php }} Unit Test Guzzle 6 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Setup PHP | ||
uses: nanasess/[email protected] | ||
with: | ||
php-version: ${{ matrix.php }} | ||
- name: Install Dependencies | ||
uses: nick-invision/retry@v1 | ||
with: | ||
timeout_minutes: 10 | ||
max_attempts: 3 | ||
command: composer require guzzlehttp/guzzle:^6 && composer update | ||
- name: Run Script | ||
run: vendor/bin/phpunit | ||
# use dockerfiles for oooooolllllldddd versions of php, setup-php times out for those. | ||
test_php55: | ||
name: "PHP 5.5 Unit Test" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
/** | ||
* Copyright 2020 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
namespace Google\Auth\HttpHandler; | ||
|
||
class Guzzle7HttpHandler extends Guzzle6HttpHandler | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,16 +19,15 @@ | |
|
||
use Google\Auth\Credentials\GCECredentials; | ||
use Google\Auth\HttpHandler\HttpClientCache; | ||
use GuzzleHttp\ClientInterface; | ||
use Google\Auth\Tests\BaseTest; | ||
use GuzzleHttp\Psr7; | ||
use PHPUnit\Framework\TestCase; | ||
use Prophecy\Argument; | ||
|
||
/** | ||
* @group credentials | ||
* @group credentials-gce | ||
*/ | ||
class GCECredentialsTest extends TestCase | ||
class GCECredentialsTest extends BaseTest | ||
{ | ||
public function testOnGceMetadataFlavorHeader() | ||
{ | ||
|
@@ -182,10 +181,7 @@ public function testSettingBothScopeAndTargetAudienceThrowsException() | |
*/ | ||
public function testFetchAuthTokenCustomScope($scope, $expected) | ||
{ | ||
$guzzleVersion = ClientInterface::VERSION; | ||
if ($guzzleVersion[0] === '5') { | ||
$this->markTestSkipped('Only compatible with guzzle 6+'); | ||
} | ||
$this->onlyGuzzle6And7(); | ||
|
||
$uri = null; | ||
$client = $this->prophesize('GuzzleHttp\ClientInterface'); | ||
|
@@ -258,10 +254,7 @@ public function testGetClientNameShouldBeEmptyIfNotOnGCE() | |
|
||
public function testSignBlob() | ||
{ | ||
$guzzleVersion = ClientInterface::VERSION; | ||
if ($guzzleVersion[0] === '5') { | ||
$this->markTestSkipped('Only compatible with guzzle 6+'); | ||
} | ||
$this->onlyGuzzle6And7(); | ||
|
||
$expectedEmail = '[email protected]'; | ||
$expectedAccessToken = 'token'; | ||
|
@@ -294,10 +287,7 @@ public function testSignBlob() | |
|
||
public function testSignBlobWithLastReceivedAccessToken() | ||
{ | ||
$guzzleVersion = ClientInterface::VERSION; | ||
if ($guzzleVersion[0] === '5') { | ||
$this->markTestSkipped('Only compatible with guzzle 6+'); | ||
} | ||
$this->onlyGuzzle6And7(); | ||
|
||
$expectedEmail = '[email protected]'; | ||
$expectedAccessToken = 'token'; | ||
|
@@ -340,10 +330,7 @@ public function testSignBlobWithLastReceivedAccessToken() | |
|
||
public function testGetProjectId() | ||
{ | ||
$guzzleVersion = ClientInterface::VERSION; | ||
if ($guzzleVersion[0] === '5') { | ||
$this->markTestSkipped('Only compatible with guzzle 6+'); | ||
} | ||
$this->onlyGuzzle6And7(); | ||
|
||
$expected = 'foobar'; | ||
|
||
|
@@ -366,10 +353,7 @@ public function testGetProjectId() | |
|
||
public function testGetProjectIdShouldBeEmptyIfNotOnGCE() | ||
{ | ||
$guzzleVersion = ClientInterface::VERSION; | ||
if ($guzzleVersion[0] === '5') { | ||
$this->markTestSkipped('Only compatible with guzzle 6+'); | ||
} | ||
$this->onlyGuzzle6And7(); | ||
|
||
// simulate retry attempts by returning multiple 500s | ||
$client = $this->prophesize('GuzzleHttp\ClientInterface'); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.