Skip to content

Commit

Permalink
Merge pull request #13 from leroy-merlin-br/chore/bump-packages
Browse files Browse the repository at this point in the history
chore: add support to php 8 and drop php 7.x
  • Loading branch information
orlandocavassani authored Aug 11, 2023
2 parents 57b9bfd + 5a88bfe commit 0a6361b
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 12 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@ jobs:
strategy:
matrix:
php:
- "7.2"
- "7.3"
- "7.4"
- "8.0"
- "8.1"
- "8.2"
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
"keywords": ["exacttarget", "laravel", "salesforce", "rest", "api", "sdk"],
"license": "MIT",
"require": {
"php": ">=7.2",
"php": "^8.0",
"ext-json": "*",
"illuminate/config": "^5.8 || ^6.0 || ^7.0 || ^8.0",
"illuminate/support": "^5.8 || ^6.0 || ^7.0 || ^8.0",
"illuminate/config": "^9.0 || ^10.0",
"illuminate/support": "^9.0 || ^10.0",
"guzzlehttp/guzzle": "^7.4.5"
},
"require-dev": {
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:7.2-fpm
FROM php:8.0-fpm
LABEL maintainer="[email protected]"

USER root:root
Expand Down
20 changes: 15 additions & 5 deletions tests/RequestBuilderTest.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
<?php
namespace LeroyMerlin\ExactTarget;

use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\ClientException;
use GuzzleHttp\Psr7\Response;
use LeroyMerlin\ExactTarget\Exception\RequestException;
use Mockery as m;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\StreamInterface;

/**
* Test case for Request class
Expand Down Expand Up @@ -62,24 +67,29 @@ public function testCallShouldHitEndpointUsingCustomParameters()

public function testCallShouldThrowAnExceptionIfRequestFails()
{
$exception = m::mock('GuzzleHttp\Exception\ClientException');
$response = m::mock('Psr\Http\Message\ResponseInterface');
$exception = m::mock(ClientException::class);
$response = m::mock(ResponseInterface::class);
$stream = m::mock(StreamInterface::class);

$response->shouldReceive('getBody')
->once()
->andReturn('Unexpected error ocurred');
->andReturn($stream);

$stream->shouldReceive('__toString')
->once()
->andReturn('Unexpected error occurred');

$exception->shouldReceive('getResponse')
->once()
->andReturn($response);

$client = m::mock('GuzzleHttp\ClientInterface');
$client = m::mock(ClientInterface::class);
$client->shouldReceive('request')
->once()
->andThrow($exception);

$this->expectException(RequestException::class);
$this->expectExceptionMessage('Unexpected error ocurred');
$this->expectExceptionMessage('Unexpected error occurred');

(new RequestBuilder($client))->request('some-action');
}
Expand Down

0 comments on commit 0a6361b

Please sign in to comment.