getMockBuilder(Cell::class) ->disableOriginalConstructor() ->getMock(); $remoteCell->method('isFormula') ->willReturn(substr($value, 0, 1) == '='); $remoteCell->method('getValue') ->willReturn($value); $remoteSheet = $this->getMockBuilder(Worksheet::class) ->disableOriginalConstructor() ->getMock(); $remoteSheet->method('getCell') ->willReturn($remoteCell); $workbook = $this->getMockBuilder(Spreadsheet::class) ->disableOriginalConstructor() ->getMock(); $workbook->method('getSheetByName') ->willReturn($remoteSheet); $sheet = $this->getMockBuilder(Worksheet::class) ->disableOriginalConstructor() ->getMock(); $sheet->method('getCell') ->willReturn($remoteCell); $sheet->method('getParent') ->willReturn($workbook); $ourCell = $this->getMockBuilder(Cell::class) ->disableOriginalConstructor() ->getMock(); $ourCell->method('getWorksheet') ->willReturn($sheet); } $result = LookupRef::FORMULATEXT($reference, $ourCell); self::assertEqualsWithDelta($expectedResult, $result, 1E-8); } public function providerFormulaText() { return require 'tests/data/Calculation/LookupRef/FORMULATEXT.php'; } }