PhpSpreadsheet/tests/PhpSpreadsheetTests/Style/NumberFormatTest.php

49 lines
1.2 KiB
PHP
Raw Normal View History

<?php
namespace PhpOffice\PhpSpreadsheetTests\Style;
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
use PHPUnit\Framework\TestCase;
2016-08-14 04:55:34 +00:00
class NumberFormatTest extends TestCase
{
public function setUp()
{
StringHelper::setDecimalSeparator('.');
StringHelper::setThousandsSeparator(',');
2015-05-17 13:00:02 +00:00
}
/**
* @dataProvider providerNumberFormat
*
* @param mixed $expectedResult
*/
public function testFormatValueWithMask($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = NumberFormat::toFormattedString(...$args);
self::assertEquals($expectedResult, $result);
2015-05-17 13:00:02 +00:00
}
public function providerNumberFormat()
{
return require 'data/Style/NumberFormat.php';
2015-05-17 13:00:02 +00:00
}
/**
* @dataProvider providerNumberFormatDates
*
* @param mixed $expectedResult
*/
public function testFormatValueWithMaskDate($expectedResult, ...$args)
{
$result = NumberFormat::toFormattedString(...$args);
self::assertEquals($expectedResult, $result);
}
public function providerNumberFormatDates()
{
return require 'data/Style/NumberFormatDates.php';
}
}