Skip to content

Commit d30201f

Browse files
authored
Update Symfony package versions to include 8.0 (php-runtime#185)
1 parent 051ff69 commit d30201f

2 files changed

Lines changed: 30 additions & 8 deletions

File tree

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
],
1212
"require": {
1313
"php": ">=8.1",
14-
"symfony/runtime": "^5.4.26 || ^6.3.2 || ^7.0"
14+
"symfony/runtime": "^5.4.26 || ^6.3.2 || ^7.0 || ^8.0"
1515
},
1616
"require-dev": {
1717
"illuminate/http": "^9.14",
18-
"phpunit/phpunit": "^9.6.15",
18+
"phpunit/phpunit": "^10.5.58",
1919
"swoole/ide-helper": "^4.6",
20-
"symfony/http-foundation": "^5.4.32 || ^6.3.9 || ^7.0",
21-
"symfony/http-kernel": "^5.4.33 || ^6.3.10 || ^7.0"
20+
"symfony/http-foundation": "^5.4.32 || ^6.3.9 || ^7.0 || ^8.0",
21+
"symfony/http-kernel": "^5.4.33 || ^6.3.10 || ^7.0 || ^8.0"
2222
},
2323
"conflict": {
2424
"ext-swoole": "<4.6.0"

tests/Unit/SymfonyHttpBridgeTest.php

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,21 @@ public function testThatSymfonyResponseIsReflected(): void
7272
$sfResponse->expects(self::once())->method('getContent')->willReturn('Test');
7373

7474
$response = $this->createMock(Response::class);
75-
$response->expects(self::exactly(3))->method('header')->withConsecutive(
75+
$expectedHeaders = [
7676
['x-test', 'Swoole-Runtime'],
7777
['set-cookie', $fooCookie],
78-
['set-cookie', $barCookie]
79-
);
78+
['set-cookie', $barCookie],
79+
];
80+
$callCount = 0;
81+
$response->expects(self::exactly(3))->method('header')
82+
->willReturnCallback(function ($key, $value) use ($expectedHeaders, &$callCount) {
83+
$this->assertArrayHasKey($callCount, $expectedHeaders);
84+
$this->assertEquals($expectedHeaders[$callCount][0], $key);
85+
$this->assertEquals($expectedHeaders[$callCount][1], $value);
86+
++$callCount;
87+
88+
return true;
89+
});
8090
$response->expects(self::once())->method('status')->with(201);
8191
$response->expects(self::once())->method('end')->with('Test');
8292

@@ -94,7 +104,19 @@ public function testThatSymfonyStreamedResponseIsReflected(): void
94104
});
95105

96106
$response = $this->createMock(Response::class);
97-
$response->expects(self::exactly(3))->method('write')->withConsecutive(["Foo\n"], ["Bar\n"], ['']);
107+
$expectedWrites = [
108+
"Foo\n",
109+
"Bar\n",
110+
'',
111+
];
112+
$callCount = 0;
113+
$response->expects(self::exactly(3))->method('write')
114+
->willReturnCallback(function ($string) use ($expectedWrites, &$callCount) {
115+
$this->assertEquals($expectedWrites[$callCount], $string);
116+
++$callCount;
117+
118+
return true;
119+
});
98120
$response->expects(self::once())->method('end');
99121

100122
SymfonyHttpBridge::reflectSymfonyResponse($sfResponse, $response);

0 commit comments

Comments
 (0)