/** * testing convertCurrency method. */ public function testConvertCurrency() { $mockExch = $this->getMockBuilder('Opit\\OpitHrm\\CurrencyRateBundle\\Model\\ExchangeRateInterface')->disableOriginalConstructor()->setMethods(array('convertCurrency'))->getMockForAbstractClass(); $mockExch->expects($this->once())->method('convertCurrency')->will($this->returnValue(10)); $opitExtension = new OpitExtension($mockExch); $this->assertEquals(10, $opitExtension->convertCurrency('EUR', 'GBP', 12), 'ConvertCurrency: The expected and the given values are not equal.'); }