You are here

public function XMLTest::testCSV in Forena Reports 8

Table function

File

tests/src/Unit/Document/XMLTest.php, line 30

Class

XMLTest
Test XML @group Forena @require module forena @coversDefaultClass \Drupal\forena\FrxPlugin\Document\XML

Namespace

Drupal\Tests\forena\Unit\Document

Code

public function testCSV() {
  $doc = DocManager::instance()
    ->setDocument('xml');
  $doc
    ->header();
  $doc
    ->write($this->html);
  $doc
    ->footer();
  $report = $doc
    ->flush();

  // Check the headers
  $this
    ->assertContains("<p>Run boy Run!</p>", $report, 'Data Present');
  $this
    ->assertContains("<div>", $report, "Open Tag Present");
  $this
    ->assertContains('</div>', $report, "Close Tag Present");

  // Check headers
  $headers = $doc->headers;
  $this
    ->assertArrayHasKey('Content-Type', $headers);
  $this
    ->assertContains('application/xml', $headers['Content-Type']);
}