Skip to content

Commit 4e44d67

Browse files
committed
make tests stricter
1 parent dbc4887 commit 4e44d67

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

tests/Handler/FpmHandlerTest.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,8 @@ public function test POST request with multipart file uploads(int $version
732732
],
733733
'body' => $body,
734734
];
735-
$this->assertGlobalVariables($event, [
735+
736+
$expectedGlobalVariables = [
736737
'$_GET' => [],
737738
'$_POST' => [],
738739
'$_FILES' => [
@@ -742,13 +743,15 @@ public function test POST request with multipart file uploads(int $version
742743
'error' => 0,
743744
'size' => 57,
744745
'content' => "Lorem ipsum dolor sit amet,\nconsectetur adipiscing elit.\n",
746+
'full_path' => 'lorem.txt',
745747
],
746748
'bar' => [
747749
'name' => 'cars.csv',
748750
'type' => '',
749751
'error' => 0,
750752
'size' => 51,
751753
'content' => "Year,Make,Model\n1997,Ford,E350\n2000,Mercury,Cougar\n",
754+
'full_path' => 'cars.csv',
752755
],
753756
],
754757
'$_COOKIE' => [],
@@ -767,7 +770,15 @@ public function test POST request with multipart file uploads(int $version
767770
'LAMBDA_REQUEST_CONTEXT' => '[]',
768771
],
769772
'HTTP_RAW_BODY' => '',
770-
]);
773+
];
774+
775+
if (\PHP_VERSION_ID < 80100) {
776+
// full_path was introduced in PHP 8.1, remove it for lower versions
777+
unset($expectedGlobalVariables['$_FILES']['foo']['full_path']);
778+
unset($expectedGlobalVariables['$_FILES']['bar']['full_path']);
779+
}
780+
781+
$this->assertGlobalVariables($event, $expectedGlobalVariables);
771782
}
772783

773784
/**
@@ -1117,7 +1128,7 @@ private function assertGlobalVariables(array $event, array $expectedGlobalVariab
11171128
// Test global variables that never change (simplifies all the tests)
11181129
$response = $this->assertCommonServerVariables($response, $expectedGlobalVariables);
11191130

1120-
self::assertArraySubset($expectedGlobalVariables, $response);
1131+
self::assertEquals($expectedGlobalVariables, $response);
11211132
}
11221133

11231134
private function assertCommonServerVariables(array $response, array $expectedGlobalVariables): array

0 commit comments

Comments
 (0)