diff --git a/core/lib/Drupal/Core/Entity/EntityCreateAccessCheck.php b/core/lib/Drupal/Core/Entity/EntityCreateAccessCheck.php index 9ceac5249d056271df3dd64eadae999c3bfc153b..b3c12a8da803867e73f099b42413c69ce82641f2 100644 --- a/core/lib/Drupal/Core/Entity/EntityCreateAccessCheck.php +++ b/core/lib/Drupal/Core/Entity/EntityCreateAccessCheck.php @@ -62,7 +62,7 @@ public function access(Route $route, RouteMatchInterface $route_match, AccountIn } // If we were unable to replace all placeholders, deny access. if (strpos($bundle, '{') !== FALSE) { - return AccessResult::neutral(); + return AccessResult::neutral(sprintf("Could not find '%s' request argument, therefore cannot check create access.", $bundle)); } } return $this->entityManager->getAccessControlHandler($entity_type)->createAccess($bundle, $account, [], TRUE); diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityCreateAccessCheckTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityCreateAccessCheckTest.php index 2c3d132cf3c0fd459717498f3ae7e0317ada080b..59f83af029dec25dae3a53884f3c2644c8a5bcc7 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityCreateAccessCheckTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityCreateAccessCheckTest.php @@ -74,6 +74,9 @@ public function testAccess($entity_bundle, $requirement, $access, $expected, $ex if ($expect_permission_context) { $expected_access_result->cachePerPermissions(); } + if (!$entity_bundle && !$expect_permission_context) { + $expected_access_result->setReason("Could not find '{bundle_argument}' request argument, therefore cannot check create access."); + } $entity_manager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');