Configurable

GetMockRector

Fixes deprecated getMock() calls

-$this->entityTypeManager = $this->getMock(EntityTypeManagerInterface::class);
+$this->entityTypeManager = $this->createMock(EntityTypeManagerInterface::class);

Configure your rector.php:

<?php

use DrupalRector\Drupal8\Rector\Deprecation\GetMockRector;
use DrupalRector\Drupal8\Rector\ValueObject\GetMockConfiguration;
use Rector\Config\RectorConfig;

return RectorConfig::configure()
    ->withConfiguredRule(GetMockRector::class, [
        new GetMockConfiguration('Drupal\Tests\BrowserTestBase'),
        new GetMockConfiguration('Drupal\KernelTests\KernelTestBase'),
        new GetMockConfiguration('Drupal\Tests\UnitTestCase'),
    ]);