You are here

public function ReportTest::testReportParse in Forena Reports 8

Ensure that report object can be created.

File

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

Class

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

Namespace

Drupal\Tests\forena\Unit

Code

public function testReportParse() {

  // Sample Report To parse.
  $r = new Report($this->doc);

  // Title Check
  $this
    ->assertObjectHasAttribute('title', $r);
  $this
    ->assertEquals("Report Title", $r->title, "Correct Title");

  // Category Check.
  $this
    ->assertObjectHasAttribute('category', $r);
  $this
    ->assertEquals("Category", $r->category);

  // Check to make sure fields are parsed.
  $this
    ->assertArrayHasKey('test_field', $r->replacer->fields);
  $this
    ->assertEquals(1, count($r->commands), 'Commands parsed');
}