You are here

public function SVGTest::testSVG in Forena Reports 8

Table function

File

tests/src/Unit/Document/SVGTest.php, line 35

Class

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

Namespace

Drupal\Tests\forena\Unit\Document

Code

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

  // Check the headers
  $this
    ->assertContains('<circle cx="50" cy="50" r="40"', $report, 'Data Present');
  $this
    ->assertContains('<a xlink:href', $report, 'xlink namespace present');

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