getMockBuilder(Cell::class) ->disableOriginalConstructor() ->getMock(); $remoteCell->method('isFormula') ->willReturn(substr($value, 0, 1) == '='); $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 = Functions::isFormula($reference, $ourCell); self::assertEqualsWithDelta($expectedResult, $result, 1E-8); } public function providerIsFormula() { return require 'tests/data/Calculation/Functions/ISFORMULA.php'; } /** * @dataProvider providerIfCondition * * @param mixed $expectedResult */ public function testIfCondition($expectedResult, ...$args): void { $result = Functions::ifCondition(...$args); self::assertEquals($expectedResult, $result); } public function providerIfCondition() { return require 'tests/data/Calculation/Functions/IF_CONDITION.php'; } }