compatibilityMode = Functions::getCompatibilityMode(); $this->excelCalendar = Date::getExcelCalendar(); $this->returnDateType = Functions::getReturnDateType(); } protected function tearDown(): void { Date::setExcelCalendar($this->excelCalendar); Functions::setCompatibilityMode($this->compatibilityMode); Functions::setReturnDateType($this->returnDateType); $this->sheet = null; if ($this->spreadsheet !== null) { $this->spreadsheet->disconnectWorksheets(); $this->spreadsheet = null; } } protected static function setMac1904(): void { Date::setExcelCalendar(Date::CALENDAR_MAC_1904); } protected static function setUnixReturn(): void { Functions::setReturnDateType(Functions::RETURNDATE_UNIX_TIMESTAMP); } protected static function setObjectReturn(): void { Functions::setReturnDateType(Functions::RETURNDATE_PHP_DATETIME_OBJECT); } protected static function setOpenOffice(): void { Functions::setCompatibilityMode(Functions::COMPATIBILITY_OPENOFFICE); } /** * @param mixed $expectedResult */ protected function mightHaveException($expectedResult): void { if ($expectedResult === 'exception') { $this->expectException(CalcException::class); } } protected function getSpreadsheet(): Spreadsheet { if ($this->spreadsheet !== null) { return $this->spreadsheet; } $this->spreadsheet = new Spreadsheet(); return $this->spreadsheet; } protected function getSheet(): Worksheet { if ($this->sheet !== null) { return $this->sheet; } $this->sheet = $this->getSpreadsheet()->getActiveSheet(); return $this->sheet; } }