You are here

public function EntityClassFormatterTest::testEntityFieldClass in Entity Class Formatter 8

File

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

Class

EntityClassFormatterTest
@group entity_class_formatter

Namespace

Drupal\Tests\entity_class_formatter\Functional

Code

public function testEntityFieldClass() {
  $field_config = $this
    ->createField('entity_reference');
  $node = $this
    ->drupalCreateNode([
    'title' => self::ENTITY_CLASS,
  ]);
  $entity = $this
    ->drupalCreateNode([
    $field_config
      ->getName() => [
      0 => [
        'target_id' => $node
          ->id(),
      ],
    ],
  ]);
  $entity
    ->save();
  $this
    ->drupalGet($entity
    ->toUrl());
  $assert_session = $this
    ->assertSession();
  $class = self::CLASS_PREFIX . self::ENTITY_CLASS . self::CLASS_SUFFIX;
  $assert_session
    ->elementExists('css', '.node.' . $class);
}