date = new \DateTime(); } protected function getExpectedValue() { return Date::PHPToExcel($this->date); } public function testFormattedValueWithInvalidValue(): void { $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('Unsupported value given, only DateTimeInterface is supported'); $spreadsheet = new Spreadsheet(); $worksheet = $spreadsheet->getActiveSheet(); $sut = $this->getFormatter(); $sut->setFormattedValue($worksheet, 1, 1, 'sdfsdf'); } public function assertCellStyle(Style $style): void { self::assertEquals(DateTimeFormatter::DATETIME_FORMAT, $style->getNumberFormat()->getFormatCode()); } }