You are here

public function LinkHtmlTest::doCreateHtmlFlag in Flag 8.4

Create a node type and a flag.

1 call to LinkHtmlTest::doCreateHtmlFlag()
LinkHtmlTest::testHtmlLink in tests/src/Functional/LinkHtmlTest.php
Tests use of HTML in the flag and unflag links.

File

tests/src/Functional/LinkHtmlTest.php, line 40

Class

LinkHtmlTest
Tests use of HTML in the flag and unflag links.

Namespace

Drupal\Tests\flag\Functional

Code

public function doCreateHtmlFlag() {
  $this->flag = $this
    ->createFlag('node', [
    $this->nodeType,
  ], 'reload');

  // Generate new flag short text with 'odd' characters included, then wrap
  // the flag and unflag short text in italics to test using HTML in the text.
  // We use a long random string to increase the probability of randomly
  // generating something that looks like an HTML tag.
  $this->flag
    ->setFlagShortText('<i>' . $this
    ->randomString(32) . '</i>');
  $this->flag
    ->setUnflagShortText('<i>' . $this
    ->randomString(32) . '</i>');
  $this->flag
    ->save();
}