Change record status: 
Project: 
Introduced in branch: 
8.5.x
Introduced in version: 
8.5.x
Description: 

Drupal's UnitTestCase is intended to be a test base class with very few dependencies. This allows for isolation of components under stricter unit tests.

UnitTestCase has a dependency on the block module in order to provide a getBlockMockWithMachineName() mock generation method.

While the classes in question (BlockBase and Block) would autoload, the block module itself would not be initialized and so their functionality would not be available.

These classes were only used to generate mock objects. The only test in core to use these mocks was Drupal\Tests\block\Unit\BlockFormTest, itself situated within the block module.

Since the point of a unit test framework is to minimize dependencies and maximize isolation, we deprecated UnitTestBase::getBlockMockWithMachineName() with no replacement functionality.

The mocking behavior from UnitTestBase::getBlockMockWithMachineName() was moved to BlockFormTest.

If your test needs this behavior, you can copy it to your test in a way that suits the specific needs of the test.