mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-09-25 01:31:26 +00:00
1e8ff9f852
* DateTimeExcel - Change Names of funcWhatever to evaluate Per discussions while MathTrig was being broken up, this would help standardize the code. This PR applies that standardization to the DateTimeExcel family of functions. The deprecation messages in DateTime.php are changed to match the style used in PR #2005. All Phpstan grandfathered errors (about 25) in DateTimeExcel are fixed and removed from baseline. A small number (about 5) of phpstan annotations in the source members in that directory are also fixed and eliminated.
36 lines
1.0 KiB
PHP
36 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\DateTime;
|
|
|
|
use PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel\WeekDay;
|
|
|
|
class WeekDayTest extends AllSetupTeardown
|
|
{
|
|
/**
|
|
* @dataProvider providerWEEKDAY
|
|
*
|
|
* @param mixed $expectedResult
|
|
*/
|
|
public function testWEEKDAY($expectedResult, string $formula): void
|
|
{
|
|
$this->mightHaveException($expectedResult);
|
|
$sheet = $this->sheet;
|
|
$sheet->getCell('B1')->setValue('1954-11-23');
|
|
$sheet->getCell('A1')->setValue("=WEEKDAY($formula)");
|
|
self::assertSame($expectedResult, $sheet->getCell('A1')->getCalculatedValue());
|
|
}
|
|
|
|
public function providerWEEKDAY(): array
|
|
{
|
|
return require 'tests/data/Calculation/DateTime/WEEKDAY.php';
|
|
}
|
|
|
|
public function testWEEKDAYwith1904Calendar(): void
|
|
{
|
|
self::setMac1904();
|
|
self::assertEquals(7, WeekDay::evaluate('1904-01-02'));
|
|
self::assertEquals(6, WeekDay::evaluate('1904-01-01'));
|
|
self::assertEquals(6, WeekDay::evaluate(null));
|
|
}
|
|
}
|