You are here

protected function CommentAlterTestBase::assertCommentSettings in Comment Alter 8

Asserts that added checkboxes on field config are working as expected.

Parameters

string $field_name: The comment alterable field added to the entity_test_bundle.

6 calls to CommentAlterTestBase::assertCommentSettings()
CommentAlterListStringTest::testOptionsSelectMultiple in tests/src/Functional/CommentAlterListStringTest.php
Tests for multi-valued List (string) fields comment altering.
CommentAlterListStringTest::testOptionsSelectSingle in tests/src/Functional/CommentAlterListStringTest.php
Tests for single valued List (string) fields comment altering.
CommentAlterNodeReferenceTest::testEntityReferenceFieldMultiple in tests/src/Functional/CommentAlterNodeReferenceTest.php
Tests for multi-valued node reference field comment altering.
CommentAlterNodeReferenceTest::testEntityReferenceFieldSingle in tests/src/Functional/CommentAlterNodeReferenceTest.php
Tests for single valued node reference field comment altering.
CommentAlterTextTest::testTextFieldMultiple in tests/src/Functional/CommentAlterTextTest.php
Tests for multi-valued text field comment altering.

... See full list

File

tests/src/Functional/CommentAlterTestBase.php, line 273

Class

CommentAlterTestBase
Base class for Comment Alter test cases.

Namespace

Drupal\Tests\comment_alter\Functional

Code

protected function assertCommentSettings($field_name) {
  $comment_config = $this->entity
    ->getFieldDefinition('comment');
  $comment_config
    ->setThirdPartySetting('comment_alter', 'comment_alter_reply', TRUE)
    ->save();
  $this
    ->drupalGet('comment/reply/' . $this->entityType . '/' . $this->entity
    ->id() . '/comment/1');
  $this
    ->assertSession()
    ->fieldExists($field_name);
  $alterable_field_config = $this->entity
    ->getFieldDefinition($field_name);
  $alterable_field_config
    ->setThirdPartySetting('comment_alter', 'comment_alter_hide', TRUE)
    ->save();
  $this
    ->drupalGet('entity_test_rev/manage/' . $this->entity
    ->id());
  $this
    ->assertSession()
    ->pageTextContains(t('Changes are hidden'));
}