Skip to content

Commit d489cfc

Browse files
committed
minor symfony#57865 [DomCrawler] fix test on Windows (xabbuh)
This PR was merged into the 7.2 branch. Discussion ---------- [DomCrawler] fix test on Windows | Q | A | ------------- | --- | Branch? | 7.2 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | | License | MIT Commits ------- 69ad409 fix test on Windows
2 parents 127a824 + 69ad409 commit d489cfc

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Symfony/Component/DomCrawler/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)