You are here

public function CommentUpdateTest::testCommentEntityTypeAndFieldUpdateRequirementsCheck in Drupal 8

Test the update hook requirements check for 8701.

See also

comment_update_8701()

comment_requirements()

File

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

Class

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

Namespace

Drupal\Tests\comment\Functional\Update

Code

public function testCommentEntityTypeAndFieldUpdateRequirementsCheck() {
  require_once __DIR__ . '/../../../fixtures/update/drupal-8.empty-comment-fields.3052147.php';
  $this
    ->writeSettings([
    'settings' => [
      'update_free_access' => (object) [
        'value' => TRUE,
        'required' => TRUE,
      ],
    ],
  ]);
  $this
    ->drupalGet($this->updateUrl);
  $this
    ->assertSession()
    ->pageTextContains('Errors found');
  $this
    ->assertSession()
    ->elementContains('css', '.system-status-report__entry--error', 'The comment_update_8701() function requires that the <em class="placeholder">entity_type</em> and <em class="placeholder">field_name</em> fields have values for all comment entities.');
}