You are here

public function ReportManagerTest::testReportName in Forena Reports 8

Test extraction from url.

File

tests/src/Unit/ReportManagerTest.php, line 25

Class

ReportManagerTest
Test Report Manager @group Forena @require module forena @coversDefaultClass \Drupal\forena\ReportManager

Namespace

Drupal\Tests\forena\Unit

Code

public function testReportName() {
  $r = ReportManager::instance();

  // Normal reprot name
  $report_name = 'test';
  $ext = $r
    ->formatFromPath($report_name);
  $this
    ->assertEquals('test', $report_name);
  $this
    ->assertEquals('drupal', $ext);

  // CSV supported format
  $report_name = 'test.csv';
  $ext = $r
    ->formatFromPath($report_name);
  $this
    ->assertEquals('test', $report_name);
  $this
    ->assertEquals('csv', $ext);

  // Direcotry name as a period
  $report_name = 'test.unsupported';
  $ext = $r
    ->formatFromPath($report_name);
  $this
    ->assertEquals('test.unsupported', $report_name);
  $this
    ->assertEquals('drupal', $ext);
}