compatibilityMode = Functions::getCompatibilityMode(); } protected function tearDown(): void { Functions::setCompatibilityMode($this->compatibilityMode); $this->sheet = null; if ($this->spreadsheet !== null) { $this->spreadsheet->disconnectWorksheets(); $this->spreadsheet = null; } } protected static function setExcel(): void { Functions::setCompatibilityMode( Functions::COMPATIBILITY_EXCEL ); } protected static function setOpenOffice(): void { Functions::setCompatibilityMode( Functions::COMPATIBILITY_OPENOFFICE ); } protected static function setGnumeric(): void { Functions::setCompatibilityMode( Functions::COMPATIBILITY_GNUMERIC ); } protected function mightHaveException(mixed $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; } }