You are here

public function GlossifyBaseTest::parseTooltipMatchData in Glossify 8

File

tests/src/Unit/GlossifyBaseTest.php, line 36

Class

GlossifyBaseTest
@coversDefaultClass \Drupal\glossify\GlossifyBase

Namespace

Drupal\Tests\glossify\Unit

Code

public function parseTooltipMatchData() {
  $term = new \stdClass();
  $term->id = '1';
  $term->name = 'RT';
  $term->name_norm = 'RT';
  $term->tip = 'means replacement term';
  $data = [
    'set1' => [
      'text' => 'Simple plain text with RT as replacement term',
      'terms' => [
        $term->name_norm => $term,
      ],
      'case_sensitivity' => TRUE,
      'first_only' => FALSE,
      'displaytype' => 'tooltips',
      'urlpattern' => '',
      'output' => 'Simple plain text with <span title="' . $term->tip . '">RT</span> as replacement term',
    ],
    'set2' => [
      'text' => '<p>Simple HTML with <b>RT</b> and rt as replacement term</p>',
      'terms' => [
        $term->name_norm => $term,
      ],
      'case_sensitivity' => TRUE,
      'first_only' => FALSE,
      'displaytype' => 'tooltips_links',
      'urlpattern' => '/random/testpattern',
      'output' => '<p>Simple HTML with <b><a href="/random/testpattern" title="' . $term->tip . '">RT</a></b> and rt as replacement term</p>',
    ],
  ];
  return $data;
}