Skip to content

Commit

Permalink
Merge 3f61175 into 7af15d9
Browse files Browse the repository at this point in the history
  • Loading branch information
JakubTesarek committed Aug 19, 2020
2 parents 7af15d9 + 3f61175 commit 076d18e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- uses: actions/checkout@v2
- uses: nanasess/setup-php@master
with:
php-version: '7.1'
php-version: '7.3'

- name: Validate composer.json and composer.lock
run: composer validate
Expand All @@ -34,4 +34,8 @@ jobs:
run: composer install --prefer-dist --no-progress --no-suggest

- name: Run test suite
env:
MATEJ_TEST_ACCOUNTID: ${{ secrets.MATEJ_TEST_ACCOUNTID }}
MATEJ_TEST_APIKEY: ${{ secrets.MATEJ_TEST_APIKEY }}
MATEJ_TEST_BASE_URL: ${{ secrets.MATEJ_TEST_BASE_URL }}
run: composer all
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
"phpstan/phpstan": "^0.12.0",
"phpstan/phpstan-phpunit": "^0.12.1",
"phpunit/phpunit": "^6.4 || ^7.0 || ^8.0",
"symfony/var-dumper": "^3.3 || ^4.0 || ^5.0"
"symfony/var-dumper": "^3.3 || ^4.0 || ^5.0",
"symplify/easy-coding-standard": "*"
},
"config": {
"sort-packages": true
Expand Down
10 changes: 8 additions & 2 deletions tests/unit/Http/Plugin/ExceptionPluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use GuzzleHttp\Psr7\Response;
use Http\Client\Promise\HttpFulfilledPromise;
use Http\Client\Promise\HttpRejectedPromise;
use Http\Promise\Promise;
use Lmc\Matej\Exception\AuthorizationException;
use Lmc\Matej\Exception\RequestException;
use PHPUnit\Framework\TestCase;
Expand All @@ -30,7 +31,9 @@ public function shouldReturnResponseWhenNoError(int $statusCode): void
};

$plugin = new ExceptionPlugin();
$promise = $plugin->handleRequest($request, $next, function (): void {});
$promise = $plugin->handleRequest($request, $next, function() use ($response): Promise {
return new HttpFulfilledPromise($response);
});
$this->assertInstanceOf(HttpFulfilledPromise::class, $promise);
$this->assertSame($response, $promise->wait());
}
Expand Down Expand Up @@ -63,7 +66,10 @@ public function shouldThrowExceptionBasedOnStatusCode(int $statusCode, string $e

$plugin = new ExceptionPlugin();

$promise = $plugin->handleRequest($request, $next, function (): void {});
$promise = $plugin->handleRequest($request, $next, function() use ($response): Promise {
return new HttpFulfilledPromise($response);
});

$this->assertInstanceOf(HttpRejectedPromise::class, $promise);

$this->expectException($expectedExceptionClass);
Expand Down

0 comments on commit 076d18e

Please sign in to comment.