You are here

function XLSExporterTest::testColumnNumberFormat in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/aklump/loft_data_grids/tests/phpunit/XLSXExporterTest.php \AKlump\LoftDataGrids\XLSExporterTest::testColumnNumberFormat()

File

vendor/aklump/loft_data_grids/tests/XLSExporterTest.php, line 15
Tests for the XLSExporter class

Class

XLSExporterTest

Namespace

AKlump\LoftDataGrids

Code

function testColumnNumberFormat() {
  $obj = clone $this->exporter;
  $currency = 'USD';
  $obj
    ->formatColumn('California Taxed Purchase Amount', $currency);
  $obj
    ->formatColumn('Domestic Purchase Amount', $currency);
  $record = $obj
    ->getData()
    ->setPointer(0);
  $data = $record
    ->getCurrent();
  $this
    ->assertSame('$0.00', $data['California Taxed Purchase Amount']);
  $this
    ->assertSame('$20.00', $data['Domestic Purchase Amount']);
  $obj = clone $this->exporter;
  $currency = '"$"#,##0.00_-';
  $obj
    ->formatColumn('California Taxed Purchase Amount', $currency);
  $obj
    ->formatColumn('Domestic Purchase Amount', $currency);
  $record = $obj
    ->getData()
    ->setPointer(0);
  $data = $record
    ->getCurrent();
  $this
    ->assertSame('$0.00', $data['California Taxed Purchase Amount']);
  $this
    ->assertSame('$20.00', $data['Domestic Purchase Amount']);
}