PHPUnit 5.7.4子类中的基类方法不能正常工作。 正在调用原始方法而不是模拟。

class baseClass
{
    public function __construct()
    {

    }
    public function methodToBeMocked()
    {
        // do somthing
    }

}

class childClass extends baseClass
{

    public function __construct()
    {
        parent::__construct($doctrine, $securityContext);
    }

    public function methodUsingMethodToBeMocked()
    {
        // do somthing
        $this->methodToBeMocked();
    }
}

When I am trying to mock the methodToBeMocked in stubbed childClass.

$this->mockChildClass = $this->getMockBuilder('\childClass')
    ->setMockClassName('Mock_Child_Class')
    ->setConstructorArgs(
        [
          // arguments
        ]
     )
    ->setMethods(['methodToBeMocked'])
    ->getMock();

$this->mockChildClass
    ->expects($this->once())
    ->method('methodToBeMocked')
    ->will($this->returnValue(null));

Instead of calling mocked method and return value, actual baseClass method is called. Need to call the mocked method.