mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-09-17 13:36:49 +00:00
1b05dfab8b
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.
32 lines
1.0 KiB
PHP
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']],
|
|
];
|
|
}
|
|
}
|