You are here

public function FieldFormatterTest::testISODateFormatter in Forena Reports 8

Test the ISO Date formatter.

File

tests/src/Unit/FieldFormatterTest.php, line 44

Class

FieldFormatterTest
Test CSV @group Forena @require module forena @coversDefaultClass \Drupal\forena\FrxPlugin\FieldFormatter\Formatter

Namespace

Drupal\Tests\forena\Unit

Code

public function testISODateFormatter() {
  $vars = [
    'date' => '2016-01-13',
    'time' => '2016-01-13 15:30',
  ];
  $this
    ->pushData($vars, 'vars');
  $r = new ReportReplacer();
  $field = [
    'format' => 'iso_date',
    'format-string' => 'm-d-Y',
  ];
  $r
    ->defineField('date', $field);
  $text = $r
    ->replace('{date}');
  $this
    ->popData();
  $this
    ->assertEquals('01-13-2016', $text);
}