|
7 | 7 | use Swoole\Http\Request; |
8 | 8 | use Swoole\Http\Response; |
9 | 9 | use Symfony\Component\HttpFoundation\BinaryFileResponse; |
| 10 | +use Symfony\Component\HttpFoundation\Cookie; |
10 | 11 | use Symfony\Component\HttpFoundation\File\UploadedFile; |
11 | 12 | use Symfony\Component\HttpFoundation\HeaderBag; |
12 | 13 | use Symfony\Component\HttpFoundation\Request as SymfonyRequest; |
@@ -59,13 +60,22 @@ public function testThatSwooleRequestIsConverted(): void |
59 | 60 |
|
60 | 61 | public function testThatSymfonyResponseIsReflected(): void |
61 | 62 | { |
| 63 | + $fooCookie = (string) new Cookie('foo', '123'); |
| 64 | + $barCookie = (string) new Cookie('bar', '234'); |
| 65 | + |
62 | 66 | $sfResponse = $this->createMock(SymfonyResponse::class); |
63 | | - $sfResponse->headers = new HeaderBag(['X-Test' => 'Swoole-Runtime']); |
| 67 | + $sfResponse->headers = new HeaderBag([ |
| 68 | + 'X-Test' => 'Swoole-Runtime', |
| 69 | + 'Set-Cookie' => [$fooCookie, $barCookie], |
| 70 | + ]); |
64 | 71 | $sfResponse->expects(self::once())->method('getStatusCode')->willReturn(201); |
65 | 72 | $sfResponse->expects(self::once())->method('getContent')->willReturn('Test'); |
66 | 73 |
|
67 | 74 | $response = $this->createMock(Response::class); |
68 | | - $response->expects(self::once())->method('header')->with('x-test', 'Swoole-Runtime'); |
| 75 | + $response->expects(self::exactly(2))->method('header')->withConsecutive( |
| 76 | + ['x-test', ['Swoole-Runtime']], |
| 77 | + ['set-cookie', [$fooCookie, $barCookie]] |
| 78 | + ); |
69 | 79 | $response->expects(self::once())->method('status')->with(201); |
70 | 80 | $response->expects(self::once())->method('end')->with('Test'); |
71 | 81 |
|
|
0 commit comments