Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c94273e

Browse filesBrowse files
committed
add non-regression test
1 parent 9507118 commit c94273e
Copy full SHA for c94273e

File tree

1 file changed

+17
-0
lines changed
Filter options

1 file changed

+17
-0
lines changed

‎src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php
+17Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,5 +640,22 @@ public function testExtensionTypesIncoherent()
640640
->assertRaised();
641641
}
642642

643+
public function testUploadedFileExtensions()
644+
{
645+
$file = new UploadedFile(__DIR__.'/Fixtures/bar', 'bar.txt', 'text/plain', \UPLOAD_ERR_OK, true);
646+
647+
try {
648+
$file->getMimeType();
649+
} catch (\LogicException $e) {
650+
$this->markTestSkipped('Guessing the mime type is not possible');
651+
}
652+
653+
$constraint = new File(mimeTypesMessage: 'myMessage', extensions: ['txt']);
654+
655+
$this->validator->validate($file, $constraint);
656+
657+
$this->assertNoViolation();
658+
}
659+
643660
abstract protected function getFile($filename);
644661
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.