Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relax guzzlehttp/psr7 version constraint and typehint to psr/http-client #15

Merged
merged 2 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"description": "A PHP client library for 'Vault by HashiCorp'",
"require": {
"ext-json": "*",
"guzzlehttp/psr7": "2.6.2",
"guzzlehttp/psr7": "^2.6",
"php": "^7.2.5 || ^8.0",
"php-http/httplug": "2.4.0"
"psr/http-client": "^1.0"
},
"suggest": {
"php-http/curl-client": "CURL Client Adapter",
Expand Down
16 changes: 8 additions & 8 deletions tests/VaultPHP/Exceptions/ExceptionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
namespace Test\VaultPHP\Response;

use GuzzleHttp\Psr7\Response;
use Http\Client\HttpClient;
use PHPUnit\Framework\TestCase;
use Psr\Http\Client\ClientInterface;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
use Test\VaultPHP\Mocks\InvalidEndpointResponseMock;
Expand Down Expand Up @@ -37,7 +37,7 @@ public function testWillThrowWhenApiHostMalformed() {
$this->expectExceptionMessage('can\'t parse provided apiHost - malformed uri');

$auth = new Token('fooToken');
$httpClient = $this->createMock(HttpClient::class);
$httpClient = $this->createMock(ClientInterface::class);

$client = new VaultClient($httpClient, $auth, "imInvalidHost");
$client->sendApiRequest('LOL', '/i/should/be/preserved', EndpointResponse::class, ['dontReplaceMe']);
Expand All @@ -46,7 +46,7 @@ public function testWillThrowWhenApiHostMalformed() {
public function testAuthenticateWillThrowWhenNoTokenIsReturned() {
$this->expectException(VaultAuthenticationException::class);

$httpClient = $this->createMock(HttpClient::class);
$httpClient = $this->createMock(ClientInterface::class);
$httpClient
->expects($this->once())
->method('sendRequest')
Expand All @@ -61,7 +61,7 @@ public function testAuthenticateWillThrowWhenNoTokenIsReturned() {
public function testWillThrowWhenAPIReturns403() {
$this->expectException(VaultAuthenticationException::class);

$httpClient = $this->createMock(HttpClient::class);
$httpClient = $this->createMock(ClientInterface::class);
$auth = $this->createMock(AuthenticationProviderInterface::class);
$auth
->expects($this->once())
Expand All @@ -76,7 +76,7 @@ public function testSendRequestWillThrow() {
$this->expectException(VaultHttpException::class);
$this->expectExceptionMessage('foobarMessage');

$httpClient = $this->createMock(HttpClient::class);
$httpClient = $this->createMock(ClientInterface::class);
$httpClient
->expects($this->once())
->method('sendRequest')
Expand All @@ -97,7 +97,7 @@ public function testWillThrowWhenReturnClassDeclarationIsInvalid() {
$this->expectException(VaultException::class);
$this->expectExceptionMessage('Return Class declaration lacks static::fromResponse');

$httpClient = $this->createMock(HttpClient::class);
$httpClient = $this->createMock(ClientInterface::class);
$httpClient
->expects($this->once())
->method('sendRequest')
Expand All @@ -118,7 +118,7 @@ public function testWillThrowWhenReturnClassDeclarationIsInvalidForBulk() {
$this->expectException(VaultException::class);
$this->expectExceptionMessage('Return Class declaration lacks static::fromBulkResponse');

$httpClient = $this->createMock(HttpClient::class);
$httpClient = $this->createMock(ClientInterface::class);
$httpClient
->expects($this->once())
->method('sendRequest')
Expand All @@ -139,7 +139,7 @@ public function testWillThrowWhenResultOfReturnClassDeclarationIsInvalid() {
$this->expectException(VaultException::class);
$this->expectExceptionMessage('Result from "fromResponse/fromBulkResponse" isn\'t an instance of EndpointResponse');

$httpClient = $this->createMock(HttpClient::class);
$httpClient = $this->createMock(ClientInterface::class);
$httpClient
->expects($this->once())
->method('sendRequest')
Expand Down
4 changes: 2 additions & 2 deletions tests/VaultPHP/SecretEngines/AbstractSecretEngineTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
namespace Test\VaultPHP\SecretEngines;

use GuzzleHttp\Psr7\Response;
use Http\Client\HttpClient;
use PHPUnit\Framework\TestCase;
use Psr\Http\Client\ClientInterface;
use Psr\Http\Message\RequestInterface;
use VaultPHP\Authentication\Provider\Token;
use VaultPHP\VaultClient;
Expand All @@ -17,7 +17,7 @@ abstract class AbstractSecretEngineTestCase extends TestCase
{
protected function createApiClient($expectedMethod, $expectedPath, $expectedData, $responseData, $responseStatus = 200)
{
$httpMock = $this->createMock(HttpClient::class);
$httpMock = $this->createMock(ClientInterface::class);
$httpMock
->expects($this->once())
->method('sendRequest')
Expand Down
4 changes: 2 additions & 2 deletions tests/VaultPHP/TestHelperTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Test\VaultPHP;

use GuzzleHttp\Psr7\Response;
use Http\Client\HttpClient;
use Psr\Http\Client\ClientInterface;
use VaultPHP\Authentication\Provider\Token;
use VaultPHP\Response\EndpointResponse;
use VaultPHP\VaultClient;
Expand All @@ -29,7 +29,7 @@ private function simulateApiResponse($responseStatus, $responseBody = '', $respo
$response = new Response($responseStatus, $responseHeader, $responseBody);
$auth = new Token('fooToken');

$httpClient = $this->createMock(HttpClient::class);
$httpClient = $this->createMock(ClientInterface::class);

$httpClient
->expects($this->once())
Expand Down
8 changes: 4 additions & 4 deletions tests/VaultPHP/VaultClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
namespace Test\VaultPHP;

use GuzzleHttp\Psr7\Response;
use Http\Client\HttpClient;
use PHPUnit\Framework\TestCase;
use Psr\Http\Client\ClientInterface;
use Psr\Http\Message\RequestInterface;
use Test\VaultPHP\Mocks\EndpointResponseMock;
use VaultPHP\Authentication\AuthenticationProviderInterface;
Expand All @@ -23,7 +23,7 @@ final class VaultClientTest extends TestCase
public function testAuthProviderGetsClientInjected()
{
$auth = new Token('foo');
$httpClient = $this->createMock(HttpClient::class);
$httpClient = $this->createMock(ClientInterface::class);
$client = new VaultClient($httpClient, $auth, TEST_VAULT_ENDPOINT);

$this->assertSame($client, $auth->getVaultClient());
Expand All @@ -32,7 +32,7 @@ public function testAuthProviderGetsClientInjected()
public function testRequestWillExtendedWithDefaultVars() {
$auth = new Token('fooToken');

$httpClient = $this->createMock(HttpClient::class);
$httpClient = $this->createMock(ClientInterface::class);
$httpClient
->expects($this->once())
->method('sendRequest')
Expand Down Expand Up @@ -61,7 +61,7 @@ public function testRequestWillExtendedWithDefaultVars() {
public function testSendRequest() {
$response = new Response();

$httpClient = $this->createMock(HttpClient::class);
$httpClient = $this->createMock(ClientInterface::class);
$httpClient
->expects($this->once())
->method('sendRequest')
Expand Down
Loading