Text function array value tests, plus some cleanup

This commit is contained in:
MarkBaker
2022-02-11 12:34:29 +01:00
parent 5ab3cbc8db
commit df12b06c59
20 changed files with 281 additions and 50 deletions
@@ -2,6 +2,7 @@
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
use PhpOffice\PhpSpreadsheet\Calculation\Calculation;
use PhpOffice\PhpSpreadsheet\Settings;
class ProperTest extends AllSetupTeardown
@@ -64,4 +65,25 @@ class ProperTest extends AllSetupTeardown
['Ложь', 'bg', false],
];
}
/**
* @dataProvider providerProperArray
*/
public function testProperArray(array $expectedResult, string $array): void
{
$calculation = Calculation::getInstance();
$formula = "=PROPER({$array})";
$result = $calculation->_calculateFormulaValue($formula);
self::assertEqualsWithDelta($expectedResult, $result, 1.0e-14);
}
public function providerProperArray(): array
{
return [
'row vector' => [[["Let's", 'All Change', 'Case']], '{"lEt\'S", "aLl chAngE", "cAsE"}'],
'column vector' => [[["Let's"], ['All Change'], ['Case']], '{"lEt\'S"; "aLl chAngE"; "cAsE"}'],
'matrix' => [[['Build All', 'Your Workbooks'], ['With', 'Phpspreadsheet']], '{"bUIld aLL", "yOUr WOrkBOOks"; "wiTH", "PhpSpreadsheet"}'],
];
}
}