Skip to content

Commit 5ff4ec7

Browse files
committed
update
1 parent cd2919d commit 5ff4ec7

File tree

2 files changed

+27
-22
lines changed

2 files changed

+27
-22
lines changed

src/bref/tests/SymfonyRequestBridgeTest.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ public function testRawContent()
6161
rfc
6262
------------------------------83ff53821b7c--
6363
64-
HTTP
65-
,
64+
HTTP,
6665
]), $this->getContext());
6766
$this->assertSame('', $request->getContent());
6867
}
@@ -90,8 +89,7 @@ public function testUploadedFile()
9089
bar
9190
------------------------------83ff53821b7c--
9291
93-
HTTP
94-
,
92+
HTTP,
9593
]), $this->getContext());
9694
$files = $request->files->all();
9795
$this->assertArrayHasKey('img', $files['form']);
@@ -124,8 +122,7 @@ public function testEmptyUploadedFile()
124122
bar
125123
------------------------------83ff53821b7c--
126124
127-
HTTP
128-
,
125+
HTTP,
129126
]), $this->getContext());
130127
$files = $request->files->all();
131128
$this->assertArrayHasKey('img', $files['form']);

src/swoole/tests/Unit/SymfonyHttpBridgeTest.php

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,20 @@ public function testThatSymfonyResponseIsReflected(): void
7373

7474
$response = $this->createMock(Response::class);
7575
$expectedHeaders = [
76-
1 => ['x-test', 'Swoole-Runtime'],
77-
2 => ['set-cookie', $fooCookie],
78-
3 => ['set-cookie', $barCookie],
76+
['x-test', 'Swoole-Runtime'],
77+
['set-cookie', $fooCookie],
78+
['set-cookie', $barCookie],
7979
];
80-
$response->expects(self::exactly(3))->method('header')->willReturnCallback(function ($key, $value) use ($expectedHeaders) {
81-
$this->assertEquals([$key, $value], array_shift($expectedHeaders));
82-
83-
return true;
84-
});
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+
});
8590
$response->expects(self::once())->method('status')->with(201);
8691
$response->expects(self::once())->method('end')->with('Test');
8792

@@ -100,15 +105,18 @@ public function testThatSymfonyStreamedResponseIsReflected(): void
100105

101106
$response = $this->createMock(Response::class);
102107
$expectedWrites = [
103-
1 => "Foo\n",
104-
2 => "Bar\n",
105-
3 => '',
108+
"Foo\n",
109+
"Bar\n",
110+
'',
106111
];
107-
$response->expects(self::exactly(3))->method('write')->willReturnCallback(function ($string) use ($expectedWrites) {
108-
$this->assertSame(array_shift($expectedWrites), $string);
109-
110-
return true;
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+
});
112120
$response->expects(self::once())->method('end');
113121

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

0 commit comments

Comments
 (0)