mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-09-15 12:36:32 +00:00
ec4098c8fd
While we might never be able to have 100% of our code strict, we can at the very least do it for all of our tests. This ensures that our tests are using our API with the types as intended by the test author, and not silently be cast to what our API requires.
29 lines
1011 B
PHP
29 lines
1011 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace PhpOffice\PhpSpreadsheetTests\Reader\Xlsx;
|
|
|
|
use DateTimeZone;
|
|
use PhpOffice\PhpSpreadsheet\IOFactory;
|
|
use PhpOffice\PhpSpreadsheet\Shared\Date;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class Issue2331Test extends TestCase
|
|
{
|
|
public function testIssue2331(): void
|
|
{
|
|
// Leading space instead of 0 in month and/or day of timestamp.
|
|
$filename = 'tests/data/Reader/XLSX/issue.2331c.xlsx';
|
|
$reader = IOFactory::createReader('Xlsx');
|
|
$spreadsheet = $reader->load($filename);
|
|
$properties = $spreadsheet->getProperties();
|
|
$created = (string) $properties->getCreated();
|
|
$modified = (string) $properties->getModified();
|
|
|
|
self::assertEquals('2021-08-02', Date::formattedDateTimeFromTimestamp($created, 'Y-m-d', new DateTimeZone('UTC')));
|
|
self::assertEquals('2021-09-03', Date::formattedDateTimeFromTimestamp($modified, 'Y-m-d', new DateTimeZone('UTC')));
|
|
$spreadsheet->disconnectWorksheets();
|
|
}
|
|
}
|