diff --git a/core/tests/Drupal/KernelTests/Core/Path/PathValidatorTest.php b/core/tests/Drupal/KernelTests/Core/Path/PathValidatorTest.php index 34a7bdf000..1d1e275aec 100644 --- a/core/tests/Drupal/KernelTests/Core/Path/PathValidatorTest.php +++ b/core/tests/Drupal/KernelTests/Core/Path/PathValidatorTest.php @@ -48,8 +48,8 @@ public function testGetUrlIfValidWithoutAccessCheck() { 'PUT', 'PATCH', 'DELETE', - // NULL is used in CLI context which results in a request method of an - // empty string. + // Used in CLI context. + NULL, '', // If no request was even pushed onto the request stack, and hence. FALSE, @@ -63,7 +63,9 @@ public function testGetUrlIfValidWithoutAccessCheck() { $this->container->set('router.request_context', new RequestContext()); } - $requestContext->setMethod($method); + // The NULL value is used in CLI context which results in a request method + // of an empty string. + $requestContext->setMethod($method ?? ''); /** @var \Drupal\Core\Url $url */ $url = $pathValidator->getUrlIfValidWithoutAccessCheck($entity->toUrl()->toString(TRUE)->getGeneratedUrl()); $this->assertEquals($method, $requestContext->getMethod());