Skip to content

Commit 5aeb142

Browse files
committed
fix test after feedback
1 parent 1762da7 commit 5aeb142

File tree

3 files changed

+20
-18
lines changed

3 files changed

+20
-18
lines changed

sapi/fpm/tests/getallheaders.phpt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,11 @@ $tester->request(
3939
)->expectBody(
4040
[
4141
'Test Start',
42-
'array(5) {',
42+
'array(4) {',
4343
' ["Foo"]=>',
4444
' string(3) "foo"',
4545
' ["X-Foo"]=>',
4646
' string(3) "BAR"',
47-
' ["Authorization"]=>',
48-
' string(0) ""',
4947
' ["Content-Length"]=>',
5048
' string(1) "0"',
5149
' ["Content-Type"]=>',

sapi/fpm/tests/gh15395.phpt

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,26 @@ $tester->start();
3333
$tester->expectLogStartNotices();
3434
$tester
3535
->request(
36-
uri: $scriptName,
37-
address: '{{ADDR:UDS}}',
38-
scriptFilename: "/",
39-
scriptName: "/",
40-
httpAuthorization: "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==",
36+
uri: $scriptName,
37+
address: '{{ADDR:UDS}}',
38+
scriptFilename: "/",
39+
scriptName: "/",
40+
headers: ["HTTP_AUTHORIZATION" => "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="],
4141
);
42+
$tester->terminate();
43+
$tester->expectLogTerminatingNotices();
44+
$tester->close();
4245

46+
$tester = new FPM\Tester($cfg, $code);
47+
[$sourceFilePath, $scriptName] = $tester->createSourceFileAndScriptName();
48+
$tester->start();
49+
$tester->expectLogStartNotices();
4350
$tester
4451
->request(
45-
uri: $scriptName,
46-
address: '{{ADDR:UDS}}',
47-
scriptFilename: "/",
48-
scriptName: "/",
52+
uri: $scriptName,
53+
address: '{{ADDR:UDS}}',
54+
scriptFilename: "/",
55+
scriptName: "/",
4956
);
5057
$tester->terminate();
5158
$tester->expectLogTerminatingNotices();

sapi/fpm/tests/tester.inc

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -627,8 +627,7 @@ class Tester
627627
string $uri = null,
628628
string $scriptFilename = null,
629629
string $scriptName = null,
630-
?string $stdin = null,
631-
?string $httpAuthorization = null
630+
?string $stdin = null
632631
): array {
633632
if (is_null($scriptFilename)) {
634633
$scriptFilename = $this->makeSourceFile();
@@ -658,8 +657,7 @@ class Tester
658657
'SERVER_PROTOCOL' => 'HTTP/1.1',
659658
'DOCUMENT_ROOT' => __DIR__,
660659
'CONTENT_TYPE' => '',
661-
'CONTENT_LENGTH' => strlen($stdin ?? ""), // Default to 0
662-
'HTTP_AUTHORIZATION' => $httpAuthorization ? $httpAuthorization : ""
660+
'CONTENT_LENGTH' => strlen($stdin ?? "") // Default to 0
663661
],
664662
$headers
665663
);
@@ -764,7 +762,6 @@ class Tester
764762
string|array $stdin = null,
765763
bool $expectError = false,
766764
int $readLimit = -1,
767-
string $httpAuthorization = null,
768765
): Response {
769766
if ($this->hasError()) {
770767
return $this->createResponse(expectInvalid: true);
@@ -774,7 +771,7 @@ class Tester
774771
$stdin = $this->parseStdin($stdin, $headers);
775772
}
776773

777-
$params = $this->getRequestParams($query, $headers, $uri, $scriptFilename, $scriptName, $stdin, $httpAuthorization);
774+
$params = $this->getRequestParams($query, $headers, $uri, $scriptFilename, $scriptName, $stdin);
778775
$this->trace('Request params', $params);
779776

780777
try {

0 commit comments

Comments
 (0)