You are here

public function LinkClassFormatterTest::testClassFormatter in Element Class Formatter 8

File

tests/src/Functional/LinkClassFormatterTest.php, line 19

Class

LinkClassFormatterTest
Functional tests for the link with class formatter.

Namespace

Drupal\Tests\element_class_formatter\Functional

Code

public function testClassFormatter() {
  $field_config = $this
    ->createEntityField('link_class', 'link', [
    'class' => self::TEST_CLASS,
  ]);
  $entity = EntityTest::create([
    $field_config
      ->getName() => [
      [
        'uri' => 'https://drupal.org',
      ],
    ],
  ]);
  $entity
    ->save();
  $this
    ->drupalGet($entity
    ->toUrl());
  $assert_session = $this
    ->assertSession();
  $assert_session
    ->elementExists('css', 'a.' . self::TEST_CLASS);
}