aed27a0bed
Use the `PHPUnit\Framework\TestCase` notation instead of `PHPUnit_Framework_TestCase` while extending our TestCases. This will help us migrate to PHPUnit 6, that [no longer support snake case class names](https://github.com/sebastianbergmann/phpunit/blob/master/ChangeLog-6.0.md#changed-1).
49 lines
1.2 KiB
PHP
49 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace PhpOffice\PhpSpreadsheetTests\Style;
|
|
|
|
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
|
|
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class NumberFormatTest extends TestCase
|
|
{
|
|
public function setUp()
|
|
{
|
|
StringHelper::setDecimalSeparator('.');
|
|
StringHelper::setThousandsSeparator(',');
|
|
}
|
|
|
|
/**
|
|
* @dataProvider providerNumberFormat
|
|
*
|
|
* @param mixed $expectedResult
|
|
*/
|
|
public function testFormatValueWithMask($expectedResult, ...$args)
|
|
{
|
|
$result = NumberFormat::toFormattedString(...$args);
|
|
self::assertEquals($expectedResult, $result);
|
|
}
|
|
|
|
public function providerNumberFormat()
|
|
{
|
|
return require 'data/Style/NumberFormat.php';
|
|
}
|
|
|
|
/**
|
|
* @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';
|
|
}
|
|
}
|