You are here

public function AReportTokenTest::testLinkGeneration in Forena Reports 8

basic test for field generation.

File

tests/src/Unit/AReportTokenTest.php, line 70

Class

AReportTokenTest
Class AReportTokenTest @group Forena @require module forena @coversDefaultClass \Drupal\forena\Token\ReportReplacer

Namespace

Drupal\Tests\forena\Unit

Code

public function testLinkGeneration() {
  $data = [
    'title' => 'Title',
  ];
  $data['link'] = 'some/page';
  $data['data-test'] = 'foo';
  $this
    ->pushData($data);
  $text = "See {title}";
  $this->replacer
    ->defineField('title', $data);
  $text = $this->replacer
    ->replace($text);
  $this
    ->assertContains("<a title='Title' data-test='foo' href='some/page'>Title</a>", $text);
  $this
    ->popData();
}