You are here

public function EntityClassFormatterTest::testAttrValue in Entity Class Formatter 8

File

tests/src/Functional/EntityClassFormatterTest.php, line 114

Class

EntityClassFormatterTest
@group entity_class_formatter

Namespace

Drupal\Tests\entity_class_formatter\Functional

Code

public function testAttrValue() {
  $field_config = $this
    ->createField('string', self::ATTR_NAME);
  $entity = $this
    ->drupalCreateNode([
    $field_config
      ->getName() => [
      0 => [
        'value' => self::ATTR_VALUE,
      ],
    ],
  ]);
  $entity
    ->save();
  $this
    ->drupalGet($entity
    ->toUrl());
  $assert_session = $this
    ->assertSession();
  $class = self::CLASS_PREFIX . self::ATTR_VALUE . self::CLASS_SUFFIX;
  $selector = '.node[' . self::ATTR_NAME . '="' . $class . '"]';
  $assert_session
    ->elementExists('css', $selector);
}