Skip to content

Commit f160cc4

Browse files
committed
fix test on Windows
1 parent 3d4c11e commit f160cc4

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Tests/Field/FileFormFieldTest.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,16 @@ public function testSetValue($method)
7171
$field->$method(__DIR__.'/../Fixtures/no-extension');
7272
$value = $field->getValue();
7373

74+
$tmpName = $value['tmp_name'];
75+
76+
// Windows creates temporary files with a .tmp extension
77+
if ('\\' === \DIRECTORY_SEPARATOR && str_ends_with($tmpName, '.tmp')) {
78+
$tmpName = substr($tmpName, 0, -4);
79+
}
80+
7481
$this->assertArrayNotHasKey(
7582
'extension',
76-
pathinfo($value['tmp_name']),
83+
pathinfo($tmpName),
7784
"->$method() does not add a file extension in the tmp_name copy"
7885
);
7986
}

0 commit comments

Comments
 (0)