getMockBuilder(Worksheet::class) ->setMethods(['getStyle', 'getNumberFormat', 'setFormatCode', 'getCellCollection']) ->getMock(); $cellCollection = $this->getMockBuilder(Cells::class) ->disableOriginalConstructor() ->getMock(); $cellCollection->expects($this->any()) ->method('getParent') ->will($this->returnValue($sheet)); $sheet->expects($this->once()) ->method('getStyle') ->will($this->returnSelf()); $sheet->expects($this->once()) ->method('getNumberFormat') ->will($this->returnSelf()); $sheet->expects($this->once()) ->method('setFormatCode') ->with($format) ->will($this->returnSelf()); $sheet->expects($this->any()) ->method('getCellCollection') ->will($this->returnValue($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); $this->assertEquals($valueBinded, $cell->getValue()); } }