Restoring State After Static Changes in Tests (#1571)
This request does not change any source code, only tests. For a change on which I was working, a test passed when run on its own, but failed when run as part of the full test suite. It turned out that an existing test had changed a static value, thousands separator in this case, and failed to restore it. The test turned out to be AdvancedBinderTest. The search for the offending test was more difficult than it should have been because 26 test scripts which had nothing to do with thousands separator nevertheless changed that value. They all changed decimal separator, currency code, and compatibility mode as well, again for no reason. I changed all of those to eliminate those operations. I changed the following tests, which actually do change the static properties identified above for a reason, to restore them as part of teardown. - CalculationTest sets compatibilityMode and locale - DayTest sets compatibilityMode, returnDateType, and excelCalendar - CountTest sets compatibilityMode - FunctionsTest sets compatibilityMode and returnDateType - AdvancedValueBinderTest sets currencyCode, decimalSeparator, thousandsSeparator - StringHelperTest sets currencyCode, decimalSeparator, thousandsSeparator - NumberFormatTest sets currencyCode, decimalSeparator, thousandsSeparator - HtmlNumberFormatTest sets currencyCode, decimalSeparator, thousandsSeparator
This commit is contained in:
parent
b89968d206
commit
165034ad70
|
@ -9,15 +9,23 @@ use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class CalculationTest extends TestCase
|
class CalculationTest extends TestCase
|
||||||
{
|
{
|
||||||
|
private $compatibilityMode;
|
||||||
|
|
||||||
|
private $locale;
|
||||||
|
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
|
$this->compatibilityMode = Functions::getCompatibilityMode();
|
||||||
|
$calculation = Calculation::getInstance();
|
||||||
|
$this->locale = $calculation->getLocale();
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function tearDown(): void
|
protected function tearDown(): void
|
||||||
{
|
{
|
||||||
|
Functions::setCompatibilityMode($this->compatibilityMode);
|
||||||
$calculation = Calculation::getInstance();
|
$calculation = Calculation::getInstance();
|
||||||
$calculation->setLocale('en_us');
|
$calculation->setLocale($this->locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -9,13 +9,29 @@ use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class DayTest extends TestCase
|
class DayTest extends TestCase
|
||||||
{
|
{
|
||||||
|
private $compatibilityMode;
|
||||||
|
|
||||||
|
private $returnDateType;
|
||||||
|
|
||||||
|
private $excelCalendar;
|
||||||
|
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
|
$this->compatibilityMode = Functions::getCompatibilityMode();
|
||||||
|
$this->returnDateType = Functions::getReturnDateType();
|
||||||
|
$this->excelCalendar = Date::getExcelCalendar();
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
||||||
Functions::setReturnDateType(Functions::RETURNDATE_EXCEL);
|
Functions::setReturnDateType(Functions::RETURNDATE_EXCEL);
|
||||||
Date::setExcelCalendar(Date::CALENDAR_WINDOWS_1900);
|
Date::setExcelCalendar(Date::CALENDAR_WINDOWS_1900);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function tearDown(): void
|
||||||
|
{
|
||||||
|
Functions::setCompatibilityMode($this->compatibilityMode);
|
||||||
|
Functions::setReturnDateType($this->returnDateType);
|
||||||
|
Date::setExcelCalendar($this->excelCalendar);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider providerDAY
|
* @dataProvider providerDAY
|
||||||
*
|
*
|
||||||
|
|
|
@ -8,11 +8,19 @@ use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class CountTest extends TestCase
|
class CountTest extends TestCase
|
||||||
{
|
{
|
||||||
|
private $compatibilityMode;
|
||||||
|
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
|
$this->compatibilityMode = Functions::getCompatibilityMode();
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function tearDown(): void
|
||||||
|
{
|
||||||
|
Functions::setCompatibilityMode($this->compatibilityMode);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider providerBasicCOUNT
|
* @dataProvider providerBasicCOUNT
|
||||||
*
|
*
|
||||||
|
|
|
@ -2,29 +2,11 @@
|
||||||
|
|
||||||
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
|
||||||
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
|
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
|
||||||
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class CharTest extends TestCase
|
class CharTest extends TestCase
|
||||||
{
|
{
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
||||||
StringHelper::setDecimalSeparator('.');
|
|
||||||
StringHelper::setThousandsSeparator(',');
|
|
||||||
StringHelper::setCurrencyCode('$');
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function tearDown(): void
|
|
||||||
{
|
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
||||||
StringHelper::setDecimalSeparator('.');
|
|
||||||
StringHelper::setThousandsSeparator(',');
|
|
||||||
StringHelper::setCurrencyCode('$');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider providerCHAR
|
* @dataProvider providerCHAR
|
||||||
*
|
*
|
||||||
|
|
|
@ -2,29 +2,11 @@
|
||||||
|
|
||||||
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
|
||||||
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
|
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
|
||||||
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class CleanTest extends TestCase
|
class CleanTest extends TestCase
|
||||||
{
|
{
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
||||||
StringHelper::setDecimalSeparator('.');
|
|
||||||
StringHelper::setThousandsSeparator(',');
|
|
||||||
StringHelper::setCurrencyCode('$');
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function tearDown(): void
|
|
||||||
{
|
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
||||||
StringHelper::setDecimalSeparator('.');
|
|
||||||
StringHelper::setThousandsSeparator(',');
|
|
||||||
StringHelper::setCurrencyCode('$');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider providerCLEAN
|
* @dataProvider providerCLEAN
|
||||||
*
|
*
|
||||||
|
|
|
@ -2,29 +2,11 @@
|
||||||
|
|
||||||
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
|
||||||
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
|
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
|
||||||
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class CodeTest extends TestCase
|
class CodeTest extends TestCase
|
||||||
{
|
{
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
||||||
StringHelper::setDecimalSeparator('.');
|
|
||||||
StringHelper::setThousandsSeparator(',');
|
|
||||||
StringHelper::setCurrencyCode('$');
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function tearDown(): void
|
|
||||||
{
|
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
||||||
StringHelper::setDecimalSeparator('.');
|
|
||||||
StringHelper::setThousandsSeparator(',');
|
|
||||||
StringHelper::setCurrencyCode('$');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider providerCODE
|
* @dataProvider providerCODE
|
||||||
*
|
*
|
||||||
|
|
|
@ -2,29 +2,11 @@
|
||||||
|
|
||||||
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
|
||||||
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
|
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
|
||||||
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class ConcatenateTest extends TestCase
|
class ConcatenateTest extends TestCase
|
||||||
{
|
{
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
||||||
StringHelper::setDecimalSeparator('.');
|
|
||||||
StringHelper::setThousandsSeparator(',');
|
|
||||||
StringHelper::setCurrencyCode('$');
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function tearDown(): void
|
|
||||||
{
|
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
||||||
StringHelper::setDecimalSeparator('.');
|
|
||||||
StringHelper::setThousandsSeparator(',');
|
|
||||||
StringHelper::setCurrencyCode('$');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider providerCONCATENATE
|
* @dataProvider providerCONCATENATE
|
||||||
*
|
*
|
||||||
|
|
|
@ -2,29 +2,11 @@
|
||||||
|
|
||||||
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
|
||||||
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
|
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
|
||||||
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class DollarTest extends TestCase
|
class DollarTest extends TestCase
|
||||||
{
|
{
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
||||||
StringHelper::setDecimalSeparator('.');
|
|
||||||
StringHelper::setThousandsSeparator(',');
|
|
||||||
StringHelper::setCurrencyCode('$');
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function tearDown(): void
|
|
||||||
{
|
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
||||||
StringHelper::setDecimalSeparator('.');
|
|
||||||
StringHelper::setThousandsSeparator(',');
|
|
||||||
StringHelper::setCurrencyCode('$');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider providerDOLLAR
|
* @dataProvider providerDOLLAR
|
||||||
*
|
*
|
||||||
|
|
|
@ -2,29 +2,11 @@
|
||||||
|
|
||||||
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
|
||||||
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
|
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
|
||||||
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class ExactTest extends TestCase
|
class ExactTest extends TestCase
|
||||||
{
|
{
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
||||||
StringHelper::setDecimalSeparator('.');
|
|
||||||
StringHelper::setThousandsSeparator(',');
|
|
||||||
StringHelper::setCurrencyCode('$');
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function tearDown(): void
|
|
||||||
{
|
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
||||||
StringHelper::setDecimalSeparator('.');
|
|
||||||
StringHelper::setThousandsSeparator(',');
|
|
||||||
StringHelper::setCurrencyCode('$');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider providerEXACT
|
* @dataProvider providerEXACT
|
||||||
*
|
*
|
||||||
|
@ -33,10 +15,6 @@ class ExactTest extends TestCase
|
||||||
*/
|
*/
|
||||||
public function testEXACT($expectedResult, ...$args): void
|
public function testEXACT($expectedResult, ...$args): void
|
||||||
{
|
{
|
||||||
StringHelper::setDecimalSeparator('.');
|
|
||||||
StringHelper::setThousandsSeparator(' ');
|
|
||||||
StringHelper::setCurrencyCode('$');
|
|
||||||
|
|
||||||
$result = TextData::EXACT(...$args);
|
$result = TextData::EXACT(...$args);
|
||||||
self::assertSame($expectedResult, $result);
|
self::assertSame($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,29 +2,11 @@
|
||||||
|
|
||||||
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
|
||||||
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
|
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
|
||||||
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class FindTest extends TestCase
|
class FindTest extends TestCase
|
||||||
{
|
{
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
||||||
StringHelper::setDecimalSeparator('.');
|
|
||||||
StringHelper::setThousandsSeparator(',');
|
|
||||||
StringHelper::setCurrencyCode('$');
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function tearDown(): void
|
|
||||||
{
|
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
||||||
StringHelper::setDecimalSeparator('.');
|
|
||||||
StringHelper::setThousandsSeparator(',');
|
|
||||||
StringHelper::setCurrencyCode('$');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider providerFIND
|
* @dataProvider providerFIND
|
||||||
*
|
*
|
||||||
|
|
|
@ -2,29 +2,11 @@
|
||||||
|
|
||||||
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
|
||||||
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
|
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
|
||||||
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class FixedTest extends TestCase
|
class FixedTest extends TestCase
|
||||||
{
|
{
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
||||||
StringHelper::setDecimalSeparator('.');
|
|
||||||
StringHelper::setThousandsSeparator(',');
|
|
||||||
StringHelper::setCurrencyCode('$');
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function tearDown(): void
|
|
||||||
{
|
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
||||||
StringHelper::setDecimalSeparator('.');
|
|
||||||
StringHelper::setThousandsSeparator(',');
|
|
||||||
StringHelper::setCurrencyCode('$');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider providerFIXED
|
* @dataProvider providerFIXED
|
||||||
*
|
*
|
||||||
|
|
|
@ -2,29 +2,11 @@
|
||||||
|
|
||||||
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
|
||||||
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
|
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
|
||||||
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class LeftTest extends TestCase
|
class LeftTest extends TestCase
|
||||||
{
|
{
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
||||||
StringHelper::setDecimalSeparator('.');
|
|
||||||
StringHelper::setThousandsSeparator(',');
|
|
||||||
StringHelper::setCurrencyCode('$');
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function tearDown(): void
|
|
||||||
{
|
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
||||||
StringHelper::setDecimalSeparator('.');
|
|
||||||
StringHelper::setThousandsSeparator(',');
|
|
||||||
StringHelper::setCurrencyCode('$');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider providerLEFT
|
* @dataProvider providerLEFT
|
||||||
*
|
*
|
||||||
|
|
|
@ -2,29 +2,11 @@
|
||||||
|
|
||||||
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
|
||||||
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
|
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
|
||||||
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class LenTest extends TestCase
|
class LenTest extends TestCase
|
||||||
{
|
{
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
||||||
StringHelper::setDecimalSeparator('.');
|
|
||||||
StringHelper::setThousandsSeparator(',');
|
|
||||||
StringHelper::setCurrencyCode('$');
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function tearDown(): void
|
|
||||||
{
|
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
||||||
StringHelper::setDecimalSeparator('.');
|
|
||||||
StringHelper::setThousandsSeparator(',');
|
|
||||||
StringHelper::setCurrencyCode('$');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider providerLEN
|
* @dataProvider providerLEN
|
||||||
*
|
*
|
||||||
|
|
|
@ -2,29 +2,11 @@
|
||||||
|
|
||||||
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
|
||||||
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
|
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
|
||||||
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class LowerTest extends TestCase
|
class LowerTest extends TestCase
|
||||||
{
|
{
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
||||||
StringHelper::setDecimalSeparator('.');
|
|
||||||
StringHelper::setThousandsSeparator(',');
|
|
||||||
StringHelper::setCurrencyCode('$');
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function tearDown(): void
|
|
||||||
{
|
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
||||||
StringHelper::setDecimalSeparator('.');
|
|
||||||
StringHelper::setThousandsSeparator(',');
|
|
||||||
StringHelper::setCurrencyCode('$');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider providerLOWER
|
* @dataProvider providerLOWER
|
||||||
*
|
*
|
||||||
|
|
|
@ -2,29 +2,11 @@
|
||||||
|
|
||||||
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
|
||||||
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
|
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
|
||||||
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class MidTest extends TestCase
|
class MidTest extends TestCase
|
||||||
{
|
{
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
||||||
StringHelper::setDecimalSeparator('.');
|
|
||||||
StringHelper::setThousandsSeparator(',');
|
|
||||||
StringHelper::setCurrencyCode('$');
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function tearDown(): void
|
|
||||||
{
|
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
||||||
StringHelper::setDecimalSeparator('.');
|
|
||||||
StringHelper::setThousandsSeparator(',');
|
|
||||||
StringHelper::setCurrencyCode('$');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider providerMID
|
* @dataProvider providerMID
|
||||||
*
|
*
|
||||||
|
|
|
@ -2,29 +2,11 @@
|
||||||
|
|
||||||
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
|
||||||
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
|
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
|
||||||
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class NumberValueTest extends TestCase
|
class NumberValueTest extends TestCase
|
||||||
{
|
{
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
||||||
StringHelper::setDecimalSeparator('.');
|
|
||||||
StringHelper::setThousandsSeparator(',');
|
|
||||||
StringHelper::setCurrencyCode('$');
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function tearDown(): void
|
|
||||||
{
|
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
||||||
StringHelper::setDecimalSeparator('.');
|
|
||||||
StringHelper::setThousandsSeparator(',');
|
|
||||||
StringHelper::setCurrencyCode('$');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider providerNUMBERVALUE
|
* @dataProvider providerNUMBERVALUE
|
||||||
*
|
*
|
||||||
|
|
|
@ -2,29 +2,11 @@
|
||||||
|
|
||||||
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
|
||||||
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
|
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
|
||||||
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class ProperTest extends TestCase
|
class ProperTest extends TestCase
|
||||||
{
|
{
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
||||||
StringHelper::setDecimalSeparator('.');
|
|
||||||
StringHelper::setThousandsSeparator(',');
|
|
||||||
StringHelper::setCurrencyCode('$');
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function tearDown(): void
|
|
||||||
{
|
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
||||||
StringHelper::setDecimalSeparator('.');
|
|
||||||
StringHelper::setThousandsSeparator(',');
|
|
||||||
StringHelper::setCurrencyCode('$');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider providerPROPER
|
* @dataProvider providerPROPER
|
||||||
*
|
*
|
||||||
|
|
|
@ -2,29 +2,11 @@
|
||||||
|
|
||||||
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
|
||||||
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
|
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
|
||||||
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class ReplaceTest extends TestCase
|
class ReplaceTest extends TestCase
|
||||||
{
|
{
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
||||||
StringHelper::setDecimalSeparator('.');
|
|
||||||
StringHelper::setThousandsSeparator(',');
|
|
||||||
StringHelper::setCurrencyCode('$');
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function tearDown(): void
|
|
||||||
{
|
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
||||||
StringHelper::setDecimalSeparator('.');
|
|
||||||
StringHelper::setThousandsSeparator(',');
|
|
||||||
StringHelper::setCurrencyCode('$');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider providerREPLACE
|
* @dataProvider providerREPLACE
|
||||||
*
|
*
|
||||||
|
|
|
@ -2,29 +2,11 @@
|
||||||
|
|
||||||
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
|
||||||
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
|
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
|
||||||
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class RightTest extends TestCase
|
class RightTest extends TestCase
|
||||||
{
|
{
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
||||||
StringHelper::setDecimalSeparator('.');
|
|
||||||
StringHelper::setThousandsSeparator(',');
|
|
||||||
StringHelper::setCurrencyCode('$');
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function tearDown(): void
|
|
||||||
{
|
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
||||||
StringHelper::setDecimalSeparator('.');
|
|
||||||
StringHelper::setThousandsSeparator(',');
|
|
||||||
StringHelper::setCurrencyCode('$');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider providerRIGHT
|
* @dataProvider providerRIGHT
|
||||||
*
|
*
|
||||||
|
|
|
@ -2,29 +2,11 @@
|
||||||
|
|
||||||
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
|
||||||
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
|
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
|
||||||
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class SearchTest extends TestCase
|
class SearchTest extends TestCase
|
||||||
{
|
{
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
||||||
StringHelper::setDecimalSeparator('.');
|
|
||||||
StringHelper::setThousandsSeparator(',');
|
|
||||||
StringHelper::setCurrencyCode('$');
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function tearDown(): void
|
|
||||||
{
|
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
||||||
StringHelper::setDecimalSeparator('.');
|
|
||||||
StringHelper::setThousandsSeparator(',');
|
|
||||||
StringHelper::setCurrencyCode('$');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider providerSEARCH
|
* @dataProvider providerSEARCH
|
||||||
*
|
*
|
||||||
|
|
|
@ -2,29 +2,11 @@
|
||||||
|
|
||||||
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
|
||||||
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
|
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
|
||||||
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class SubstituteTest extends TestCase
|
class SubstituteTest extends TestCase
|
||||||
{
|
{
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
||||||
StringHelper::setDecimalSeparator('.');
|
|
||||||
StringHelper::setThousandsSeparator(',');
|
|
||||||
StringHelper::setCurrencyCode('$');
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function tearDown(): void
|
|
||||||
{
|
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
||||||
StringHelper::setDecimalSeparator('.');
|
|
||||||
StringHelper::setThousandsSeparator(',');
|
|
||||||
StringHelper::setCurrencyCode('$');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider providerSUBSTITUTE
|
* @dataProvider providerSUBSTITUTE
|
||||||
*
|
*
|
||||||
|
|
|
@ -2,29 +2,11 @@
|
||||||
|
|
||||||
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
|
||||||
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
|
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
|
||||||
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class TTest extends TestCase
|
class TTest extends TestCase
|
||||||
{
|
{
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
||||||
StringHelper::setDecimalSeparator('.');
|
|
||||||
StringHelper::setThousandsSeparator(',');
|
|
||||||
StringHelper::setCurrencyCode('$');
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function tearDown(): void
|
|
||||||
{
|
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
||||||
StringHelper::setDecimalSeparator('.');
|
|
||||||
StringHelper::setThousandsSeparator(',');
|
|
||||||
StringHelper::setCurrencyCode('$');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider providerT
|
* @dataProvider providerT
|
||||||
*
|
*
|
||||||
|
|
|
@ -2,29 +2,11 @@
|
||||||
|
|
||||||
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
|
||||||
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
|
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
|
||||||
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class TextJoinTest extends TestCase
|
class TextJoinTest extends TestCase
|
||||||
{
|
{
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
||||||
StringHelper::setDecimalSeparator('.');
|
|
||||||
StringHelper::setThousandsSeparator(',');
|
|
||||||
StringHelper::setCurrencyCode('$');
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function tearDown(): void
|
|
||||||
{
|
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
||||||
StringHelper::setDecimalSeparator('.');
|
|
||||||
StringHelper::setThousandsSeparator(',');
|
|
||||||
StringHelper::setCurrencyCode('$');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider providerTEXTJOIN
|
* @dataProvider providerTEXTJOIN
|
||||||
*
|
*
|
||||||
|
|
|
@ -2,29 +2,11 @@
|
||||||
|
|
||||||
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
|
||||||
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
|
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
|
||||||
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class TextTest extends TestCase
|
class TextTest extends TestCase
|
||||||
{
|
{
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
||||||
StringHelper::setDecimalSeparator('.');
|
|
||||||
StringHelper::setThousandsSeparator(',');
|
|
||||||
StringHelper::setCurrencyCode('$');
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function tearDown(): void
|
|
||||||
{
|
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
||||||
StringHelper::setDecimalSeparator('.');
|
|
||||||
StringHelper::setThousandsSeparator(',');
|
|
||||||
StringHelper::setCurrencyCode('$');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider providerTEXT
|
* @dataProvider providerTEXT
|
||||||
*
|
*
|
||||||
|
@ -32,11 +14,6 @@ class TextTest extends TestCase
|
||||||
*/
|
*/
|
||||||
public function testTEXT($expectedResult, ...$args): void
|
public function testTEXT($expectedResult, ...$args): void
|
||||||
{
|
{
|
||||||
// Enforce decimal and thousands separator values to UK/US, and currency code to USD
|
|
||||||
StringHelper::setDecimalSeparator('.');
|
|
||||||
StringHelper::setThousandsSeparator(',');
|
|
||||||
StringHelper::setCurrencyCode('$');
|
|
||||||
|
|
||||||
$result = TextData::TEXTFORMAT(...$args);
|
$result = TextData::TEXTFORMAT(...$args);
|
||||||
self::assertEquals($expectedResult, $result);
|
self::assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,29 +2,11 @@
|
||||||
|
|
||||||
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
|
||||||
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
|
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
|
||||||
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class TrimTest extends TestCase
|
class TrimTest extends TestCase
|
||||||
{
|
{
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
||||||
StringHelper::setDecimalSeparator('.');
|
|
||||||
StringHelper::setThousandsSeparator(',');
|
|
||||||
StringHelper::setCurrencyCode('$');
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function tearDown(): void
|
|
||||||
{
|
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
||||||
StringHelper::setDecimalSeparator('.');
|
|
||||||
StringHelper::setThousandsSeparator(',');
|
|
||||||
StringHelper::setCurrencyCode('$');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider providerTRIM
|
* @dataProvider providerTRIM
|
||||||
*
|
*
|
||||||
|
|
|
@ -2,29 +2,11 @@
|
||||||
|
|
||||||
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
|
||||||
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
|
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
|
||||||
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class UpperTest extends TestCase
|
class UpperTest extends TestCase
|
||||||
{
|
{
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
||||||
StringHelper::setDecimalSeparator('.');
|
|
||||||
StringHelper::setThousandsSeparator(',');
|
|
||||||
StringHelper::setCurrencyCode('$');
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function tearDown(): void
|
|
||||||
{
|
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
||||||
StringHelper::setDecimalSeparator('.');
|
|
||||||
StringHelper::setThousandsSeparator(',');
|
|
||||||
StringHelper::setCurrencyCode('$');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider providerUPPER
|
* @dataProvider providerUPPER
|
||||||
*
|
*
|
||||||
|
|
|
@ -2,27 +2,30 @@
|
||||||
|
|
||||||
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
|
||||||
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
|
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
|
||||||
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
|
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class ValueTest extends TestCase
|
class ValueTest extends TestCase
|
||||||
{
|
{
|
||||||
|
private $currencyCode;
|
||||||
|
|
||||||
|
private $decimalSeparator;
|
||||||
|
|
||||||
|
private $thousandsSeparator;
|
||||||
|
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
$this->currencyCode = StringHelper::getCurrencyCode();
|
||||||
StringHelper::setDecimalSeparator('.');
|
$this->decimalSeparator = StringHelper::getDecimalSeparator();
|
||||||
StringHelper::setThousandsSeparator(',');
|
$this->thousandsSeparator = StringHelper::getThousandsSeparator();
|
||||||
StringHelper::setCurrencyCode('$');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function tearDown(): void
|
protected function tearDown(): void
|
||||||
{
|
{
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
StringHelper::setCurrencyCode($this->currencyCode);
|
||||||
StringHelper::setDecimalSeparator('.');
|
StringHelper::setDecimalSeparator($this->decimalSeparator);
|
||||||
StringHelper::setThousandsSeparator(',');
|
StringHelper::setThousandsSeparator($this->thousandsSeparator);
|
||||||
StringHelper::setCurrencyCode('$');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -10,16 +10,22 @@ use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class FunctionsTest extends TestCase
|
class FunctionsTest extends TestCase
|
||||||
{
|
{
|
||||||
|
private $compatibilityMode;
|
||||||
|
|
||||||
|
private $returnDate;
|
||||||
|
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
|
$this->compatibilityMode = Functions::getCompatibilityMode();
|
||||||
|
$this->returnDate = Functions::getReturnDateType();
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
||||||
Functions::setReturnDateType(Functions::RETURNDATE_EXCEL);
|
Functions::setReturnDateType(Functions::RETURNDATE_EXCEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function tearDown(): void
|
protected function tearDown(): void
|
||||||
{
|
{
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
Functions::setCompatibilityMode($this->compatibilityMode);
|
||||||
Functions::setReturnDateType(Functions::RETURNDATE_EXCEL);
|
Functions::setReturnDateType($this->returnDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCompatibilityMode(): void
|
public function testCompatibilityMode(): void
|
||||||
|
|
|
@ -13,6 +13,26 @@ use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class AdvancedValueBinderTest extends TestCase
|
class AdvancedValueBinderTest extends TestCase
|
||||||
{
|
{
|
||||||
|
private $currencyCode;
|
||||||
|
|
||||||
|
private $decimalSeparator;
|
||||||
|
|
||||||
|
private $thousandsSeparator;
|
||||||
|
|
||||||
|
protected function setUp(): void
|
||||||
|
{
|
||||||
|
$this->currencyCode = StringHelper::getCurrencyCode();
|
||||||
|
$this->decimalSeparator = StringHelper::getDecimalSeparator();
|
||||||
|
$this->thousandsSeparator = StringHelper::getThousandsSeparator();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function tearDown(): void
|
||||||
|
{
|
||||||
|
StringHelper::setCurrencyCode($this->currencyCode);
|
||||||
|
StringHelper::setDecimalSeparator($this->decimalSeparator);
|
||||||
|
StringHelper::setThousandsSeparator($this->thousandsSeparator);
|
||||||
|
}
|
||||||
|
|
||||||
public function provider()
|
public function provider()
|
||||||
{
|
{
|
||||||
$currencyUSD = NumberFormat::FORMAT_CURRENCY_USD_SIMPLE;
|
$currencyUSD = NumberFormat::FORMAT_CURRENCY_USD_SIMPLE;
|
||||||
|
|
|
@ -7,14 +7,30 @@ use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class StringHelperTest extends TestCase
|
class StringHelperTest extends TestCase
|
||||||
{
|
{
|
||||||
|
private $currencyCode;
|
||||||
|
|
||||||
|
private $decimalSeparator;
|
||||||
|
|
||||||
|
private $thousandsSeparator;
|
||||||
|
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
$this->currencyCode = StringHelper::getCurrencyCode();
|
||||||
|
$this->decimalSeparator = StringHelper::getDecimalSeparator();
|
||||||
|
$this->thousandsSeparator = StringHelper::getThousandsSeparator();
|
||||||
|
|
||||||
// Reset Currency Code
|
// Reset Currency Code
|
||||||
StringHelper::setCurrencyCode(null);
|
StringHelper::setCurrencyCode(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function tearDown(): void
|
||||||
|
{
|
||||||
|
StringHelper::setCurrencyCode($this->currencyCode);
|
||||||
|
StringHelper::setDecimalSeparator($this->decimalSeparator);
|
||||||
|
StringHelper::setThousandsSeparator($this->thousandsSeparator);
|
||||||
|
}
|
||||||
|
|
||||||
public function testGetIsIconvEnabled(): void
|
public function testGetIsIconvEnabled(): void
|
||||||
{
|
{
|
||||||
$result = StringHelper::getIsIconvEnabled();
|
$result = StringHelper::getIsIconvEnabled();
|
||||||
|
|
|
@ -8,12 +8,28 @@ use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class NumberFormatTest extends TestCase
|
class NumberFormatTest extends TestCase
|
||||||
{
|
{
|
||||||
|
private $currencyCode;
|
||||||
|
|
||||||
|
private $decimalSeparator;
|
||||||
|
|
||||||
|
private $thousandsSeparator;
|
||||||
|
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
|
$this->currencyCode = StringHelper::getCurrencyCode();
|
||||||
|
$this->decimalSeparator = StringHelper::getDecimalSeparator();
|
||||||
|
$this->thousandsSeparator = StringHelper::getThousandsSeparator();
|
||||||
StringHelper::setDecimalSeparator('.');
|
StringHelper::setDecimalSeparator('.');
|
||||||
StringHelper::setThousandsSeparator(',');
|
StringHelper::setThousandsSeparator(',');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function tearDown(): void
|
||||||
|
{
|
||||||
|
StringHelper::setCurrencyCode($this->currencyCode);
|
||||||
|
StringHelper::setDecimalSeparator($this->decimalSeparator);
|
||||||
|
StringHelper::setThousandsSeparator($this->thousandsSeparator);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider providerNumberFormat
|
* @dataProvider providerNumberFormat
|
||||||
*
|
*
|
||||||
|
|
|
@ -10,12 +10,16 @@ use PhpOffice\PhpSpreadsheetTests\Functional;
|
||||||
|
|
||||||
class HtmlNumberFormatTest extends Functional\AbstractFunctional
|
class HtmlNumberFormatTest extends Functional\AbstractFunctional
|
||||||
{
|
{
|
||||||
|
private $currency;
|
||||||
|
|
||||||
private $decsep;
|
private $decsep;
|
||||||
|
|
||||||
private $thosep;
|
private $thosep;
|
||||||
|
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
|
$this->currency = StringHelper::getCurrencyCode();
|
||||||
|
StringHelper::setCurrencyCode('$');
|
||||||
$this->decsep = StringHelper::getDecimalSeparator();
|
$this->decsep = StringHelper::getDecimalSeparator();
|
||||||
StringHelper::setDecimalSeparator('.');
|
StringHelper::setDecimalSeparator('.');
|
||||||
$this->thosep = StringHelper::getThousandsSeparator();
|
$this->thosep = StringHelper::getThousandsSeparator();
|
||||||
|
@ -24,6 +28,7 @@ class HtmlNumberFormatTest extends Functional\AbstractFunctional
|
||||||
|
|
||||||
protected function tearDown(): void
|
protected function tearDown(): void
|
||||||
{
|
{
|
||||||
|
StringHelper::setCurrencyCode($this->currency);
|
||||||
StringHelper::setDecimalSeparator($this->decsep);
|
StringHelper::setDecimalSeparator($this->decsep);
|
||||||
StringHelper::setThousandsSeparator($this->thosep);
|
StringHelper::setThousandsSeparator($this->thosep);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue