You are here

public function ReportTest::testSimpleRender in Forena Reports 8

Simple Render Test

File

tests/src/Unit/ReportTest.php, line 73
Implements ReportTest

Class

ReportTest
@group Forena @require module forena @coversDefaultClass \Drupal\forena\Report

Namespace

Drupal\Tests\forena\Unit

Code

public function testSimpleRender() {
  $this
    ->documentManager()
    ->setDocument('drupal');
  $this
    ->documentManager()
    ->getDocument()
    ->clear();
  $r = new Report($this->doc);
  $r
    ->render('drupal', FALSE);
  $content = $this
    ->getDocument()
    ->flush();

  // Make sure we have a report.
  $this
    ->assertArrayHasKey('report', $content);
  $this
    ->assertContains('Report Body', $content['report']['#template']);

  // Make sure we don't have a parameters form.
  $this
    ->assertArrayNotHasKey('parameters', $content);

  // Make sure that we don't have the the ajax command
  $this
    ->assertNotContains('ajax', $content['report']['#template']);

  //echo  $content['report']['#template'];
  $this
    ->assertContains('This & That', $content['report']['#template']);
}