I\'m new to unit testing and PHPUnit.
I need a mock, on which I have a full control, implementing ConfigurationInterface
interface. Test subject is Re
It's because there is no declaration of "getClass" method in ConfigurationInterface. The only declaration in this interface is method "getAliasName".
All you need is to tell the mock what methods you will be stubing:
$cls = 'Sensio\Bundle\FrameworkExtraBundle\Configuration\ConfigurationInterface';
$mock = $this->getMock($cls, array('getClass', 'getAliasName'));
Notice that there is no "getClass" declaration but you can stub/mock non existing method as well. Therefor you can mock it:
$mock->expects($this->any())
->method('getClass')
->will($this->returnValue('Some\Other\Class'));
But in addtion you need to mock "getAliasName" method as well as long as it's interface's method or abstract one and it has to be "implemented". Eg.:
$mock->expects($this->any())
->method('getAliasName')
->will($this->returnValue('SomeValue'));