Files
PhpSpreadsheet/tests/PhpSpreadsheetTests/Calculation/Functions/TextData/UpperTest.php
T
Mark Baker dd74dd7fcf Let's start with some appeasements to phpstan, just to reduce the baseline (#1983)
* Let's start with some appeasements to phpstan, just to reduce the baseline
* Appeasements to phpstan, taking the number of reported errors down to just 61
2021-04-03 17:10:40 +02:00

68 lines
1.7 KiB
PHP

<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
use PhpOffice\PhpSpreadsheet\Settings;
use PHPUnit\Framework\TestCase;
class UpperTest extends TestCase
{
protected function tearDown(): void
{
Settings::setLocale('en_US');
}
/**
* @dataProvider providerUPPER
*
* @param mixed $expectedResult
* @param mixed $value
*/
public function testUPPER($expectedResult, $value): void
{
$result = TextData::UPPERCASE($value);
self::assertEquals($expectedResult, $result);
}
public function providerUPPER()
{
return require 'tests/data/Calculation/TextData/UPPER.php';
}
/**
* @dataProvider providerLocaleLOWER
*
* @param string $expectedResult
* @param mixed $value
* @param mixed $locale
*/
public function testLowerWithLocaleBoolean($expectedResult, $locale, $value): void
{
$newLocale = Settings::setLocale($locale);
if ($newLocale === false) {
Settings::setLocale('en_US');
self::markTestSkipped('Unable to set locale for locale-specific test');
}
$result = TextData::UPPERCASE($value);
self::assertEquals($expectedResult, $result);
Settings::setLocale('en_US');
}
public function providerLocaleLOWER()
{
return [
['VRAI', 'fr_FR', true],
['WAAR', 'nl_NL', true],
['TOSI', 'fi', true],
['ИСТИНА', 'bg', true],
['FAUX', 'fr_FR', false],
['ONWAAR', 'nl_NL', false],
['EPÄTOSI', 'fi', false],
['ЛОЖЬ', 'bg', false],
];
}
}