Files
PhpSpreadsheet/tests/PhpSpreadsheetTests/Style/NumberFormat/Wizard/DateTimeTest.php
T
Adrien Crivelli 1b05dfab8b Rector AddParamTypeBasedOnPHPUnitDataProviderRector
And quite a bit more manual changes. The idea is that typing of our
tests can be a bit more loose, so we assume PHPDoc is mostly correct. If
that happens to be wrong, it should be caught by the tests themselves.
2023-09-07 17:00:24 +08:00

32 lines
1.0 KiB
PHP

<?php
namespace PhpOffice\PhpSpreadsheetTests\Style\NumberFormat\Wizard;
use PhpOffice\PhpSpreadsheet\Style\NumberFormat\Wizard\Date;
use PhpOffice\PhpSpreadsheet\Style\NumberFormat\Wizard\DateTime;
use PhpOffice\PhpSpreadsheet\Style\NumberFormat\Wizard\Time;
use PHPUnit\Framework\TestCase;
class DateTimeTest extends TestCase
{
/**
* @dataProvider providerDateTime
*
* @param null|string|string[] $separators
* @param string[] $formatBlocks
*/
public function testDateTime(string $expectedResult, string|null|array $separators, array $formatBlocks): void
{
$wizard = new DateTime($separators, ...$formatBlocks);
self::assertSame($expectedResult, (string) $wizard);
}
public static function providerDateTime(): array
{
return [
['yyyy-mm-dd "at" hh:mm:ss', ' ', [new Date('-', 'yyyy', 'mm', 'dd'), 'at', new Time(':', 'hh', 'mm', 'ss')]],
['dddd \à hh "heures"', ' ', [new Date(null, 'dddd'), 'à', new Time(null, 'hh'), 'heures']],
];
}
}