Using Mockery to mock one method of a class.

$testClass = Mockery::mock(TestClass::class)->makePartial();
$testClass->shouldReceive('getName')
            ->once()
            ->andReturn("Mocked name");

In this example, we instantiate a TestClass and mock only one of its methods, the getName method were changed to return Mocked name value.

If we want to mock the complete class, just remove makePartial() method.