| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <?php
- namespace PhpOffice\PhpSpreadsheetTests\Calculation;
- use PhpOffice\PhpSpreadsheet\Calculation\Calculation;
- use PhpOffice\PhpSpreadsheet\Calculation\Functions;
- use PHPUnit\Framework\TestCase;
- class CalculationSettingsTest extends TestCase
- {
- /**
- * @var string
- */
- private $compatibilityMode;
- /**
- * @var string
- */
- private $locale;
- protected function setUp(): void
- {
- $this->compatibilityMode = Functions::getCompatibilityMode();
- $calculation = Calculation::getInstance();
- $this->locale = $calculation->getLocale();
- Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
- }
- protected function tearDown(): void
- {
- Functions::setCompatibilityMode($this->compatibilityMode);
- $calculation = Calculation::getInstance();
- $calculation->setLocale($this->locale);
- }
- /**
- * @dataProvider providerCanLoadAllSupportedLocales
- *
- * @param string $locale
- */
- public function testCanLoadAllSupportedLocales($locale): void
- {
- $calculation = Calculation::getInstance();
- self::assertTrue($calculation->setLocale($locale));
- }
- public function testInvalidLocaleReturnsFalse(): void
- {
- $calculation = Calculation::getInstance();
- self::assertFalse($calculation->setLocale('xx'));
- }
- public function providerCanLoadAllSupportedLocales(): array
- {
- return [
- ['bg'],
- ['cs'],
- ['da'],
- ['de'],
- ['en_us'],
- ['es'],
- ['fi'],
- ['fr'],
- ['hu'],
- ['it'],
- ['nl'],
- ['nb'],
- ['pl'],
- ['pt'],
- ['pt_br'],
- ['ru'],
- ['sv'],
- ['tr'],
- ];
- }
- }
|