Skip to content
Snippets Groups Projects
Commit 63416c96 authored by catch's avatar catch
Browse files

Issue #3186009 by longwave, ankithashetty, klausi: MimeTypePass has undefined variables

parent 6c647637
Branches
Tags
6 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!1012Issue #3226887: Hreflang on non-canonical content pages,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10,!596Issue #3046532: deleting an entity reference field, used in a contextual view, makes the whole site unrecoverable,!496Issue #2463967: Use .user.ini file for PHP settings,!16Draft: Resolve #2081585 "History storage"
......@@ -55,16 +55,7 @@ public function process(ContainerBuilder $container) {
// Add a method call for each handler to the consumer service
// definition.
foreach ($handlers as $id => $priority) {
$arguments = [];
$arguments[0] = new Reference($id);
if (isset($priority_pos)) {
$arguments[$priority_pos] = $priority;
}
if (isset($id_pos)) {
$arguments[$id_pos] = $id;
}
// Sort the arguments by position.
ksort($arguments);
$arguments = [new Reference($id), $priority];
if (is_subclass_of($interfaces[$id], $interface)) {
$consumer->addMethodCall('addMimeTypeGuesser', $arguments);
}
......
......@@ -34,15 +34,17 @@ public function testProcessLegacy() {
$container
->register('handler1', __NAMESPACE__ . '\NewMimeTypeGuesser')
->addTag('mime_type_guesser');
->addTag('mime_type_guesser', ['priority' => 200]);
$container
->register('handler2', __NAMESPACE__ . '\LegacyMimeTypeGuesser')
->addTag('mime_type_guesser');
->addTag('mime_type_guesser', ['priority' => 100]);
$handler_pass = new MimeTypePass();
$handler_pass->process($container);
$method_calls = $container->getDefinition('file.mime_type.guesser')->getMethodCalls();
$this->assertCount(2, $method_calls);
$this->assertSame(200, $method_calls[0][1][1]);
$this->assertSame(100, $method_calls[1][1][1]);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment