Skip to content

Commit

Permalink
Prepare for new swoole releases (#158)
Browse files Browse the repository at this point in the history
Also dropped PHP 8.0 and make sure we support open-swoole
  • Loading branch information
Nyholm authored Dec 12, 2023
1 parent 4ec0b4c commit d27c224
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
5 changes: 2 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# Change Log

## [NOT RELEASED]

### Added
## 0.4.0

- Add support for Symfony 7
- Drop support for PHP 7 and PHP 8.0

## 0.3.1

Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
}
],
"require": {
"php": ">=8.0.5",
"symfony/runtime": "^5.4 || ^6.0 || ^7.0"
"php": ">=8.1",
"symfony/runtime": "^5.4.26 || ^6.3.2 || ^7.0"
},
"require-dev": {
"illuminate/http": "^9.14",
"phpunit/phpunit": "^9.5",
"phpunit/phpunit": "^9.6.15",
"swoole/ide-helper": "^4.6",
"symfony/http-foundation": "^5.4 || ^6.0 || ^7.0",
"symfony/http-kernel": "^5.4 || ^6.0 || ^7.0"
"symfony/http-foundation": "^5.4.32 || ^6.3.9 || ^7.0",
"symfony/http-kernel": "^5.4.33 || ^6.3.10 || ^7.0"
},
"conflict": {
"ext-swoole": "<4.6.0"
Expand Down
4 changes: 3 additions & 1 deletion src/SymfonyHttpBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ public static function convertSwooleRequest(Request $request): SymfonyRequest
public static function reflectSymfonyResponse(SymfonyResponse $sfResponse, Response $response): void
{
foreach ($sfResponse->headers->all() as $name => $values) {
$response->header((string) $name, $values);
foreach ((array) $values as $value) {
$response->header((string) $name, $value);
}
}

$response->status($sfResponse->getStatusCode());
Expand Down
7 changes: 4 additions & 3 deletions tests/Unit/SymfonyHttpBridgeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,10 @@ public function testThatSymfonyResponseIsReflected(): void
$sfResponse->expects(self::once())->method('getContent')->willReturn('Test');

$response = $this->createMock(Response::class);
$response->expects(self::exactly(2))->method('header')->withConsecutive(
['x-test', ['Swoole-Runtime']],
['set-cookie', [$fooCookie, $barCookie]]
$response->expects(self::exactly(3))->method('header')->withConsecutive(
['x-test', 'Swoole-Runtime'],
['set-cookie', $fooCookie],
['set-cookie', $barCookie]
);
$response->expects(self::once())->method('status')->with(201);
$response->expects(self::once())->method('end')->with('Test');
Expand Down

0 comments on commit d27c224

Please sign in to comment.