diff --git a/core/modules/comment/lib/Drupal/comment/Routing/CommentBundleEnhancer.php b/core/modules/comment/lib/Drupal/comment/Routing/CommentBundleEnhancer.php index 025e6ca..54ea93a 100644 --- a/core/modules/comment/lib/Drupal/comment/Routing/CommentBundleEnhancer.php +++ b/core/modules/comment/lib/Drupal/comment/Routing/CommentBundleEnhancer.php @@ -42,8 +42,7 @@ public function __construct(EntityManager $entity_manager) { * {@inheritdoc} */ public function enhance(array $defaults, Request $request) { - $bundles = $this->entityManager->getBundleInfo('comment'); - if (isset($defaults['bundle']) && isset($bundles[$defaults['bundle']])) { + if (isset($defaults['bundle']) && ($bundles = $this->entityManager->getBundleInfo('comment')) && isset($bundles[$defaults['bundle']])) { list($entity_type, $field_name) = explode('__', $defaults['bundle'], 2); $defaults['commented_entity_type'] = $entity_type; $defaults['field_name'] = $field_name; diff --git a/core/modules/comment/tests/Drupal/comment/Tests/Routing/CommentBundleEnhancerTest.php b/core/modules/comment/tests/Drupal/comment/Tests/Routing/CommentBundleEnhancerTest.php index d86d1ba..0bc6c9c 100644 --- a/core/modules/comment/tests/Drupal/comment/Tests/Routing/CommentBundleEnhancerTest.php +++ b/core/modules/comment/tests/Drupal/comment/Tests/Routing/CommentBundleEnhancerTest.php @@ -67,6 +67,9 @@ public function providerTestEnhancer() { * * @see \Drupal\comment\Routing\CommentBundleEnhancer::enhancer() * + * @group Drupal + * @group Routing + * * @dataProvider providerTestEnhancer */ public function testEnhancer($bundle, $field_name, $commented_entity_type) {