I want to mock a static method which has been used in another method using Mokcery,Just as follows:
Class SomeClass
{
public static function methodA()
{
.....;
self::B();
}
public static function methodB()
{
Do SomeThing
}
}
if I want to mock methodB,and use methodA,the mock function doesn't work, just because methodB is used in methodA,just as below
use Mockery as m;
$mocktest = m::mock->('SomeClass[B]');
$mocktest->shouldReceive('B')->andReturn("expectedResult");
$mocktest->methodA();
The code above will result in methodB still return it's original result rather than 'expectedResult'. I expect the methodB used in the methodA to be mocked,how could I operate?