diff --git a/core/modules/system/tests/modules/url_alter_test/src/PathProcessorTest.php b/core/modules/system/tests/modules/url_alter_test/src/PathProcessorTest.php
index e6b9fc2..da131b0 100644
--- a/core/modules/system/tests/modules/url_alter_test/src/PathProcessorTest.php
+++ b/core/modules/system/tests/modules/url_alter_test/src/PathProcessorTest.php
@@ -25,6 +25,12 @@ public function processInbound($path, Request $request) {
       }
     }
 
+
+    // Verify that $options are alterable.
+    if ($path == '/user/login') {
+      $options['query']['foo'] = 'bar';
+    }
+
     // Rewrite community/ to forum/.
     $path = preg_replace('@^/community(.*)@', '/forum$1', $path);
 
diff --git a/core/tests/Drupal/KernelTests/Core/Path/UrlAlterTest.php b/core/tests/Drupal/KernelTests/Core/Path/UrlAlterTest.php
new file mode 100644
index 0000000..37ac65a
--- /dev/null
+++ b/core/tests/Drupal/KernelTests/Core/Path/UrlAlterTest.php
@@ -0,0 +1,28 @@
+<?php
+
+namespace Drupal\KernelTests\Core\Path;
+
+use Drupal\Core\Url;
+use Drupal\KernelTests\KernelTestBase;
+
+/**
+ * Tests the capability to alter URLs.
+ *
+ * @group Path
+ *
+ * @see \Drupal\Core\Routing\UrlGenerator::processPath
+ */
+class UrlAlterTest extends KernelTestBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public static $modules = ['path', 'url_alter_test', 'user'];
+
+  public function testUrlWithQueryString() {
+    // Test outbound query string altering.
+    $url = Url::fromRoute('user.login');
+    $this->assertEquals(\Drupal::request()->getBaseUrl() . '/user/login?foo=bar', $url->toString());
+  }
+
+}
diff --git a/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php b/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php
index 06e8c17..6e84492 100644
--- a/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php
+++ b/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php
@@ -69,6 +69,13 @@ class UrlGeneratorTest extends UnitTestCase {
   protected $context;
 
   /**
+   * The path processor.
+   *
+   * @var \Drupal\Core\PathProcessor\PathProcessorManager
+   */
+  protected $processorManager;
+
+  /**
    * {@inheritdoc}
    */
   protected function setUp() {
@@ -156,6 +163,7 @@ protected function setUp() {
     $processor = new PathProcessorAlias($this->aliasManager);
     $processor_manager = new PathProcessorManager();
     $processor_manager->addOutbound($processor, 1000);
+    $this->processorManager = $processor_manager;
 
     $this->routeProcessorManager = $this->getMockBuilder('Drupal\Core\RouteProcessor\RouteProcessorManager')
       ->disableOriginalConstructor()
@@ -363,6 +371,13 @@ public function providerTestAliasGenerationWithOptions() {
       ['query' => ['page' => '1/2'], 'fragment' => 'bottom'],
       '/test/two/7?page=1/2#bottom',
     ];
+    // A NULL query string.
+    $data['query-with-NULL'] = [
+      'test_2',
+      ['narf' => '7'],
+      ['query' => NULL, 'fragment' => 'bottom'],
+      '/test/two/7#bottom',
+    ];
     return $data;
   }
 
@@ -490,6 +505,27 @@ public function providerTestNoPath() {
   }
 
   /**
+   * @covers \Drupal\Core\Routing\UrlGenerator::calculateQueryOptions
+   * @covers \Drupal\Core\Routing\UrlGenerator::generatePathWithString
+   *
+   * Note: We use absolute covers to let
+   * \Drupal\Tests\Core\Render\MetadataBubblingUrlGeneratorTest work.
+   */
+  public function testGenerateWithPathProcessorChangingQueryParameter() {
+    $path_processor = $this->getMock(OutboundPathProcessorInterface::CLASS);
+    $path_processor->expects($this->atLeastOnce())
+      ->method('processOutbound')
+      ->willReturnCallback(function ($path, &$options = array(), Request $request = NULL, BubbleableMetadata $bubbleable_metadata = NULL) {
+        $options['query'] = ['zoo' => 5];
+        return $path;
+      });
+    $this->processorManager->addOutbound($path_processor);
+
+    $options = [];
+    $this->assertGenerateFromRoute('test_2', ['narf' => 5], $options, '/goodbye/cruel/world?zoo=5', (new BubbleableMetadata())->setCacheMaxAge(Cache::PERMANENT));
+  }
+
+  /**
    * Asserts \Drupal\Core\Routing\UrlGenerator::generateFromRoute()'s output.
    *
    * @param $route_name
