How to fix the «Call to protected method PHPUnit_Framework_TestCase::getMockForAbstractClass()» issue?

For now, Magento 2 uses the outdated 4.1.0 version of PHPUnit.

The PHPUnit_Framework_TestCase::getMockForAbstractClass() method is public in this version:

The same method is protected in the latest PHPUnit versions (5.x branch):

So, the «Call to protected method PHPUnit_Framework_TestCase::getMockForAbstractClass()» issue means you are mistakenly using your own PHPUnit package instead of the shipped with Magento 2 (maybe because of your IDE settings).