Skip to content

Commit

Permalink
No longer to support PHP < 8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
parsilver committed Dec 8, 2023
1 parent b710388 commit 5054d6e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest]
php: [8.2, 8.1, 8.0]
php: [8.3, 8.2, 8.1]
stability: [prefer-lowest, prefer-stable]

name: P${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ A HTTP client for Farzai Package.
You can install the package via composer:

```bash
composer require farzai/transport:dev-main
composer require farzai/transport
```

## Testing
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
}
],
"require": {
"php": "^8.0",
"php": "^8.1",
"farzai/support": "^1.1",
"guzzlehttp/guzzle": "^7.7",
"guzzlehttp/psr7": "^2.5",
Expand Down
16 changes: 15 additions & 1 deletion tests/ResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,21 @@
expect($response->json())->toBe(['foo' => 'bar']);
});

it('can get json body with dot notation', function () {
$stream = $this->createMock(StreamInterface::class);
$stream->method('getContents')->willReturn('{"foo":{"bar":"baz"}}');

$baseResponse = $this->createMock(ResponseInterface::class);
$baseResponse->method('getBody')->willReturn($stream);

$response = new Response(
$this->createMock(RequestInterface::class),
$baseResponse,
);

expect($response->json('foo.bar'))->toBe('baz');
});

it('cannot get json when invalid json format', function () {
$stream = $this->createMock(StreamInterface::class);
$stream->method('getContents')->willReturn('{"foo":"bar"');
Expand Down Expand Up @@ -116,7 +131,6 @@
$response = new Response(
$this->createMock(RequestInterface::class),
$baseResponse,

);

$response->throw();
Expand Down

0 comments on commit 5054d6e

Please sign in to comment.