getMockBuilder(Worksheet::class) ->setMethods(['getStyle', 'getNumberFormat', 'setFormatCode', 'getCellCollection']) ->getMock(); $cellCollection = $this->getMockBuilder(Cells::class) ->disableOriginalConstructor() ->getMock(); $cellCollection->expects(self::any()) ->method('getParent') ->willReturn($sheet); $sheet->expects(self::once()) ->method('getStyle') ->willReturnSelf(); $sheet->expects(self::once()) ->method('getNumberFormat') ->willReturnSelf(); $sheet->expects(self::once()) ->method('setFormatCode') ->with($format) ->willReturnSelf(); $sheet->expects(self::any()) ->method('getCellCollection') ->willReturn($cellCollection); StringHelper::setCurrencyCode($currencyCode); StringHelper::setDecimalSeparator($decimalSeparator); StringHelper::setThousandsSeparator($thousandsSeparator); $cell = new Cell(null, DataType::TYPE_STRING, $sheet); $binder = new AdvancedValueBinder(); $binder->bindValue($cell, $value); self::assertEquals($valueBinded, $cell->getValue()); } }