You are here

public function AReportTokenTest::testReplacement in Forena Reports 8

File

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

Class

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

Namespace

Drupal\Tests\forena\Unit

Code

public function testReplacement() {
  $data = [
    'name' => 'Bob',
  ];
  $this
    ->pushData($data, 'p');
  $rep = new ReportReplacer($this
    ->dataService());
  $this
    ->assertNotNull($rep);

  // Replace the data
  $text = $rep
    ->replace('Hello {name}');
  $this
    ->assertEquals('Hello Bob', $text);
  $this
    ->popData();
}