diff --git a/core/modules/comment/comment.install b/core/modules/comment/comment.install index 5f2c499..9a50a88 100644 --- a/core/modules/comment/comment.install +++ b/core/modules/comment/comment.install @@ -136,8 +136,7 @@ function comment_update_8001() { */ /** - * Adds the new 'view_mode' setting to all view displays using the - * 'comment_default' formatter. + * Add the 'view_mode' setting to displays having 'comment_default' formatter. */ function comment_update_8101() { $config_factory = \Drupal::configFactory(); diff --git a/core/modules/comment/src/Tests/CommentInterfaceTest.php b/core/modules/comment/src/Tests/CommentInterfaceTest.php index 98709e9..f351102 100644 --- a/core/modules/comment/src/Tests/CommentInterfaceTest.php +++ b/core/modules/comment/src/Tests/CommentInterfaceTest.php @@ -295,8 +295,7 @@ public function testAutoFilledHtmlSubject() { } /** - * Tests the comment field formatter used with non-default comment entity view - * mode. + * Tests the comment formatter configured with a custom comment view mode. */ public function testViewMode() { $this->drupalLogin($this->webUser); diff --git a/core/modules/comment/src/Tests/Update/CommentUpdateTest.php b/core/modules/comment/src/Tests/Update/CommentUpdateTest.php index db1cb43..900c319 100644 --- a/core/modules/comment/src/Tests/Update/CommentUpdateTest.php +++ b/core/modules/comment/src/Tests/Update/CommentUpdateTest.php @@ -21,7 +21,7 @@ class CommentUpdateTest extends UpdatePathTestBase { */ protected function setDatabaseDumpFiles() { $this->databaseDumpFiles = [ - __DIR__ . '/../../../../system/tests/fixtures/update/drupal-8-rc1.bare.standard.php.gz', + __DIR__ . '/../../../../system/tests/fixtures/update/drupal-8-rc1.filled.standard.php.gz', ]; } @@ -36,12 +36,23 @@ public function testCommentUpdate8101() { $config = $this->config('core.entity_view_display.node.article.default'); $this->assertNull($config->get('content.comment.settings.view_mode')); + // Load the 'node.forum.default' entity view display config, and check that + // component 'comment_forum' does not contain the 'view_mode' setting. + $config = $this->config('core.entity_view_display.node.forum.default'); + $this->assertNull($config->get('content.comment_forum.settings.view_mode')); + // Run updates. $this->runUpdates(); - // Reload the config, and check that 'view_mode' has the value 'default'. + // Check that 'node.article.default' entity view display setting 'view_mode' + // has the value 'default'. $config = $this->config('core.entity_view_display.node.article.default'); $this->assertIdentical($config->get('content.comment.settings.view_mode'), 'default'); + + // Check that 'node.forum.default' entity view display setting 'view_mode' + // has the value 'default'. + $config = $this->config('core.entity_view_display.node.forum.default'); + $this->assertIdentical($config->get('content.comment_forum.settings.view_mode'), 'default'); } } diff --git a/core/modules/comment/tests/src/Kernel/CommentIntegrationTest.php b/core/modules/comment/tests/src/Kernel/CommentIntegrationTest.php index efde8dd..e326f4c 100644 --- a/core/modules/comment/tests/src/Kernel/CommentIntegrationTest.php +++ b/core/modules/comment/tests/src/Kernel/CommentIntegrationTest.php @@ -89,7 +89,7 @@ public function testViewMode() { EntityViewDisplay::create([ 'targetEntityType' => 'entity_test', 'bundle' => 'entity_test', - 'mode' => 'default' + 'mode' => 'default', ])->setComponent($field_name, $component)->setStatus(TRUE)->save(); $host_display_id = 'entity_test.entity_test.default'; @@ -115,10 +115,11 @@ public function testViewMode() { $logged = (bool) Database::getConnection()->select('watchdog') ->fields('watchdog', ['wid']) ->condition('type', 'system') - ->condition('message', "View display '@id': Comment field formatter '@name' was disabled because is using the comment view display '@display' (@mode) that was just disabled.") + ->condition('message', "View display '@id': Comment field formatter '@name' was disabled because it is using the comment view display '@display' (@mode) that was just disabled.") ->condition('variables', serialize($arguments)) ->execute() ->fetchField(); + $this->assertTrue($logged); // Re-enable the comment view display. EntityViewDisplay::load($comment_display_id)->setStatus(TRUE)->save();