Skip to content

Commit

Permalink
Merge branch '5.0'
Browse files Browse the repository at this point in the history
* 5.0:
  [HttpClient] improve testTimeoutIsNotAFatalError
  Fix for #36715
  • Loading branch information
nicolas-grekas committed May 9, 2020
2 parents 34809eb + 9509b35 commit b439f55
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion MimeTypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function __construct(array $map = [])
$this->extensions[$mimeType] = $extensions;

foreach ($extensions as $extension) {
$this->mimeTypes[$extension] = $mimeType;
$this->mimeTypes[$extension][] = $mimeType;
}
}
$this->registerGuesser(new FileBinaryMimeTypeGuesser());
Expand Down
11 changes: 11 additions & 0 deletions Tests/MimeTypesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,15 @@ public function testGetMimeTypes()
$this->assertContains('image/svg', $mt->getMimeTypes('svg'));
$this->assertSame([], $mt->getMimeTypes('symfony'));
}

public function testCustomMimeTypes()
{
$mt = new MimeTypes([
'text/bar' => ['foo'],
'text/baz' => ['foo', 'moof'],
]);
$this->assertContains('text/bar', $mt->getMimeTypes('foo'));
$this->assertContains('text/baz', $mt->getMimeTypes('foo'));
$this->assertSame(['foo', 'moof'], $mt->getExtensions('text/baz'));
}
}

0 comments on commit b439f55

Please sign in to comment.