49 lines
1.4 KiB
PHP
49 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
|
|
|
|
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
|
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
|
|
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class TextTest extends TestCase
|
|
{
|
|
public function setUp()
|
|
{
|
|
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
StringHelper::setDecimalSeparator('.');
|
|
StringHelper::setThousandsSeparator(',');
|
|
StringHelper::setCurrencyCode('$');
|
|
}
|
|
|
|
public function tearDown()
|
|
{
|
|
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
StringHelper::setDecimalSeparator('.');
|
|
StringHelper::setThousandsSeparator(',');
|
|
StringHelper::setCurrencyCode('$');
|
|
}
|
|
|
|
/**
|
|
* @dataProvider providerTEXT
|
|
*
|
|
* @param mixed $expectedResult
|
|
*/
|
|
public function testTEXT($expectedResult, ...$args)
|
|
{
|
|
// Enforce decimal and thousands separator values to UK/US, and currency code to USD
|
|
StringHelper::setDecimalSeparator('.');
|
|
StringHelper::setThousandsSeparator(',');
|
|
StringHelper::setCurrencyCode('$');
|
|
|
|
$result = TextData::TEXTFORMAT(...$args);
|
|
$this->assertEquals($expectedResult, $result);
|
|
}
|
|
|
|
public function providerTEXT()
|
|
{
|
|
return require 'data/Calculation/TextData/TEXT.php';
|
|
}
|
|
}
|