You are here

public function CommentUpdateTest::testCommentUpdate8101 in Drupal 8

Tests comment_update_8200().

See also

comment_update_8200()

File

core/modules/comment/tests/src/Functional/Update/CommentUpdateTest.php, line 29

Class

CommentUpdateTest
Tests that comment settings are properly updated during database updates.

Namespace

Drupal\Tests\comment\Functional\Update

Code

public function testCommentUpdate8101() {

  // Load the 'node.article.default' entity view display config, and check
  // that component 'comment' does not contain the 'view_mode' setting.
  $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();

  // 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');
}