-
Notifications
You must be signed in to change notification settings - Fork 3.6k
add tests to support issue 4476 #4519
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PhpOffice\PhpSpreadsheetTests\Reader\Ods; | ||
|
||
use PhpOffice\PhpSpreadsheet\Reader\Ods; | ||
use PhpOffice\PhpSpreadsheet\Shared\Date; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class Issue4476Test extends TestCase | ||
{ | ||
public function testIssue2810(): void | ||
{ | ||
// Active sheet with title of '0' wasn't found | ||
$filename = 'tests/data/Reader/Ods/issue.4476.ods'; | ||
$reader = new Ods(); | ||
$spreadsheet = $reader->load($filename); | ||
$sheet = $spreadsheet->getActiveSheet(); | ||
$rawValue = $sheet->getCell('A1')->getValue(); | ||
$dt = Date::excelToDateTimeObject($rawValue); | ||
self::assertSame('2016-06-01 13:37', $dt->format('Y-m-d H:i')); | ||
$spreadsheet->disconnectWorksheets(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PhpOffice\PhpSpreadsheetTests\Reader\Xlsx; | ||
|
||
use PhpOffice\PhpSpreadsheet\Reader\Xlsx; | ||
use PhpOffice\PhpSpreadsheet\Shared\Date; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class Issue4476Test extends TestCase | ||
{ | ||
public function testIssue4476(): void | ||
{ | ||
$filename = 'tests/data/Reader/XLSX/issue.4476.xlsx'; | ||
|
||
$reader = new Xlsx(); | ||
$spreadsheet = $reader->load($filename); | ||
$sheet = $spreadsheet->getActiveSheet(); | ||
$rawValue = $sheet->getCell('A1')->getValue(); | ||
$dt = Date::excelToDateTimeObject($rawValue); | ||
|
||
self::assertSame('2016-06-01 13:37', $dt->format('Y-m-d H:i')); | ||
Check failure on line 23 in tests/PhpSpreadsheetTests/Reader/Xlsx/Issue4476Test.php
|
||
$spreadsheet->disconnectWorksheets(); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can add:
/** @var float|int */
before this statement to eliminate the Phpstan error.