diff --git a/core/modules/aggregator/tests/src/Unit/Plugin/AggregatorPluginSettingsBaseTest.php b/core/modules/aggregator/tests/src/Unit/Plugin/AggregatorPluginSettingsBaseTest.php
index 9267237..947d05f 100644
--- a/core/modules/aggregator/tests/src/Unit/Plugin/AggregatorPluginSettingsBaseTest.php
+++ b/core/modules/aggregator/tests/src/Unit/Plugin/AggregatorPluginSettingsBaseTest.php
@@ -3,6 +3,8 @@
 namespace Drupal\Tests\aggregator\Unit\Plugin;
 
 use Drupal\aggregator\Form\SettingsForm;
+use Drupal\aggregator\Plugin\AggregatorPluginManager;
+use Drupal\aggregator_test\Plugin\aggregator\processor\TestProcessor;
 use Drupal\Core\Form\FormState;
 use Drupal\Tests\UnitTestCase;
 
@@ -47,7 +49,7 @@ protected function setUp() {
       ]
     );
     foreach (['fetcher', 'parser', 'processor'] as $type) {
-      $this->managers[$type] = $this->getMockBuilder('Drupal\aggregator\Plugin\AggregatorPluginManager')
+      $this->managers[$type] = $this->getMockBuilder(AggregatorPluginManager::class)
         ->disableOriginalConstructor()
         ->getMock();
       $this->managers[$type]->expects($this->once())
@@ -78,7 +80,7 @@ public function testSettingsForm() {
     ]);
 
     $test_processor = $this->getMock(
-      'Drupal\aggregator_test\Plugin\aggregator\processor\TestProcessor',
+      TestProcessor::class,
       ['buildConfigurationForm', 'validateConfigurationForm', 'submitConfigurationForm'],
       [[], 'aggregator_test', ['description' => ''], $this->configFactory]
     );
diff --git a/core/modules/ban/tests/src/Unit/BanMiddlewareTest.php b/core/modules/ban/tests/src/Unit/BanMiddlewareTest.php
index 058846a..c04abcd 100644
--- a/core/modules/ban/tests/src/Unit/BanMiddlewareTest.php
+++ b/core/modules/ban/tests/src/Unit/BanMiddlewareTest.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\Tests\ban\Unit;
 
+use Drupal\ban\BanIpManagerInterface;
 use Drupal\ban\BanMiddleware;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\HttpFoundation\Request;
@@ -41,8 +42,8 @@ class BanMiddlewareTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $this->kernel = $this->getMock('Symfony\Component\HttpKernel\HttpKernelInterface');
-    $this->banManager = $this->getMock('Drupal\ban\BanIpManagerInterface');
+    $this->kernel = $this->getMock(HttpKernelInterface::class);
+    $this->banManager = $this->getMock(BanIpManagerInterface::class);
     $this->banMiddleware = new BanMiddleware($this->kernel, $this->banManager);
   }
 
diff --git a/core/modules/block/tests/src/Unit/BlockConfigEntityUnitTest.php b/core/modules/block/tests/src/Unit/BlockConfigEntityUnitTest.php
index 8df0e93..d641ac3 100644
--- a/core/modules/block/tests/src/Unit/BlockConfigEntityUnitTest.php
+++ b/core/modules/block/tests/src/Unit/BlockConfigEntityUnitTest.php
@@ -2,7 +2,12 @@
 
 namespace Drupal\Tests\block\Unit;
 
+use Drupal\block\Entity\Block;
+use Drupal\Component\Uuid\UuidInterface;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Entity\EntityTypeInterface;
+use Drupal\Core\Plugin\DefaultLazyPluginCollection;
 use Drupal\Tests\Core\Plugin\Fixtures\TestConfigurablePlugin;
 use Drupal\Tests\UnitTestCase;
 
@@ -46,18 +51,18 @@ class BlockConfigEntityUnitTest extends UnitTestCase {
   protected function setUp() {
     $this->entityTypeId = $this->randomMachineName();
 
-    $this->entityType = $this->getMock('\Drupal\Core\Entity\EntityTypeInterface');
+    $this->entityType = $this->getMock(EntityTypeInterface::class);
     $this->entityType->expects($this->any())
       ->method('getProvider')
       ->will($this->returnValue('block'));
 
-    $this->entityManager = $this->getMock('\Drupal\Core\Entity\EntityManagerInterface');
+    $this->entityManager = $this->getMock(EntityManagerInterface::class);
     $this->entityManager->expects($this->any())
       ->method('getDefinition')
       ->with($this->entityTypeId)
       ->will($this->returnValue($this->entityType));
 
-    $this->uuid = $this->getMock('\Drupal\Component\Uuid\UuidInterface');
+    $this->uuid = $this->getMock(UuidInterface::class);
 
     $container = new ContainerBuilder();
     $container->set('entity.manager', $this->entityManager);
@@ -71,7 +76,7 @@ protected function setUp() {
   public function testCalculateDependencies() {
     $values = ['theme' => 'stark'];
     // Mock the entity under test so that we can mock getPluginCollections().
-    $entity = $this->getMockBuilder('\Drupal\block\Entity\Block')
+    $entity = $this->getMockBuilder(Block::class)
       ->setConstructorArgs([$values, $this->entityTypeId])
       ->setMethods(['getPluginCollections'])
       ->getMock();
@@ -80,7 +85,7 @@ public function testCalculateDependencies() {
     $instance = new TestConfigurablePlugin([], $instance_id, ['provider' => 'test']);
 
     // Create a plugin collection to contain the instance.
-    $plugin_collection = $this->getMockBuilder('\Drupal\Core\Plugin\DefaultLazyPluginCollection')
+    $plugin_collection = $this->getMockBuilder(DefaultLazyPluginCollection::class)
       ->disableOriginalConstructor()
       ->setMethods(['get'])
       ->getMock();
diff --git a/core/modules/block/tests/src/Unit/BlockFormTest.php b/core/modules/block/tests/src/Unit/BlockFormTest.php
index b846349..086e5a3 100644
--- a/core/modules/block/tests/src/Unit/BlockFormTest.php
+++ b/core/modules/block/tests/src/Unit/BlockFormTest.php
@@ -3,6 +3,13 @@
 namespace Drupal\Tests\block\Unit;
 
 use Drupal\block\BlockForm;
+use Drupal\Core\Config\Entity\ConfigEntityStorageInterface;
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Entity\Query\QueryInterface;
+use Drupal\Core\Executable\ExecutableManagerInterface;
+use Drupal\Core\Extension\ThemeHandlerInterface;
+use Drupal\Core\Language\LanguageManagerInterface;
+use Drupal\Core\Plugin\Context\ContextRepositoryInterface;
 use Drupal\Core\Plugin\PluginFormFactoryInterface;
 use Drupal\Tests\UnitTestCase;
 
@@ -68,13 +75,13 @@ class BlockFormTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $this->conditionManager = $this->getMock('Drupal\Core\Executable\ExecutableManagerInterface');
-    $this->language = $this->getMock('Drupal\Core\Language\LanguageManagerInterface');
-    $this->contextRepository = $this->getMock('Drupal\Core\Plugin\Context\ContextRepositoryInterface');
+    $this->conditionManager = $this->getMock(ExecutableManagerInterface::class);
+    $this->language = $this->getMock(LanguageManagerInterface::class);
+    $this->contextRepository = $this->getMock(ContextRepositoryInterface::class);
 
-    $this->entityManager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
-    $this->storage = $this->getMock('Drupal\Core\Config\Entity\ConfigEntityStorageInterface');
-    $this->themeHandler = $this->getMock('Drupal\Core\Extension\ThemeHandlerInterface');
+    $this->entityManager = $this->getMock(EntityManagerInterface::class);
+    $this->storage = $this->getMock(ConfigEntityStorageInterface::class);
+    $this->themeHandler = $this->getMock(ThemeHandlerInterface::class);
     $this->entityManager->expects($this->any())
       ->method('getStorage')
       ->will($this->returnValue($this->storage));
@@ -95,7 +102,7 @@ public function testGetUniqueMachineName() {
     $blocks['other_test_1'] = $this->getBlockMockWithMachineName('other_test');
     $blocks['other_test_2'] = $this->getBlockMockWithMachineName('other_test');
 
-    $query = $this->getMock('Drupal\Core\Entity\Query\QueryInterface');
+    $query = $this->getMock(QueryInterface::class);
     $query->expects($this->exactly(5))
       ->method('condition')
       ->will($this->returnValue($query));
diff --git a/core/modules/block/tests/src/Unit/BlockRepositoryTest.php b/core/modules/block/tests/src/Unit/BlockRepositoryTest.php
index 5584b0b..d4aaf7a 100644
--- a/core/modules/block/tests/src/Unit/BlockRepositoryTest.php
+++ b/core/modules/block/tests/src/Unit/BlockRepositoryTest.php
@@ -7,10 +7,16 @@
 
 namespace Drupal\Tests\block\Unit;
 
+use Drupal\block\BlockInterface;
 use Drupal\block\BlockRepository;
 use Drupal\Core\Access\AccessResult;
 use Drupal\Core\Block\BlockPluginInterface;
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Entity\EntityStorageInterface;
+use Drupal\Core\Plugin\Context\ContextHandlerInterface;
 use Drupal\Core\Plugin\ContextAwarePluginInterface;
+use Drupal\Core\Theme\ActiveTheme;
+use Drupal\Core\Theme\ThemeManagerInterface;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -44,7 +50,7 @@ class BlockRepositoryTest extends UnitTestCase {
    */
   protected function setUp() {
     parent::setUp();
-    $active_theme = $this->getMockBuilder('Drupal\Core\Theme\ActiveTheme')
+    $active_theme = $this->getMockBuilder(ActiveTheme::class)
       ->disableOriginalConstructor()
       ->getMock();
     $this->theme = $this->randomMachineName();
@@ -59,14 +65,14 @@ protected function setUp() {
         'bottom',
       ]);
 
-    $theme_manager = $this->getMock('Drupal\Core\Theme\ThemeManagerInterface');
+    $theme_manager = $this->getMock(ThemeManagerInterface::class);
     $theme_manager->expects($this->atLeastOnce())
       ->method('getActiveTheme')
       ->will($this->returnValue($active_theme));
 
-    $this->contextHandler = $this->getMock('Drupal\Core\Plugin\Context\ContextHandlerInterface');
-    $this->blockStorage = $this->getMock('Drupal\Core\Entity\EntityStorageInterface');
-    $entity_manager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
+    $this->contextHandler = $this->getMock(ContextHandlerInterface::class);
+    $this->blockStorage = $this->getMock(EntityStorageInterface::class);
+    $entity_manager = $this->getMock(EntityManagerInterface::class);
     $entity_manager->expects($this->any())
       ->method('getStorage')
       ->willReturn($this->blockStorage);
@@ -84,7 +90,7 @@ protected function setUp() {
   public function testGetVisibleBlocksPerRegion(array $blocks_config, array $expected_blocks) {
     $blocks = [];
     foreach ($blocks_config as $block_id => $block_config) {
-      $block = $this->getMock('Drupal\block\BlockInterface');
+      $block = $this->getMock(BlockInterface::class);
       $block->expects($this->once())
         ->method('access')
         ->will($this->returnValue($block_config[0]));
@@ -153,7 +159,7 @@ public function providerBlocksConfig() {
    * @covers ::getVisibleBlocksPerRegion
    */
   public function testGetVisibleBlocksPerRegionWithContext() {
-    $block = $this->getMock('Drupal\block\BlockInterface');
+    $block = $this->getMock(BlockInterface::class);
     $block->expects($this->once())
       ->method('access')
       ->willReturn(AccessResult::allowed()->addCacheTags(['config:block.block.block_id']));
diff --git a/core/modules/block/tests/src/Unit/CategoryAutocompleteTest.php b/core/modules/block/tests/src/Unit/CategoryAutocompleteTest.php
index d91ebbc..8b30c1a 100644
--- a/core/modules/block/tests/src/Unit/CategoryAutocompleteTest.php
+++ b/core/modules/block/tests/src/Unit/CategoryAutocompleteTest.php
@@ -4,6 +4,7 @@
 
 use Drupal\Component\Utility\Html;
 use Drupal\block\Controller\CategoryAutocompleteController;
+use Drupal\Core\Block\BlockManagerInterface;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\HttpFoundation\Request;
 
@@ -21,7 +22,7 @@ class CategoryAutocompleteTest extends UnitTestCase {
   protected $autocompleteController;
 
   protected function setUp() {
-    $block_manager = $this->getMock('Drupal\Core\Block\BlockManagerInterface');
+    $block_manager = $this->getMock(BlockManagerInterface::class);
     $block_manager->expects($this->any())
       ->method('getCategories')
       ->will($this->returnValue(['Comment', 'Node', 'None & Such', 'User']));
diff --git a/core/modules/block/tests/src/Unit/Menu/BlockLocalTasksTest.php b/core/modules/block/tests/src/Unit/Menu/BlockLocalTasksTest.php
index 6d7dbf2..4159665 100644
--- a/core/modules/block/tests/src/Unit/Menu/BlockLocalTasksTest.php
+++ b/core/modules/block/tests/src/Unit/Menu/BlockLocalTasksTest.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\Tests\block\Unit\Menu;
 
+use Drupal\Core\Extension\ThemeHandlerInterface;
 use Drupal\Tests\Core\Menu\LocalTaskIntegrationTestBase;
 use Symfony\Component\DependencyInjection\ContainerBuilder;
 
@@ -40,7 +41,7 @@ protected function setUp() {
         'name' => 'test_c',
       ],
     ];
-    $theme_handler = $this->getMock('Drupal\Core\Extension\ThemeHandlerInterface');
+    $theme_handler = $this->getMock(ThemeHandlerInterface::class);
     $theme_handler->expects($this->any())
       ->method('listInfo')
       ->will($this->returnValue($themes));
diff --git a/core/modules/block/tests/src/Unit/Plugin/DisplayVariant/BlockPageVariantTest.php b/core/modules/block/tests/src/Unit/Plugin/DisplayVariant/BlockPageVariantTest.php
index 1569411..53b8750 100644
--- a/core/modules/block/tests/src/Unit/Plugin/DisplayVariant/BlockPageVariantTest.php
+++ b/core/modules/block/tests/src/Unit/Plugin/DisplayVariant/BlockPageVariantTest.php
@@ -2,8 +2,17 @@
 
 namespace Drupal\Tests\block\Unit\Plugin\DisplayVariant;
 
+use Drupal\block\BlockInterface;
+use Drupal\block\BlockRepositoryInterface;
+use Drupal\block\Plugin\DisplayVariant\BlockPageVariant;
+use Drupal\Core\Block\BlockPluginInterface;
+use Drupal\Core\Block\MainContentBlockPluginInterface;
+use Drupal\Core\Block\MessagesBlockPluginInterface;
+use Drupal\Core\Block\TitleBlockPluginInterface;
 use Drupal\Core\Cache\CacheableMetadata;
+use Drupal\Core\Cache\CacheContextsManager;
 use Drupal\Core\DependencyInjection\Container;
+use Drupal\Core\Entity\EntityViewBuilderInterface;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -47,7 +56,7 @@ class BlockPageVariantTest extends UnitTestCase {
   public function setUpDisplayVariant($configuration = [], $definition = []) {
 
     $container = new Container();
-    $cache_context_manager = $this->getMockBuilder('Drupal\Core\Cache\CacheContextsManager')
+    $cache_context_manager = $this->getMockBuilder(CacheContextsManager::class)
       ->disableOriginalConstructor()
       ->getMock();
     $container->set('cache_contexts_manager', $cache_context_manager);
@@ -56,10 +65,10 @@ public function setUpDisplayVariant($configuration = [], $definition = []) {
       ->willReturn(TRUE);
     \Drupal::setContainer($container);
 
-    $this->blockRepository = $this->getMock('Drupal\block\BlockRepositoryInterface');
-    $this->blockViewBuilder = $this->getMock('Drupal\Core\Entity\EntityViewBuilderInterface');
+    $this->blockRepository = $this->getMock(BlockRepositoryInterface::class);
+    $this->blockViewBuilder = $this->getMock(EntityViewBuilderInterface::class);
 
-    return $this->getMockBuilder('Drupal\block\Plugin\DisplayVariant\BlockPageVariant')
+    return $this->getMockBuilder(BlockPageVariant::class)
       ->setConstructorArgs([$configuration, 'test', $definition, $this->blockRepository, $this->blockViewBuilder, ['config:block_list']])
       ->setMethods(['getRegionNames'])
       ->getMock();
@@ -203,12 +212,12 @@ public function testBuild(array $blocks_config, $visible_block_count, array $exp
     $display_variant->setMainContent(['#markup' => 'Hello kittens!']);
 
     $blocks = ['top' => [], 'center' => [], 'bottom' => []];
-    $block_plugin = $this->getMock('Drupal\Core\Block\BlockPluginInterface');
-    $main_content_block_plugin = $this->getMock('Drupal\Core\Block\MainContentBlockPluginInterface');
-    $messages_block_plugin = $this->getMock('Drupal\Core\Block\MessagesBlockPluginInterface');
-    $title_block_plugin = $this->getMock('Drupal\Core\Block\TitleBlockPluginInterface');
+    $block_plugin = $this->getMock(BlockPluginInterface::class);
+    $main_content_block_plugin = $this->getMock(MainContentBlockPluginInterface::class);
+    $messages_block_plugin = $this->getMock(MessagesBlockPluginInterface::class);
+    $title_block_plugin = $this->getMock(TitleBlockPluginInterface::class);
     foreach ($blocks_config as $block_id => $block_config) {
-      $block = $this->getMock('Drupal\block\BlockInterface');
+      $block = $this->getMock(BlockInterface::class);
       $block->expects($this->any())
         ->method('getContexts')
         ->willReturn([]);
diff --git a/core/modules/block_content/tests/src/Unit/Menu/BlockContentLocalTasksTest.php b/core/modules/block_content/tests/src/Unit/Menu/BlockContentLocalTasksTest.php
index ced7e84..56abb80 100644
--- a/core/modules/block_content/tests/src/Unit/Menu/BlockContentLocalTasksTest.php
+++ b/core/modules/block_content/tests/src/Unit/Menu/BlockContentLocalTasksTest.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\Tests\block_content\Unit\Menu;
 
+use Drupal\Core\Extension\ThemeHandlerInterface;
 use Drupal\Tests\Core\Menu\LocalTaskIntegrationTestBase;
 use Symfony\Component\DependencyInjection\ContainerBuilder;
 
@@ -39,7 +40,7 @@ protected function setUp() {
         'name' => 'test_c',
       ],
     ];
-    $theme_handler = $this->getMock('Drupal\Core\Extension\ThemeHandlerInterface');
+    $theme_handler = $this->getMock(ThemeHandlerInterface::class);
     $theme_handler->expects($this->any())
       ->method('listInfo')
       ->will($this->returnValue($themes));
diff --git a/core/modules/book/tests/src/Unit/BookManagerTest.php b/core/modules/book/tests/src/Unit/BookManagerTest.php
index 98dbd5a..55f72af 100644
--- a/core/modules/book/tests/src/Unit/BookManagerTest.php
+++ b/core/modules/book/tests/src/Unit/BookManagerTest.php
@@ -3,6 +3,9 @@
 namespace Drupal\Tests\book\Unit;
 
 use Drupal\book\BookManager;
+use Drupal\book\BookOutlineStorageInterface;
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Render\RendererInterface;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -57,11 +60,11 @@ class BookManagerTest extends UnitTestCase {
    * {@inheritdoc}
    */
   protected function setUp() {
-    $this->entityManager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
+    $this->entityManager = $this->getMock(EntityManagerInterface::class);
     $this->translation = $this->getStringTranslationStub();
     $this->configFactory = $this->getConfigFactoryStub([]);
-    $this->bookOutlineStorage = $this->getMock('Drupal\book\BookOutlineStorageInterface');
-    $this->renderer = $this->getMock('\Drupal\Core\Render\RendererInterface');
+    $this->bookOutlineStorage = $this->getMock(BookOutlineStorageInterface::class);
+    $this->renderer = $this->getMock(RendererInterface::class);
     $this->bookManager = new BookManager($this->entityManager, $this->translation, $this->configFactory, $this->bookOutlineStorage, $this->renderer);
   }
 
diff --git a/core/modules/book/tests/src/Unit/BookUninstallValidatorTest.php b/core/modules/book/tests/src/Unit/BookUninstallValidatorTest.php
index 2dfd7a0..befbd59 100644
--- a/core/modules/book/tests/src/Unit/BookUninstallValidatorTest.php
+++ b/core/modules/book/tests/src/Unit/BookUninstallValidatorTest.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\Tests\book\Unit;
 
+use Drupal\book\BookUninstallValidator;
 use Drupal\simpletest\AssertHelperTrait;
 use Drupal\Tests\UnitTestCase;
 
@@ -23,7 +24,7 @@ class BookUninstallValidatorTest extends UnitTestCase {
    */
   protected function setUp() {
     parent::setUp();
-    $this->bookUninstallValidator = $this->getMockBuilder('Drupal\book\BookUninstallValidator')
+    $this->bookUninstallValidator = $this->getMockBuilder(BookUninstallValidator::class)
       ->disableOriginalConstructor()
       ->setMethods(['hasBookOutlines', 'hasBookNodes'])
       ->getMock();
diff --git a/core/modules/breakpoint/tests/src/Unit/BreakpointTest.php b/core/modules/breakpoint/tests/src/Unit/BreakpointTest.php
index 4b8fd88..0cdc245 100644
--- a/core/modules/breakpoint/tests/src/Unit/BreakpointTest.php
+++ b/core/modules/breakpoint/tests/src/Unit/BreakpointTest.php
@@ -5,6 +5,7 @@
 use Drupal\breakpoint\Breakpoint;
 use Drupal\Tests\UnitTestCase;
 use Drupal\Core\StringTranslation\TranslatableMarkup;
+use Drupal\Core\StringTranslation\TranslationInterface;
 
 /**
  * @coversDefaultClass \Drupal\breakpoint\Breakpoint
@@ -45,7 +46,7 @@ class BreakpointTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $this->stringTranslation = $this->getMock('Drupal\Core\StringTranslation\TranslationInterface');
+    $this->stringTranslation = $this->getMock(TranslationInterface::class);
   }
 
   /**
diff --git a/core/modules/ckeditor/tests/src/Unit/Plugin/CKEditorPlugin/LanguageTest.php b/core/modules/ckeditor/tests/src/Unit/Plugin/CKEditorPlugin/LanguageTest.php
index 3b18c67..2b3e81c 100644
--- a/core/modules/ckeditor/tests/src/Unit/Plugin/CKEditorPlugin/LanguageTest.php
+++ b/core/modules/ckeditor/tests/src/Unit/Plugin/CKEditorPlugin/LanguageTest.php
@@ -4,6 +4,7 @@
 
 use Drupal\ckeditor\Plugin\CKEditorPlugin\Language;
 use Drupal\Core\Language\LanguageManager;
+use Drupal\editor\Entity\Editor;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -43,7 +44,7 @@ public function providerGetConfig() {
    * @dataProvider providerGetConfig
    */
   public function testGetConfig($language_list, $expected_number) {
-    $editor = $this->getMockBuilder('Drupal\editor\Entity\Editor')
+    $editor = $this->getMockBuilder(Editor::class)
       ->disableOriginalConstructor()
       ->getMock();
     $editor->expects($this->once())
diff --git a/core/modules/comment/tests/src/Unit/CommentLinkBuilderTest.php b/core/modules/comment/tests/src/Unit/CommentLinkBuilderTest.php
index 8a0a0f5..3e074e4 100644
--- a/core/modules/comment/tests/src/Unit/CommentLinkBuilderTest.php
+++ b/core/modules/comment/tests/src/Unit/CommentLinkBuilderTest.php
@@ -3,7 +3,12 @@
 namespace Drupal\Tests\comment\Unit;
 
 use Drupal\comment\CommentLinkBuilder;
+use Drupal\comment\CommentManagerInterface;
 use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Extension\ModuleHandlerInterface;
+use Drupal\Core\Field\FieldDefinitionInterface;
+use Drupal\Core\Session\AccountProxyInterface;
 use Drupal\Core\Url;
 use Drupal\node\NodeInterface;
 use Drupal\Tests\Traits\Core\GeneratePermutationsTrait;
@@ -68,11 +73,11 @@ class CommentLinkBuilderTest extends UnitTestCase {
    * Prepares mocks for the test.
    */
   protected function setUp() {
-    $this->commentManager = $this->getMock('\Drupal\comment\CommentManagerInterface');
+    $this->commentManager = $this->getMock(CommentManagerInterface::class);
     $this->stringTranslation = $this->getStringTranslationStub();
-    $this->entityManager = $this->getMock('\Drupal\Core\Entity\EntityManagerInterface');
-    $this->moduleHandler = $this->getMock('\Drupal\Core\Extension\ModuleHandlerInterface');
-    $this->currentUser = $this->getMock('\Drupal\Core\Session\AccountProxyInterface');
+    $this->entityManager = $this->getMock(EntityManagerInterface::class);
+    $this->moduleHandler = $this->getMock(ModuleHandlerInterface::class);
+    $this->currentUser = $this->getMock(AccountProxyInterface::class);
     $this->commentLinkBuilder = new CommentLinkBuilder($this->currentUser, $this->commentManager, $this->moduleHandler, $this->stringTranslation, $this->entityManager);
     $this->commentManager->expects($this->any())
       ->method('getFields')
@@ -268,7 +273,7 @@ public function getLinkCombinations() {
    *   Mock node for testing.
    */
   protected function getMockNode($has_field, $comment_status, $form_location, $comment_count) {
-    $node = $this->getMock('\Drupal\node\NodeInterface');
+    $node = $this->getMock(NodeInterface::class);
     $node->expects($this->once())
       ->method('hasField')
       ->willReturn($has_field);
@@ -286,7 +291,7 @@ protected function getMockNode($has_field, $comment_status, $form_location, $com
       ->with('comment')
       ->willReturn($field_item);
 
-    $field_definition = $this->getMock('\Drupal\Core\Field\FieldDefinitionInterface');
+    $field_definition = $this->getMock(FieldDefinitionInterface::class);
     $field_definition->expects($this->any())
       ->method('getSetting')
       ->with('form_location')
diff --git a/core/modules/comment/tests/src/Unit/CommentManagerTest.php b/core/modules/comment/tests/src/Unit/CommentManagerTest.php
index 3a6e201..38a387b 100644
--- a/core/modules/comment/tests/src/Unit/CommentManagerTest.php
+++ b/core/modules/comment/tests/src/Unit/CommentManagerTest.php
@@ -3,7 +3,14 @@
 namespace Drupal\Tests\comment\Unit;
 
 use Drupal\comment\CommentManager;
+use Drupal\Core\Config\ConfigFactoryInterface;
+use Drupal\Core\Entity\ContentEntityTypeInterface;
+use Drupal\Core\Entity\EntityManagerInterface;
 use Drupal\Core\Entity\FieldableEntityInterface;
+use Drupal\Core\Extension\ModuleHandlerInterface;
+use Drupal\Core\Routing\UrlGeneratorInterface;
+use Drupal\Core\Session\AccountInterface;
+use Drupal\Core\StringTranslation\TranslationInterface;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -19,7 +26,7 @@ class CommentManagerTest extends UnitTestCase {
    */
   public function testGetFields() {
     // Set up a content entity type.
-    $entity_type = $this->getMock('Drupal\Core\Entity\ContentEntityTypeInterface');
+    $entity_type = $this->getMock(ContentEntityTypeInterface::class);
     $entity_type->expects($this->any())
       ->method('getClass')
       ->will($this->returnValue('Node'));
@@ -28,7 +35,7 @@ public function testGetFields() {
       ->with(FieldableEntityInterface::class)
       ->will($this->returnValue(TRUE));
 
-    $entity_manager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
+    $entity_manager = $this->getMock(EntityManagerInterface::class);
 
     $entity_manager->expects($this->once())
       ->method('getFieldMapByFieldType')
@@ -46,11 +53,11 @@ public function testGetFields() {
 
     $comment_manager = new CommentManager(
       $entity_manager,
-      $this->getMock('Drupal\Core\Config\ConfigFactoryInterface'),
-      $this->getMock('Drupal\Core\StringTranslation\TranslationInterface'),
-      $this->getMock('Drupal\Core\Routing\UrlGeneratorInterface'),
-      $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface'),
-      $this->getMock('Drupal\Core\Session\AccountInterface')
+      $this->getMock(ConfigFactoryInterface::class),
+      $this->getMock(TranslationInterface::class),
+      $this->getMock(UrlGeneratorInterface::class),
+      $this->getMock(ModuleHandlerInterface::class),
+      $this->getMock(AccountInterface::class)
     );
     $comment_fields = $comment_manager->getFields('node');
     $this->assertArrayHasKey('field_foobar', $comment_fields);
diff --git a/core/modules/comment/tests/src/Unit/CommentStatisticsUnitTest.php b/core/modules/comment/tests/src/Unit/CommentStatisticsUnitTest.php
index 2a6d379..8c7401e 100644
--- a/core/modules/comment/tests/src/Unit/CommentStatisticsUnitTest.php
+++ b/core/modules/comment/tests/src/Unit/CommentStatisticsUnitTest.php
@@ -3,6 +3,12 @@
 namespace Drupal\Tests\comment\Unit;
 
 use Drupal\comment\CommentStatistics;
+use Drupal\Core\Database\Connection;
+use Drupal\Core\Database\Driver\sqlite\Statement;
+use Drupal\Core\Database\Query\Select;
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Session\AccountInterface;
+use Drupal\Core\State\StateInterface;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -50,7 +56,7 @@ class CommentStatisticsUnitTest extends UnitTestCase {
    * Sets up required mocks and the CommentStatistics service under test.
    */
   protected function setUp() {
-    $this->statement = $this->getMockBuilder('Drupal\Core\Database\Driver\sqlite\Statement')
+    $this->statement = $this->getMockBuilder(Statement::class)
       ->disableOriginalConstructor()
       ->getMock();
 
@@ -58,7 +64,7 @@ protected function setUp() {
       ->method('fetchObject')
       ->will($this->returnCallback([$this, 'fetchObjectCallback']));
 
-    $this->select = $this->getMockBuilder('Drupal\Core\Database\Query\Select')
+    $this->select = $this->getMockBuilder(Select::class)
       ->disableOriginalConstructor()
       ->getMock();
 
@@ -74,7 +80,7 @@ protected function setUp() {
       ->method('execute')
       ->will($this->returnValue($this->statement));
 
-    $this->database = $this->getMockBuilder('Drupal\Core\Database\Connection')
+    $this->database = $this->getMockBuilder(Connection::class)
       ->disableOriginalConstructor()
       ->getMock();
 
@@ -82,7 +88,7 @@ protected function setUp() {
       ->method('select')
       ->will($this->returnValue($this->select));
 
-    $this->commentStatistics = new CommentStatistics($this->database, $this->getMock('Drupal\Core\Session\AccountInterface'), $this->getMock('Drupal\Core\Entity\EntityManagerInterface'), $this->getMock('Drupal\Core\State\StateInterface'));
+    $this->commentStatistics = new CommentStatistics($this->database, $this->getMock(AccountInterface::class), $this->getMock(EntityManagerInterface::class), $this->getMock(StateInterface::class));
   }
 
   /**
diff --git a/core/modules/comment/tests/src/Unit/Entity/CommentLockTest.php b/core/modules/comment/tests/src/Unit/Entity/CommentLockTest.php
index e724dc6..bb386e8 100644
--- a/core/modules/comment/tests/src/Unit/Entity/CommentLockTest.php
+++ b/core/modules/comment/tests/src/Unit/Entity/CommentLockTest.php
@@ -2,7 +2,17 @@
 
 namespace Drupal\Tests\comment\Unit\Entity;
 
+use Drupal\comment\CommentStatisticsInterface;
+use Drupal\comment\CommentStorageInterface;
+use Drupal\comment\Entity\Comment;
+use Drupal\Core\Cache\CacheBackendInterface;
+use Drupal\Core\Cache\CacheTagsInvalidator;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
+use Drupal\Core\Entity\ContentEntityInterface;
+use Drupal\Core\Entity\EntityTypeInterface;
+use Drupal\Core\Extension\ModuleHandlerInterface;
+use Drupal\Core\Lock\LockBackendInterface;
+use Drupal\Core\Session\AccountInterface;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpFoundation\RequestStack;
@@ -19,15 +29,15 @@ class CommentLockTest extends UnitTestCase {
    */
   public function testLocks() {
     $container = new ContainerBuilder();
-    $container->set('module_handler', $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface'));
-    $container->set('current_user', $this->getMock('Drupal\Core\Session\AccountInterface'));
-    $container->set('cache.test', $this->getMock('Drupal\Core\Cache\CacheBackendInterface'));
-    $container->set('comment.statistics', $this->getMock('Drupal\comment\CommentStatisticsInterface'));
+    $container->set('module_handler', $this->getMock(ModuleHandlerInterface::class));
+    $container->set('current_user', $this->getMock(AccountInterface::class));
+    $container->set('cache.test', $this->getMock(CacheBackendInterface::class));
+    $container->set('comment.statistics', $this->getMock(CommentStatisticsInterface::class));
     $request_stack = new RequestStack();
     $request_stack->push(Request::create('/'));
     $container->set('request_stack', $request_stack);
     $container->setParameter('cache_bins', ['cache.test' => 'test']);
-    $lock = $this->getMock('Drupal\Core\Lock\LockBackendInterface');
+    $lock = $this->getMock(LockBackendInterface::class);
     $cid = 2;
     $lock_name = "comment:$cid:.00/";
     $lock->expects($this->at(0))
@@ -41,7 +51,7 @@ public function testLocks() {
       ->method($this->anything());
     $container->set('lock', $lock);
 
-    $cache_tag_invalidator = $this->getMock('Drupal\Core\Cache\CacheTagsInvalidator');
+    $cache_tag_invalidator = $this->getMock(CacheTagsInvalidator::class);
     $container->set('cache_tags.invalidator', $cache_tag_invalidator);
 
     \Drupal::setContainer($container);
@@ -49,7 +59,7 @@ public function testLocks() {
     unset($methods[array_search('preSave', $methods)]);
     unset($methods[array_search('postSave', $methods)]);
     $methods[] = 'invalidateTagsOnSave';
-    $comment = $this->getMockBuilder('Drupal\comment\Entity\Comment')
+    $comment = $this->getMockBuilder(Comment::class)
       ->disableOriginalConstructor()
       ->setMethods($methods)
       ->getMock();
@@ -69,7 +79,7 @@ public function testLocks() {
       ->method('getThread')
       ->will($this->returnValue(''));
 
-    $parent_entity = $this->getMock('\Drupal\Core\Entity\ContentEntityInterface');
+    $parent_entity = $this->getMock(ContentEntityInterface::class);
     $parent_entity->expects($this->atLeastOnce())
       ->method('getCacheTagsToInvalidate')
       ->willReturn(['node:1']);
@@ -77,7 +87,7 @@ public function testLocks() {
       ->method('getCommentedEntity')
       ->willReturn($parent_entity);
 
-    $entity_type = $this->getMock('\Drupal\Core\Entity\EntityTypeInterface');
+    $entity_type = $this->getMock(EntityTypeInterface::class);
     $comment->expects($this->any())
       ->method('getEntityType')
       ->will($this->returnValue($entity_type));
@@ -85,7 +95,7 @@ public function testLocks() {
       ->method('get')
       ->with('status')
       ->will($this->returnValue((object) ['value' => NULL]));
-    $storage = $this->getMock('Drupal\comment\CommentStorageInterface');
+    $storage = $this->getMock(CommentStorageInterface::class);
 
     // preSave() should acquire the lock. (This is what's really being tested.)
     $comment->preSave($storage);
diff --git a/core/modules/config_translation/tests/src/Unit/ConfigEntityMapperTest.php b/core/modules/config_translation/tests/src/Unit/ConfigEntityMapperTest.php
index 11e72c2..8efbf71 100644
--- a/core/modules/config_translation/tests/src/Unit/ConfigEntityMapperTest.php
+++ b/core/modules/config_translation/tests/src/Unit/ConfigEntityMapperTest.php
@@ -3,7 +3,15 @@
 namespace Drupal\Tests\config_translation\Unit;
 
 use Drupal\config_translation\ConfigEntityMapper;
+use Drupal\config_translation\ConfigMapperManagerInterface;
+use Drupal\Core\Config\TypedConfigManagerInterface;
+use Drupal\Core\Config\Entity\ConfigEntityInterface;
+use Drupal\Core\Config\Entity\ConfigEntityTypeInterface;
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Language\LanguageManagerInterface;
+use Drupal\Core\Routing\RouteProviderInterface;
 use Drupal\Core\Url;
+use Drupal\locale\LocaleConfigManager;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\Routing\Route;
 
@@ -50,11 +58,11 @@ class ConfigEntityMapperTest extends UnitTestCase {
   protected $languageManager;
 
   protected function setUp() {
-    $this->entityManager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
+    $this->entityManager = $this->getMock(EntityManagerInterface::class);
 
-    $this->entity = $this->getMock('Drupal\Core\Config\Entity\ConfigEntityInterface');
+    $this->entity = $this->getMock(ConfigEntityInterface::class);
 
-    $this->routeProvider = $this->getMock('Drupal\Core\Routing\RouteProviderInterface');
+    $this->routeProvider = $this->getMock(RouteProviderInterface::class);
 
     $this->routeProvider
       ->expects($this->any())
@@ -71,13 +79,13 @@ protected function setUp() {
       'route_name' => 'config_translation.item.overview.entity.configurable_language.edit_form',
     ];
 
-    $typed_config_manager = $this->getMock('Drupal\Core\Config\TypedConfigManagerInterface');
+    $typed_config_manager = $this->getMock(TypedConfigManagerInterface::class);
 
-    $locale_config_manager = $this->getMockBuilder('Drupal\locale\LocaleConfigManager')
+    $locale_config_manager = $this->getMockBuilder(LocaleConfigManager::class)
       ->disableOriginalConstructor()
       ->getMock();
 
-    $this->languageManager = $this->getMock('Drupal\Core\Language\LanguageManagerInterface');
+    $this->languageManager = $this->getMock(LanguageManagerInterface::class);
 
     $this->configEntityMapper = new ConfigEntityMapper(
       'configurable_language',
@@ -85,7 +93,7 @@ protected function setUp() {
       $this->getConfigFactoryStub(),
       $typed_config_manager,
       $locale_config_manager,
-      $this->getMock('Drupal\config_translation\ConfigMapperManagerInterface'),
+      $this->getMock(ConfigMapperManagerInterface::class),
       $this->routeProvider,
       $this->getStringTranslationStub(),
       $this->entityManager,
@@ -103,7 +111,7 @@ public function testEntityGetterAndSetter() {
       ->with()
       ->will($this->returnValue('entity_id'));
 
-    $entity_type = $this->getMock('Drupal\Core\Config\Entity\ConfigEntityTypeInterface');
+    $entity_type = $this->getMock(ConfigEntityTypeInterface::class);
     $entity_type
       ->expects($this->any())
       ->method('getConfigPrefix')
@@ -136,7 +144,7 @@ public function testEntityGetterAndSetter() {
    * Tests ConfigEntityMapper::getOverviewRouteParameters().
    */
   public function testGetOverviewRouteParameters() {
-    $entity_type = $this->getMock('Drupal\Core\Config\Entity\ConfigEntityTypeInterface');
+    $entity_type = $this->getMock(ConfigEntityTypeInterface::class);
     $this->entityManager
       ->expects($this->once())
       ->method('getDefinition')
@@ -167,7 +175,7 @@ public function testGetType() {
    * Tests ConfigEntityMapper::getTypeName().
    */
   public function testGetTypeName() {
-    $entity_type = $this->getMock('Drupal\Core\Config\Entity\ConfigEntityTypeInterface');
+    $entity_type = $this->getMock(ConfigEntityTypeInterface::class);
     $entity_type->expects($this->once())
       ->method('getLabel')
       ->will($this->returnValue('test'));
@@ -185,7 +193,7 @@ public function testGetTypeName() {
    * Tests ConfigEntityMapper::getTypeLabel().
    */
   public function testGetTypeLabel() {
-    $entity_type = $this->getMock('Drupal\Core\Config\Entity\ConfigEntityTypeInterface');
+    $entity_type = $this->getMock(ConfigEntityTypeInterface::class);
     $entity_type->expects($this->once())
       ->method('getLabel')
       ->will($this->returnValue('test'));
diff --git a/core/modules/config_translation/tests/src/Unit/ConfigFieldMapperTest.php b/core/modules/config_translation/tests/src/Unit/ConfigFieldMapperTest.php
index 8e6d0b9..6f4b755 100644
--- a/core/modules/config_translation/tests/src/Unit/ConfigFieldMapperTest.php
+++ b/core/modules/config_translation/tests/src/Unit/ConfigFieldMapperTest.php
@@ -3,6 +3,15 @@
 namespace Drupal\Tests\config_translation\Unit;
 
 use Drupal\config_translation\ConfigFieldMapper;
+use Drupal\config_translation\ConfigMapperManagerInterface;
+use Drupal\Core\Config\Entity\ConfigEntityTypeInterface;
+use Drupal\Core\Config\TypedConfigManagerInterface;
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Language\LanguageManagerInterface;
+use Drupal\Core\Routing\RouteProviderInterface;
+use Drupal\field\FieldConfigInterface;
+use Drupal\field\FieldStorageConfigInterface;
+use Drupal\locale\LocaleConfigManager;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -39,8 +48,8 @@ class ConfigFieldMapperTest extends UnitTestCase {
    * {@inheritdoc}
    */
   protected function setUp() {
-    $this->entityManager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
-    $this->entity = $this->getMock('Drupal\field\FieldConfigInterface');
+    $this->entityManager = $this->getMock(EntityManagerInterface::class);
+    $this->entity = $this->getMock(FieldConfigInterface::class);
 
     $definition = [
       'class' => '\Drupal\config_translation\ConfigFieldMapper',
@@ -50,7 +59,7 @@ protected function setUp() {
       'entity_type' => 'field_config',
     ];
 
-    $locale_config_manager = $this->getMockBuilder('Drupal\locale\LocaleConfigManager')
+    $locale_config_manager = $this->getMockBuilder(LocaleConfigManager::class)
       ->disableOriginalConstructor()
       ->getMock();
 
@@ -58,13 +67,13 @@ protected function setUp() {
       'node_fields',
       $definition,
       $this->getConfigFactoryStub(),
-      $this->getMock('Drupal\Core\Config\TypedConfigManagerInterface'),
+      $this->getMock(TypedConfigManagerInterface::class),
       $locale_config_manager,
-      $this->getMock('Drupal\config_translation\ConfigMapperManagerInterface'),
-      $this->getMock('Drupal\Core\Routing\RouteProviderInterface'),
+      $this->getMock(ConfigMapperManagerInterface::class),
+      $this->getMock(RouteProviderInterface::class),
       $this->getStringTranslationStub(),
       $this->entityManager,
-      $this->getMock('Drupal\Core\Language\LanguageManagerInterface')
+      $this->getMock(LanguageManagerInterface::class)
     );
   }
 
@@ -74,7 +83,7 @@ protected function setUp() {
    * @covers ::setEntity
    */
   public function testSetEntity() {
-    $entity_type = $this->getMock('Drupal\Core\Config\Entity\ConfigEntityTypeInterface');
+    $entity_type = $this->getMock(ConfigEntityTypeInterface::class);
     $entity_type
       ->expects($this->any())
       ->method('getConfigPrefix')
@@ -85,7 +94,7 @@ public function testSetEntity() {
       ->method('getDefinition')
       ->will($this->returnValue($entity_type));
 
-    $field_storage = $this->getMock('Drupal\field\FieldStorageConfigInterface');
+    $field_storage = $this->getMock(FieldStorageConfigInterface::class);
     $field_storage
       ->expects($this->any())
       ->method('id')
diff --git a/core/modules/config_translation/tests/src/Unit/ConfigMapperManagerTest.php b/core/modules/config_translation/tests/src/Unit/ConfigMapperManagerTest.php
index 9f064ac..a8ecde4 100644
--- a/core/modules/config_translation/tests/src/Unit/ConfigMapperManagerTest.php
+++ b/core/modules/config_translation/tests/src/Unit/ConfigMapperManagerTest.php
@@ -3,8 +3,14 @@
 namespace Drupal\Tests\config_translation\Unit;
 
 use Drupal\config_translation\ConfigMapperManager;
+use Drupal\Core\Cache\CacheBackendInterface;
+use Drupal\Core\Config\Schema\Mapping;
+use Drupal\Core\Config\TypedConfigManagerInterface;
+use Drupal\Core\Extension\ModuleHandlerInterface;
+use Drupal\Core\Extension\ThemeHandlerInterface;
 use Drupal\Core\Language\Language;
 use Drupal\Core\Language\LanguageInterface;
+use Drupal\Core\Language\LanguageManagerInterface;
 use Drupal\Core\TypedData\TypedDataInterface;
 use Drupal\Tests\UnitTestCase;
 use Drupal\Core\TypedData\DataDefinition;
@@ -32,20 +38,20 @@ class ConfigMapperManagerTest extends UnitTestCase {
 
   protected function setUp() {
     $language = new Language(['id' => 'en']);
-    $language_manager = $this->getMock('Drupal\Core\Language\LanguageManagerInterface');
+    $language_manager = $this->getMock(LanguageManagerInterface::class);
     $language_manager->expects($this->once())
       ->method('getCurrentLanguage')
       ->with(LanguageInterface::TYPE_INTERFACE)
       ->will($this->returnValue($language));
 
-    $this->typedConfigManager = $this->getMockBuilder('Drupal\Core\Config\TypedConfigManagerInterface')
+    $this->typedConfigManager = $this->getMockBuilder(TypedConfigManagerInterface::class)
       ->getMock();
 
-    $module_handler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface');
-    $theme_handler = $this->getMock('Drupal\Core\Extension\ThemeHandlerInterface');
+    $module_handler = $this->getMock(ModuleHandlerInterface::class);
+    $theme_handler = $this->getMock(ThemeHandlerInterface::class);
 
     $this->configMapperManager = new ConfigMapperManager(
-      $this->getMock('Drupal\Core\Cache\CacheBackendInterface'),
+      $this->getMock(CacheBackendInterface::class),
       $language_manager,
       $module_handler,
       $this->typedConfigManager,
@@ -140,7 +146,7 @@ public function providerTestHasTranslatable() {
    */
   protected function getElement(array $definition) {
     $data_definition = new DataDefinition($definition);
-    $element = $this->getMock('Drupal\Core\TypedData\TypedDataInterface');
+    $element = $this->getMock(TypedDataInterface::class);
     $element->expects($this->any())
       ->method('getDataDefinition')
       ->will($this->returnValue($data_definition));
@@ -163,7 +169,7 @@ protected function getNestedElement(array $elements) {
     // in order for getIterator() to be called. Therefore we need to mock
     // \Drupal\Core\Config\Schema\ArrayElement, but that is abstract, so we
     // need to mock one of the subclasses of it.
-    $nested_element = $this->getMockBuilder('Drupal\Core\Config\Schema\Mapping')
+    $nested_element = $this->getMockBuilder(Mapping::class)
       ->disableOriginalConstructor()
       ->getMock();
     $nested_element->expects($this->once())
diff --git a/core/modules/config_translation/tests/src/Unit/ConfigNamesMapperTest.php b/core/modules/config_translation/tests/src/Unit/ConfigNamesMapperTest.php
index e7a0679..cf18d6a 100644
--- a/core/modules/config_translation/tests/src/Unit/ConfigNamesMapperTest.php
+++ b/core/modules/config_translation/tests/src/Unit/ConfigNamesMapperTest.php
@@ -7,12 +7,18 @@
 
 namespace Drupal\Tests\config_translation\Unit;
 
+use Drupal\config_translation\ConfigMapperManagerInterface;
 use Drupal\config_translation\ConfigNamesMapper;
 use Drupal\Core\Config\ConfigFactoryInterface;
+use Drupal\Core\Config\TypedConfigManagerInterface;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
 use Drupal\Core\Language\Language;
+use Drupal\Core\Language\LanguageManagerInterface;
 use Drupal\Core\Routing\RouteMatch;
+use Drupal\Core\Routing\RouteProviderInterface;
+use Drupal\Core\Routing\UrlGeneratorInterface;
 use Drupal\Core\Url;
+use Drupal\locale\LocaleConfigManager;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\Routing\Route;
 
@@ -89,7 +95,7 @@ class ConfigNamesMapperTest extends UnitTestCase {
   protected $languageManager;
 
   protected function setUp() {
-    $this->routeProvider = $this->getMock('Drupal\Core\Routing\RouteProviderInterface');
+    $this->routeProvider = $this->getMock(RouteProviderInterface::class);
 
     $this->pluginDefinition = [
       'class' => '\Drupal\config_translation\ConfigNamesMapper',
@@ -99,15 +105,15 @@ protected function setUp() {
       'weight' => 42,
     ];
 
-    $this->typedConfigManager = $this->getMock('Drupal\Core\Config\TypedConfigManagerInterface');
+    $this->typedConfigManager = $this->getMock(TypedConfigManagerInterface::class);
 
-    $this->localeConfigManager = $this->getMockBuilder('Drupal\locale\LocaleConfigManager')
+    $this->localeConfigManager = $this->getMockBuilder(LocaleConfigManager::class)
       ->disableOriginalConstructor()
       ->getMock();
 
-    $this->configMapperManager = $this->getMock('Drupal\config_translation\ConfigMapperManagerInterface');
+    $this->configMapperManager = $this->getMock(ConfigMapperManagerInterface::class);
 
-    $this->urlGenerator = $this->getMock('Drupal\Core\Routing\UrlGeneratorInterface');
+    $this->urlGenerator = $this->getMock(UrlGeneratorInterface::class);
     $container = new ContainerBuilder();
     $container->set('url_generator', $this->urlGenerator);
     \Drupal::setContainer($container);
@@ -120,7 +126,7 @@ protected function setUp() {
       ->with('system.site_information_settings')
       ->will($this->returnValue($this->baseRoute));
 
-    $this->languageManager = $this->getMock('Drupal\Core\Language\LanguageManagerInterface');
+    $this->languageManager = $this->getMock(LanguageManagerInterface::class);
 
     $this->configNamesMapper = new TestConfigNamesMapper(
       'system.site_information_settings',
diff --git a/core/modules/contact/tests/src/Unit/MailHandlerTest.php b/core/modules/contact/tests/src/Unit/MailHandlerTest.php
index 898ea22..b3baa14 100644
--- a/core/modules/contact/tests/src/Unit/MailHandlerTest.php
+++ b/core/modules/contact/tests/src/Unit/MailHandlerTest.php
@@ -2,12 +2,19 @@
 
 namespace Drupal\Tests\contact\Unit;
 
+use Drupal\contact\ContactFormInterface;
 use Drupal\contact\MailHandler;
 use Drupal\contact\MailHandlerException;
 use Drupal\contact\MessageInterface;
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Entity\EntityStorageInterface;
 use Drupal\Core\Language\Language;
+use Drupal\Core\Language\LanguageManagerInterface;
+use Drupal\Core\Mail\MailManagerInterface;
 use Drupal\Core\Session\AccountInterface;
 use Drupal\Tests\UnitTestCase;
+use Drupal\user\UserInterface;
+use Psr\Log\LoggerInterface;
 
 /**
  * @coversDefaultClass \Drupal\contact\MailHandler
@@ -69,11 +76,11 @@ class MailHandlerTest extends UnitTestCase {
    */
   protected function setUp() {
     parent::setUp();
-    $this->mailManager = $this->getMock('\Drupal\Core\Mail\MailManagerInterface');
-    $this->languageManager = $this->getMock('\Drupal\Core\Language\LanguageManagerInterface');
-    $this->logger = $this->getMock('\Psr\Log\LoggerInterface');
-    $this->entityManager = $this->getMock('\Drupal\Core\Entity\EntityManagerInterface');
-    $this->userStorage = $this->getMock('\Drupal\Core\Entity\EntityStorageInterface');
+    $this->mailManager = $this->getMock(MailManagerInterface::class);
+    $this->languageManager = $this->getMock(LanguageManagerInterface::class);
+    $this->logger = $this->getMock(LoggerInterface::class);
+    $this->entityManager = $this->getMock(EntityManagerInterface::class);
+    $this->userStorage = $this->getMock(EntityStorageInterface::class);
     $this->entityManager->expects($this->any())
       ->method('getStorage')
       ->with('user')
@@ -98,7 +105,7 @@ protected function setUp() {
    * @covers ::sendMailMessages
    */
   public function testInvalidRecipient() {
-    $message = $this->getMock('\Drupal\contact\MessageInterface');
+    $message = $this->getMock(MessageInterface::class);
     $message->expects($this->once())
       ->method('isPersonal')
       ->willReturn(TRUE);
@@ -107,8 +114,8 @@ public function testInvalidRecipient() {
       ->willReturn(NULL);
     $message->expects($this->once())
       ->method('getContactForm')
-      ->willReturn($this->getMock('\Drupal\contact\ContactFormInterface'));
-    $sender = $this->getMock('\Drupal\Core\Session\AccountInterface');
+      ->willReturn($this->getMock(ContactFormInterface::class));
+    $sender = $this->getMock(AccountInterface::class);
     $this->userStorage->expects($this->any())
       ->method('load')
       ->willReturn($sender);
@@ -290,7 +297,7 @@ public function getSendMailMessages() {
    *   Mock sender for testing.
    */
   protected function getMockSender($anonymous = TRUE, $mail_address = 'anonymous@drupal.org') {
-    $sender = $this->getMock('\Drupal\Core\Session\AccountInterface');
+    $sender = $this->getMock(AccountInterface::class);
     $sender->expects($this->once())
       ->method('isAnonymous')
       ->willReturn($anonymous);
@@ -327,7 +334,7 @@ protected function getMockSender($anonymous = TRUE, $mail_address = 'anonymous@d
    *   Mock message for testing.
    */
   protected function getAnonymousMockMessage($recipients, $auto_reply, $copy_sender = FALSE) {
-    $message = $this->getMock('\Drupal\contact\MessageInterface');
+    $message = $this->getMock(MessageInterface::class);
     $message->expects($this->any())
       ->method('getSenderName')
       ->willReturn('Anonymous');
@@ -356,14 +363,14 @@ protected function getAnonymousMockMessage($recipients, $auto_reply, $copy_sende
    *   Mock message for testing.
    */
   protected function getAuthenticatedMockMessage($copy_sender = FALSE) {
-    $message = $this->getMock('\Drupal\contact\MessageInterface');
+    $message = $this->getMock(MessageInterface::class);
     $message->expects($this->any())
       ->method('isPersonal')
       ->willReturn(TRUE);
     $message->expects($this->once())
       ->method('copySender')
       ->willReturn($copy_sender);
-    $recipient = $this->getMock('\Drupal\user\UserInterface');
+    $recipient = $this->getMock(UserInterface::class);
     $recipient->expects($this->once())
       ->method('getEmail')
       ->willReturn('user2@drupal.org');
@@ -394,7 +401,7 @@ protected function getAuthenticatedMockMessage($copy_sender = FALSE) {
    *   Mock message for testing.
    */
   protected function getMockContactForm($recipients, $auto_reply) {
-    $contact_form = $this->getMock('\Drupal\contact\ContactFormInterface');
+    $contact_form = $this->getMock(ContactFormInterface::class);
     $contact_form->expects($this->once())
       ->method('getRecipients')
       ->willReturn($recipients);
diff --git a/core/modules/content_translation/tests/src/Unit/Access/ContentTranslationManageAccessCheckTest.php b/core/modules/content_translation/tests/src/Unit/Access/ContentTranslationManageAccessCheckTest.php
index ad7317f..d07faea 100644
--- a/core/modules/content_translation/tests/src/Unit/Access/ContentTranslationManageAccessCheckTest.php
+++ b/core/modules/content_translation/tests/src/Unit/Access/ContentTranslationManageAccessCheckTest.php
@@ -2,11 +2,18 @@
 
 namespace Drupal\Tests\content_translation\Unit\Access;
 
+use Drupal\content_translation\ContentTranslationHandlerInterface;
 use Drupal\content_translation\Access\ContentTranslationManageAccessCheck;
 use Drupal\Core\Access\AccessResult;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
 use Drupal\Core\Cache\Cache;
+use Drupal\Core\Cache\Context\CacheContextsManager;
+use Drupal\Core\Entity\ContentEntityBase;
+use Drupal\Core\Entity\EntityManagerInterface;
 use Drupal\Core\Language\Language;
+use Drupal\Core\Language\LanguageManagerInterface;
+use Drupal\Core\Routing\RouteMatchInterface;
+use Drupal\Core\Session\AccountInterface;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\Routing\Route;
 
@@ -32,7 +39,7 @@ class ContentTranslationManageAccessCheckTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $this->cacheContextsManager = $this->getMockBuilder('Drupal\Core\Cache\Context\CacheContextsManager')
+    $this->cacheContextsManager = $this->getMockBuilder(CacheContextsManager::class)
       ->disableOriginalConstructor()
       ->getMock();
     $this->cacheContextsManager->method('assertValidTokens')->willReturn(TRUE);
@@ -49,12 +56,12 @@ protected function setUp() {
    */
   public function testCreateAccess() {
     // Set the mock translation handler.
-    $translation_handler = $this->getMock('\Drupal\content_translation\ContentTranslationHandlerInterface');
+    $translation_handler = $this->getMock(ContentTranslationHandlerInterface::class);
     $translation_handler->expects($this->once())
       ->method('getTranslationAccess')
       ->will($this->returnValue(AccessResult::allowed()));
 
-    $entity_manager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
+    $entity_manager = $this->getMock(EntityManagerInterface::class);
     $entity_manager->expects($this->once())
       ->method('getHandler')
       ->withAnyParameters()
@@ -65,7 +72,7 @@ public function testCreateAccess() {
     $target = 'it';
 
     // Set the mock language manager.
-    $language_manager = $this->getMock('Drupal\Core\Language\LanguageManagerInterface');
+    $language_manager = $this->getMock(LanguageManagerInterface::class);
     $language_manager->expects($this->at(0))
       ->method('getLanguage')
       ->with($this->equalTo($source))
@@ -84,7 +91,7 @@ public function testCreateAccess() {
 
     // Set the mock entity. We need to use ContentEntityBase for mocking due to
     // issues with phpunit and multiple interfaces.
-    $entity = $this->getMockBuilder('Drupal\Core\Entity\ContentEntityBase')
+    $entity = $this->getMockBuilder(ContentEntityBase::class)
       ->disableOriginalConstructor()
       ->getMock();
     $entity->expects($this->once())
@@ -111,14 +118,14 @@ public function testCreateAccess() {
     $route->setRequirement('_access_content_translation_manage', 'create');
 
     // Set up the route match.
-    $route_match = $this->getMock('Drupal\Core\Routing\RouteMatchInterface');
+    $route_match = $this->getMock(RouteMatchInterface::class);
     $route_match->expects($this->once())
       ->method('getParameter')
       ->with('node')
       ->will($this->returnValue($entity));
 
     // Set the mock account.
-    $account = $this->getMock('Drupal\Core\Session\AccountInterface');
+    $account = $this->getMock(AccountInterface::class);
 
     // The access check under test.
     $check = new ContentTranslationManageAccessCheck($entity_manager, $language_manager);
diff --git a/core/modules/content_translation/tests/src/Unit/Menu/ContentTranslationLocalTasksTest.php b/core/modules/content_translation/tests/src/Unit/Menu/ContentTranslationLocalTasksTest.php
index a72d9b7..f8daa00 100644
--- a/core/modules/content_translation/tests/src/Unit/Menu/ContentTranslationLocalTasksTest.php
+++ b/core/modules/content_translation/tests/src/Unit/Menu/ContentTranslationLocalTasksTest.php
@@ -2,6 +2,8 @@
 
 namespace Drupal\Tests\content_translation\Unit\Menu;
 
+use Drupal\content_translation\ContentTranslationManagerInterface;
+use Drupal\Core\Entity\EntityTypeInterface;
 use Drupal\Tests\Core\Menu\LocalTaskIntegrationTestBase;
 
 /**
@@ -18,14 +20,14 @@ protected function setUp() {
     ];
     parent::setUp();
 
-    $entity_type = $this->getMock('Drupal\Core\Entity\EntityTypeInterface');
+    $entity_type = $this->getMock(EntityTypeInterface::class);
     $entity_type->expects($this->any())
       ->method('getLinkTemplate')
       ->will($this->returnValueMap([
         ['canonical', 'entity.node.canonical'],
         ['drupal:content-translation-overview', 'entity.node.content_translation_overview'],
       ]));
-    $content_translation_manager = $this->getMock('Drupal\content_translation\ContentTranslationManagerInterface');
+    $content_translation_manager = $this->getMock(ContentTranslationManagerInterface::class);
     $content_translation_manager->expects($this->any())
       ->method('getSupportedEntityTypes')
       ->will($this->returnValue([
diff --git a/core/modules/datetime/tests/src/Unit/Plugin/migrate/field/d6/DateFieldTest.php b/core/modules/datetime/tests/src/Unit/Plugin/migrate/field/d6/DateFieldTest.php
index b8b545a..3de7e0b 100644
--- a/core/modules/datetime/tests/src/Unit/Plugin/migrate/field/d6/DateFieldTest.php
+++ b/core/modules/datetime/tests/src/Unit/Plugin/migrate/field/d6/DateFieldTest.php
@@ -4,6 +4,7 @@
 
 use Drupal\datetime\Plugin\migrate\field\d6\DateField;
 use Drupal\migrate\MigrateException;
+use Drupal\migrate\Plugin\MigrationInterface;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -25,7 +26,7 @@ class DateFieldTest extends UnitTestCase {
    * Tests an Exception is thrown when the field type is not a known date type.
    */
   public function testUnknownDateType() {
-    $this->migration = $this->prophesize('Drupal\migrate\Plugin\MigrationInterface')->reveal();
+    $this->migration = $this->prophesize(MigrationInterface::class)->reveal();
     $this->plugin = new DateField([], '', []);
 
     $this->setExpectedException(MigrateException::class, "Field field_date of type 'timestamp' is an unknown date field type.");
diff --git a/core/modules/editor/tests/src/Unit/EditorConfigEntityUnitTest.php b/core/modules/editor/tests/src/Unit/EditorConfigEntityUnitTest.php
index 4e96f4a..9e7fae9 100644
--- a/core/modules/editor/tests/src/Unit/EditorConfigEntityUnitTest.php
+++ b/core/modules/editor/tests/src/Unit/EditorConfigEntityUnitTest.php
@@ -2,8 +2,15 @@
 
 namespace Drupal\Tests\editor\Unit;
 
+use Drupal\Component\Uuid\UuidInterface;
+use Drupal\Core\Config\Entity\ConfigEntityInterface;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Entity\EntityStorageInterface;
+use Drupal\Core\Entity\EntityTypeInterface;
 use Drupal\editor\Entity\Editor;
+use Drupal\editor\Plugin\EditorManager;
+use Drupal\editor\Plugin\EditorPluginInterface;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -61,20 +68,20 @@ protected function setUp() {
     $this->editorId = $this->randomMachineName();
     $this->entityTypeId = $this->randomMachineName();
 
-    $this->entityType = $this->getMock('\Drupal\Core\Entity\EntityTypeInterface');
+    $this->entityType = $this->getMock(EntityTypeInterface::class);
     $this->entityType->expects($this->any())
       ->method('getProvider')
       ->will($this->returnValue('editor'));
 
-    $this->entityManager = $this->getMock('\Drupal\Core\Entity\EntityManagerInterface');
+    $this->entityManager = $this->getMock(EntityManagerInterface::class);
     $this->entityManager->expects($this->any())
       ->method('getDefinition')
       ->with($this->entityTypeId)
       ->will($this->returnValue($this->entityType));
 
-    $this->uuid = $this->getMock('\Drupal\Component\Uuid\UuidInterface');
+    $this->uuid = $this->getMock(UuidInterface::class);
 
-    $this->editorPluginManager = $this->getMockBuilder('Drupal\editor\Plugin\EditorManager')
+    $this->editorPluginManager = $this->getMockBuilder(EditorManager::class)
       ->disableOriginalConstructor()
       ->getMock();
 
@@ -92,7 +99,7 @@ public function testCalculateDependencies() {
     $format_id = 'filter.format.test';
     $values = ['editor' => $this->editorId, 'format' => $format_id];
 
-    $plugin = $this->getMockBuilder('Drupal\editor\Plugin\EditorPluginInterface')
+    $plugin = $this->getMockBuilder(EditorPluginInterface::class)
       ->disableOriginalConstructor()
       ->getMock();
     $plugin->expects($this->once())
@@ -109,12 +116,12 @@ public function testCalculateDependencies() {
 
     $entity = new Editor($values, $this->entityTypeId);
 
-    $filter_format = $this->getMock('Drupal\Core\Config\Entity\ConfigEntityInterface');
+    $filter_format = $this->getMock(ConfigEntityInterface::class);
     $filter_format->expects($this->once())
       ->method('getConfigDependencyName')
       ->will($this->returnValue('filter.format.test'));
 
-    $storage = $this->getMock('Drupal\Core\Entity\EntityStorageInterface');
+    $storage = $this->getMock(EntityStorageInterface::class);
     $storage->expects($this->once())
       ->method('load')
       ->with($format_id)
diff --git a/core/modules/editor/tests/src/Unit/EditorXssFilter/StandardTest.php b/core/modules/editor/tests/src/Unit/EditorXssFilter/StandardTest.php
index ce63092..8f59a93 100644
--- a/core/modules/editor/tests/src/Unit/EditorXssFilter/StandardTest.php
+++ b/core/modules/editor/tests/src/Unit/EditorXssFilter/StandardTest.php
@@ -3,6 +3,7 @@
 namespace Drupal\Tests\editor\Unit\EditorXssFilter;
 
 use Drupal\editor\EditorXssFilter\Standard;
+use Drupal\filter\Entity\FilterFormat;
 use Drupal\Tests\UnitTestCase;
 use Drupal\filter\Plugin\FilterInterface;
 
@@ -22,7 +23,7 @@ class StandardTest extends UnitTestCase {
   protected function setUp() {
 
     // Mock text format configuration entity object.
-    $this->format = $this->getMockBuilder('\Drupal\filter\Entity\FilterFormat')
+    $this->format = $this->getMockBuilder(FilterFormat::class)
       ->disableOriginalConstructor()
       ->getMock();
     $this->format->expects($this->any())
diff --git a/core/modules/field/tests/src/Unit/FieldConfigEntityUnitTest.php b/core/modules/field/tests/src/Unit/FieldConfigEntityUnitTest.php
index d1824cf..d418abf 100644
--- a/core/modules/field/tests/src/Unit/FieldConfigEntityUnitTest.php
+++ b/core/modules/field/tests/src/Unit/FieldConfigEntityUnitTest.php
@@ -7,9 +7,17 @@
 
 namespace Drupal\Tests\field\Unit;
 
+use Drupal\Component\Uuid\UuidInterface;
+use Drupal\Core\Config\Entity\ConfigEntityStorageInterface;
+use Drupal\Core\Config\TypedConfigManagerInterface;
+use Drupal\Core\Config\Entity\ConfigEntityTypeInterface;
+use Drupal\Core\Entity\EntityManagerInterface;
 use Drupal\Core\Entity\EntityType;
+use Drupal\Core\Entity\EntityTypeInterface;
 use Drupal\Core\Field\FieldDefinitionInterface;
+use Drupal\Core\Field\FieldTypePluginManagerInterface;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
+use Drupal\field\FieldStorageConfigInterface;
 use Drupal\field\Entity\FieldConfig;
 use Drupal\Tests\UnitTestCase;
 
@@ -73,15 +81,15 @@ class FieldConfigEntityUnitTest extends UnitTestCase {
    */
   protected function setUp() {
     $this->entityTypeId = $this->randomMachineName();
-    $this->entityType = $this->getMock('\Drupal\Core\Config\Entity\ConfigEntityTypeInterface');
+    $this->entityType = $this->getMock(ConfigEntityTypeInterface::class);
 
-    $this->entityManager = $this->getMock('\Drupal\Core\Entity\EntityManagerInterface');
+    $this->entityManager = $this->getMock(EntityManagerInterface::class);
 
-    $this->uuid = $this->getMock('\Drupal\Component\Uuid\UuidInterface');
+    $this->uuid = $this->getMock(UuidInterface::class);
 
-    $this->typedConfigManager = $this->getMock('Drupal\Core\Config\TypedConfigManagerInterface');
+    $this->typedConfigManager = $this->getMock(TypedConfigManagerInterface::class);
 
-    $this->fieldTypePluginManager = $this->getMock('Drupal\Core\Field\FieldTypePluginManagerInterface');
+    $this->fieldTypePluginManager = $this->getMock(FieldTypePluginManagerInterface::class);
 
     $container = new ContainerBuilder();
     $container->set('entity.manager', $this->entityManager);
@@ -91,7 +99,7 @@ protected function setUp() {
     \Drupal::setContainer($container);
 
     // Create a mock FieldStorageConfig object.
-    $this->fieldStorage = $this->getMock('\Drupal\field\FieldStorageConfigInterface');
+    $this->fieldStorage = $this->getMock(FieldStorageConfigInterface::class);
     $this->fieldStorage->expects($this->any())
       ->method('getType')
       ->will($this->returnValue('test_field'));
@@ -115,7 +123,7 @@ protected function setUp() {
    */
   public function testCalculateDependencies() {
     // Mock the interfaces necessary to create a dependency on a bundle entity.
-    $target_entity_type = $this->getMock('\Drupal\Core\Entity\EntityTypeInterface');
+    $target_entity_type = $this->getMock(EntityTypeInterface::class);
     $target_entity_type->expects($this->any())
       ->method('getBundleConfigDependency')
       ->will($this->returnValue(['type' => 'config', 'name' => 'test.test_entity_type.id']));
@@ -162,7 +170,7 @@ public function testCalculateDependencies() {
    * Test that invalid bundles are handled.
    */
   public function testCalculateDependenciesIncorrectBundle() {
-    $storage = $this->getMock('\Drupal\Core\Config\Entity\ConfigEntityStorageInterface');
+    $storage = $this->getMock(ConfigEntityStorageInterface::class);
     $storage->expects($this->any())
       ->method('load')
       ->with('test_bundle_not_exists')
diff --git a/core/modules/field/tests/src/Unit/FieldStorageConfigEntityUnitTest.php b/core/modules/field/tests/src/Unit/FieldStorageConfigEntityUnitTest.php
index 89b7396..99d4d59 100644
--- a/core/modules/field/tests/src/Unit/FieldStorageConfigEntityUnitTest.php
+++ b/core/modules/field/tests/src/Unit/FieldStorageConfigEntityUnitTest.php
@@ -7,7 +7,11 @@
 
 namespace Drupal\Tests\field\Unit;
 
+use Drupal\Component\Uuid\UuidInterface;
+use Drupal\Core\Config\Entity\ConfigEntityTypeInterface;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Entity\EntityTypeInterface;
 use Drupal\Core\Field\FieldException;
 use Drupal\Core\Field\FieldStorageDefinitionInterface;
 use Drupal\Core\Field\FieldTypePluginManagerInterface;
@@ -53,8 +57,8 @@ class FieldStorageConfigEntityUnitTest extends UnitTestCase {
    * {@inheritdoc}
    */
   protected function setUp() {
-    $this->entityManager = $this->getMock('\Drupal\Core\Entity\EntityManagerInterface');
-    $this->uuid = $this->getMock('\Drupal\Component\Uuid\UuidInterface');
+    $this->entityManager = $this->getMock(EntityManagerInterface::class);
+    $this->uuid = $this->getMock(UuidInterface::class);
     $this->fieldTypeManager = $this->getMock(FieldTypePluginManagerInterface::class);
 
     $container = new ContainerBuilder();
@@ -69,14 +73,14 @@ protected function setUp() {
    */
   public function testCalculateDependencies() {
     // Create a mock entity type for FieldStorageConfig.
-    $fieldStorageConfigentityType = $this->getMock('\Drupal\Core\Config\Entity\ConfigEntityTypeInterface');
+    $fieldStorageConfigentityType = $this->getMock(ConfigEntityTypeInterface::class);
     $fieldStorageConfigentityType->expects($this->any())
       ->method('getProvider')
       ->will($this->returnValue('field'));
 
     // Create a mock entity type to attach the field to.
     $attached_entity_type_id = $this->randomMachineName();
-    $attached_entity_type = $this->getMock('\Drupal\Core\Entity\EntityTypeInterface');
+    $attached_entity_type = $this->getMock(EntityTypeInterface::class);
     $attached_entity_type->expects($this->any())
       ->method('getProvider')
       ->will($this->returnValue('entity_provider_module'));
diff --git a/core/modules/field/tests/src/Unit/FieldUninstallValidatorTest.php b/core/modules/field/tests/src/Unit/FieldUninstallValidatorTest.php
index c238b95..c065af4 100644
--- a/core/modules/field/tests/src/Unit/FieldUninstallValidatorTest.php
+++ b/core/modules/field/tests/src/Unit/FieldUninstallValidatorTest.php
@@ -2,6 +2,8 @@
 
 namespace Drupal\Tests\field\Unit;
 
+use Drupal\field\Entity\FieldStorageConfig;
+use Drupal\field\FieldUninstallValidator;
 use Drupal\simpletest\AssertHelperTrait;
 use Drupal\Tests\UnitTestCase;
 
@@ -30,7 +32,7 @@ class FieldUninstallValidatorTest extends UnitTestCase {
    */
   protected function setUp() {
     parent::setUp();
-    $this->fieldUninstallValidator = $this->getMockBuilder('Drupal\field\FieldUninstallValidator')
+    $this->fieldUninstallValidator = $this->getMockBuilder(FieldUninstallValidator::class)
       ->disableOriginalConstructor()
       ->setMethods(['getFieldStoragesByModule', 'getFieldTypeLabel'])
       ->getMock();
@@ -55,7 +57,7 @@ public function testValidateNoStorages() {
    * @covers ::validate
    */
   public function testValidateDeleted() {
-    $field_storage = $this->getMockBuilder('Drupal\field\Entity\FieldStorageConfig')
+    $field_storage = $this->getMockBuilder(FieldStorageConfig::class)
       ->disableOriginalConstructor()
       ->getMock();
     $field_storage->expects($this->once())
@@ -75,7 +77,7 @@ public function testValidateDeleted() {
    * @covers ::validate
    */
   public function testValidateNoDeleted() {
-    $field_storage = $this->getMockBuilder('Drupal\field\Entity\FieldStorageConfig')
+    $field_storage = $this->getMockBuilder(FieldStorageConfig::class)
       ->disableOriginalConstructor()
       ->getMock();
     $field_storage->expects($this->once())
diff --git a/core/modules/field_ui/tests/src/Unit/FieldUiTest.php b/core/modules/field_ui/tests/src/Unit/FieldUiTest.php
index 19e1244..c4ab18a 100644
--- a/core/modules/field_ui/tests/src/Unit/FieldUiTest.php
+++ b/core/modules/field_ui/tests/src/Unit/FieldUiTest.php
@@ -3,6 +3,7 @@
 namespace Drupal\Tests\field_ui\Unit;
 
 use Drupal\Core\DependencyInjection\ContainerBuilder;
+use Drupal\Core\Path\PathValidatorInterface;
 use Drupal\field_ui\FieldUI;
 use Drupal\Tests\UnitTestCase;
 
@@ -26,7 +27,7 @@ class FieldUiTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $this->pathValidator = $this->getMock('Drupal\Core\Path\PathValidatorInterface');
+    $this->pathValidator = $this->getMock(PathValidatorInterface::class);
     $container = new ContainerBuilder();
     $container->set('path.validator', $this->pathValidator);
     \Drupal::setContainer($container);
diff --git a/core/modules/filter/tests/src/Unit/FilterUninstallValidatorTest.php b/core/modules/filter/tests/src/Unit/FilterUninstallValidatorTest.php
index 85de742..51d53a5 100644
--- a/core/modules/filter/tests/src/Unit/FilterUninstallValidatorTest.php
+++ b/core/modules/filter/tests/src/Unit/FilterUninstallValidatorTest.php
@@ -2,6 +2,10 @@
 
 namespace Drupal\Tests\filter\Unit;
 
+use Drupal\filter\FilterFormatInterface;
+use Drupal\filter\FilterPluginCollection;
+use Drupal\filter\FilterUninstallValidator;
+use Drupal\filter\Plugin\FilterBase;
 use Drupal\simpletest\AssertHelperTrait;
 use Drupal\Tests\UnitTestCase;
 
@@ -23,7 +27,7 @@ class FilterUninstallValidatorTest extends UnitTestCase {
    */
   protected function setUp() {
     parent::setUp();
-    $this->filterUninstallValidator = $this->getMockBuilder('Drupal\filter\FilterUninstallValidator')
+    $this->filterUninstallValidator = $this->getMockBuilder(FilterUninstallValidator::class)
       ->disableOriginalConstructor()
       ->setMethods(['getFilterDefinitionsByProvider', 'getEnabledFilterFormats'])
       ->getMock();
@@ -93,12 +97,12 @@ public function testValidateNoMatchingFormats() {
         ],
       ]);
 
-    $filter_plugin_enabled = $this->getMockForAbstractClass('Drupal\filter\Plugin\FilterBase', [['status' => TRUE], '', ['provider' => 'filter_test']]);
-    $filter_plugin_disabled = $this->getMockForAbstractClass('Drupal\filter\Plugin\FilterBase', [['status' => FALSE], '', ['provider' => 'filter_test']]);
+    $filter_plugin_enabled = $this->getMockForAbstractClass(FilterBase::class, [['status' => TRUE], '', ['provider' => 'filter_test']]);
+    $filter_plugin_disabled = $this->getMockForAbstractClass(FilterBase::class, [['status' => FALSE], '', ['provider' => 'filter_test']]);
 
     // The first format has 2 matching and enabled filters, but the loop breaks
     // after finding the first one.
-    $filter_plugin_collection1 = $this->getMockBuilder('Drupal\filter\FilterPluginCollection')
+    $filter_plugin_collection1 = $this->getMockBuilder(FilterPluginCollection::class)
       ->disableOriginalConstructor()
       ->getMock();
     $filter_plugin_collection1->expects($this->exactly(3))
@@ -117,7 +121,7 @@ public function testValidateNoMatchingFormats() {
         ['test_filter_plugin4', $filter_plugin_enabled],
       ]);
 
-    $filter_format1 = $this->getMock('Drupal\filter\FilterFormatInterface');
+    $filter_format1 = $this->getMock(FilterFormatInterface::class);
     $filter_format1->expects($this->once())
       ->method('filters')
       ->willReturn($filter_plugin_collection1);
@@ -126,7 +130,7 @@ public function testValidateNoMatchingFormats() {
       ->willReturn('Filter Format 1 Label');
 
     // The second filter format only has one matching and enabled filter.
-    $filter_plugin_collection2 = $this->getMockBuilder('Drupal\filter\FilterPluginCollection')
+    $filter_plugin_collection2 = $this->getMockBuilder(FilterPluginCollection::class)
       ->disableOriginalConstructor()
       ->getMock();
     $filter_plugin_collection2->expects($this->exactly(4))
@@ -142,7 +146,7 @@ public function testValidateNoMatchingFormats() {
       ->with('test_filter_plugin4')
       ->willReturn($filter_plugin_enabled);
 
-    $filter_format2 = $this->getMock('Drupal\filter\FilterFormatInterface');
+    $filter_format2 = $this->getMock(FilterFormatInterface::class);
     $filter_format2->expects($this->once())
       ->method('filters')
       ->willReturn($filter_plugin_collection2);
diff --git a/core/modules/forum/tests/src/Unit/Breadcrumb/ForumBreadcrumbBuilderBaseTest.php b/core/modules/forum/tests/src/Unit/Breadcrumb/ForumBreadcrumbBuilderBaseTest.php
index abc1122..cdfbb9e 100644
--- a/core/modules/forum/tests/src/Unit/Breadcrumb/ForumBreadcrumbBuilderBaseTest.php
+++ b/core/modules/forum/tests/src/Unit/Breadcrumb/ForumBreadcrumbBuilderBaseTest.php
@@ -3,7 +3,15 @@
 namespace Drupal\Tests\forum\Unit\Breadcrumb;
 
 use Drupal\Core\Cache\Cache;
+use Drupal\Core\Cache\Context\CacheContextsManager;
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Entity\EntityStorageInterface;
 use Drupal\Core\Link;
+use Drupal\Core\Routing\RouteMatchInterface;
+use Drupal\Core\StringTranslation\TranslationInterface;
+use Drupal\forum\Breadcrumb\ForumBreadcrumbBuilderBase;
+use Drupal\forum\ForumManagerInterface;
+use Drupal\taxonomy\VocabularyInterface;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\DependencyInjection\Container;
 
@@ -19,7 +27,7 @@ class ForumBreadcrumbBuilderBaseTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $cache_contexts_manager = $this->getMockBuilder('Drupal\Core\Cache\Context\CacheContextsManager')
+    $cache_contexts_manager = $this->getMockBuilder(CacheContextsManager::class)
       ->disableOriginalConstructor()
       ->getMock();
     $cache_contexts_manager->method('assertValidTokens')->willReturn(TRUE);
@@ -35,18 +43,18 @@ protected function setUp() {
    */
   public function testConstructor() {
     // Make some test doubles.
-    $entity_manager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
+    $entity_manager = $this->getMock(EntityManagerInterface::class);
     $config_factory = $this->getConfigFactoryStub(
       [
         'forum.settings' => ['IAmATestKey' => 'IAmATestValue'],
       ]
     );
-    $forum_manager = $this->getMock('Drupal\forum\ForumManagerInterface');
-    $translation_manager = $this->getMock('Drupal\Core\StringTranslation\TranslationInterface');
+    $forum_manager = $this->getMock(ForumManagerInterface::class);
+    $translation_manager = $this->getMock(TranslationInterface::class);
 
     // Make an object to test.
     $builder = $this->getMockForAbstractClass(
-      'Drupal\forum\Breadcrumb\ForumBreadcrumbBuilderBase',
+      ForumBreadcrumbBuilderBase::class,
       // Constructor array.
       [
         $entity_manager,
@@ -85,29 +93,29 @@ public function testConstructor() {
    */
   public function testBuild() {
     // Build all our dependencies, backwards.
-    $translation_manager = $this->getMockBuilder('Drupal\Core\StringTranslation\TranslationInterface')
+    $translation_manager = $this->getMockBuilder(TranslationInterface::class)
       ->disableOriginalConstructor()
       ->getMock();
 
-    $forum_manager = $this->getMockBuilder('Drupal\forum\ForumManagerInterface')
+    $forum_manager = $this->getMockBuilder(ForumManagerInterface::class)
       ->disableOriginalConstructor()
       ->getMock();
 
-    $prophecy = $this->prophesize('Drupal\taxonomy\VocabularyInterface');
+    $prophecy = $this->prophesize(VocabularyInterface::class);
     $prophecy->label()->willReturn('Fora_is_the_plural_of_forum');
     $prophecy->id()->willReturn(5);
     $prophecy->getCacheTags()->willReturn(['taxonomy_vocabulary:5']);
     $prophecy->getCacheContexts()->willReturn([]);
     $prophecy->getCacheMaxAge()->willReturn(Cache::PERMANENT);
 
-    $vocab_storage = $this->getMock('Drupal\Core\Entity\EntityStorageInterface');
+    $vocab_storage = $this->getMock(EntityStorageInterface::class);
     $vocab_storage->expects($this->any())
       ->method('load')
       ->will($this->returnValueMap([
         ['forums', $prophecy->reveal()],
       ]));
 
-    $entity_manager = $this->getMockBuilder('Drupal\Core\Entity\EntityManagerInterface')
+    $entity_manager = $this->getMockBuilder(EntityManagerInterface::class)
       ->disableOriginalConstructor()
       ->getMock();
     $entity_manager->expects($this->any())
@@ -126,7 +134,7 @@ public function testBuild() {
 
     // Build a breadcrumb builder to test.
     $breadcrumb_builder = $this->getMockForAbstractClass(
-      'Drupal\forum\Breadcrumb\ForumBreadcrumbBuilderBase',
+      ForumBreadcrumbBuilderBase::class,
       // Constructor array.
       [
         $entity_manager,
@@ -141,7 +149,7 @@ public function testBuild() {
     $breadcrumb_builder->setStringTranslation($translation_manager);
 
     // Our empty data set.
-    $route_match = $this->getMock('Drupal\Core\Routing\RouteMatchInterface');
+    $route_match = $this->getMock(RouteMatchInterface::class);
 
     // Expected result set.
     $expected = [
diff --git a/core/modules/forum/tests/src/Unit/Breadcrumb/ForumListingBreadcrumbBuilderTest.php b/core/modules/forum/tests/src/Unit/Breadcrumb/ForumListingBreadcrumbBuilderTest.php
index 45566f2..2f9f86a 100644
--- a/core/modules/forum/tests/src/Unit/Breadcrumb/ForumListingBreadcrumbBuilderTest.php
+++ b/core/modules/forum/tests/src/Unit/Breadcrumb/ForumListingBreadcrumbBuilderTest.php
@@ -3,7 +3,16 @@
 namespace Drupal\Tests\forum\Unit\Breadcrumb;
 
 use Drupal\Core\Cache\Cache;
+use Drupal\Core\Cache\Context\CacheContextsManager;
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Entity\EntityStorageInterface;
 use Drupal\Core\Link;
+use Drupal\Core\Routing\RouteMatchInterface;
+use Drupal\Core\StringTranslation\TranslationInterface;
+use Drupal\forum\Breadcrumb\ForumListingBreadcrumbBuilder;
+use Drupal\forum\ForumManagerInterface;
+use Drupal\taxonomy\VocabularyInterface;
+use Drupal\taxonomy\Entity\Term;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\DependencyInjection\Container;
 
@@ -19,7 +28,7 @@ class ForumListingBreadcrumbBuilderTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $cache_contexts_manager = $this->getMockBuilder('Drupal\Core\Cache\Context\CacheContextsManager')
+    $cache_contexts_manager = $this->getMockBuilder(CacheContextsManager::class)
       ->disableOriginalConstructor()
       ->getMock();
     $cache_contexts_manager->method('assertValidTokens')->willReturn(TRUE);
@@ -43,13 +52,13 @@ protected function setUp() {
    */
   public function testApplies($expected, $route_name = NULL, $parameter_map = []) {
     // Make some test doubles.
-    $entity_manager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
+    $entity_manager = $this->getMock(EntityManagerInterface::class);
     $config_factory = $this->getConfigFactoryStub([]);
-    $forum_manager = $this->getMock('Drupal\forum\ForumManagerInterface');
-    $translation_manager = $this->getMock('Drupal\Core\StringTranslation\TranslationInterface');
+    $forum_manager = $this->getMock(ForumManagerInterface::class);
+    $translation_manager = $this->getMock(TranslationInterface::class);
 
     // Make an object to test.
-    $builder = $this->getMockBuilder('Drupal\forum\Breadcrumb\ForumListingBreadcrumbBuilder')
+    $builder = $this->getMockBuilder(ForumListingBreadcrumbBuilder::class)
       ->setConstructorArgs([
         $entity_manager,
         $config_factory,
@@ -59,7 +68,7 @@ public function testApplies($expected, $route_name = NULL, $parameter_map = [])
       ->setMethods(NULL)
       ->getMock();
 
-    $route_match = $this->getMock('Drupal\Core\Routing\RouteMatchInterface');
+    $route_match = $this->getMock(RouteMatchInterface::class);
     $route_match->expects($this->once())
       ->method('getRouteName')
       ->will($this->returnValue($route_name));
@@ -80,7 +89,7 @@ public function testApplies($expected, $route_name = NULL, $parameter_map = [])
    */
   public function providerTestApplies() {
     // Send a Node mock, because NodeInterface cannot be mocked.
-    $mock_term = $this->getMockBuilder('Drupal\taxonomy\Entity\Term')
+    $mock_term = $this->getMockBuilder(Term::class)
       ->disableOriginalConstructor()
       ->getMock();
 
@@ -118,11 +127,11 @@ public function providerTestApplies() {
    */
   public function testBuild() {
     // Build all our dependencies, backwards.
-    $translation_manager = $this->getMockBuilder('Drupal\Core\StringTranslation\TranslationInterface')
+    $translation_manager = $this->getMockBuilder(TranslationInterface::class)
       ->disableOriginalConstructor()
       ->getMock();
 
-    $prophecy = $this->prophesize('Drupal\taxonomy\Entity\Term');
+    $prophecy = $this->prophesize(Term::class);
     $prophecy->label()->willReturn('Something');
     $prophecy->id()->willReturn(1);
     $prophecy->getCacheTags()->willReturn(['taxonomy_term:1']);
@@ -130,7 +139,7 @@ public function testBuild() {
     $prophecy->getCacheMaxAge()->willReturn(Cache::PERMANENT);
     $term1 = $prophecy->reveal();
 
-    $prophecy = $this->prophesize('Drupal\taxonomy\Entity\Term');
+    $prophecy = $this->prophesize(Term::class);
     $prophecy->label()->willReturn('Something else');
     $prophecy->id()->willReturn(2);
     $prophecy->getCacheTags()->willReturn(['taxonomy_term:2']);
@@ -138,7 +147,7 @@ public function testBuild() {
     $prophecy->getCacheMaxAge()->willReturn(Cache::PERMANENT);
     $term2 = $prophecy->reveal();
 
-    $forum_manager = $this->getMock('Drupal\forum\ForumManagerInterface');
+    $forum_manager = $this->getMock(ForumManagerInterface::class);
     $forum_manager->expects($this->at(0))
       ->method('getParents')
       ->will($this->returnValue([$term1]));
@@ -147,20 +156,20 @@ public function testBuild() {
       ->will($this->returnValue([$term1, $term2]));
 
     // The root forum.
-    $prophecy = $this->prophesize('Drupal\taxonomy\VocabularyInterface');
+    $prophecy = $this->prophesize(VocabularyInterface::class);
     $prophecy->label()->willReturn('Fora_is_the_plural_of_forum');
     $prophecy->id()->willReturn(5);
     $prophecy->getCacheTags()->willReturn(['taxonomy_vocabulary:5']);
     $prophecy->getCacheContexts()->willReturn([]);
     $prophecy->getCacheMaxAge()->willReturn(Cache::PERMANENT);
-    $vocab_storage = $this->getMock('Drupal\Core\Entity\EntityStorageInterface');
+    $vocab_storage = $this->getMock(EntityStorageInterface::class);
     $vocab_storage->expects($this->any())
       ->method('load')
       ->will($this->returnValueMap([
         ['forums', $prophecy->reveal()],
       ]));
 
-    $entity_manager = $this->getMockBuilder('Drupal\Core\Entity\EntityManagerInterface')
+    $entity_manager = $this->getMockBuilder(EntityManagerInterface::class)
       ->disableOriginalConstructor()
       ->getMock();
     $entity_manager->expects($this->any())
@@ -179,7 +188,7 @@ public function testBuild() {
 
     // Build a breadcrumb builder to test.
     $breadcrumb_builder = $this->getMock(
-      'Drupal\forum\Breadcrumb\ForumListingBreadcrumbBuilder', NULL, [
+      ForumListingBreadcrumbBuilder::class, NULL, [
         $entity_manager,
         $config_factory,
         $forum_manager,
@@ -192,7 +201,7 @@ public function testBuild() {
     $breadcrumb_builder->setStringTranslation($translation_manager);
 
     // The forum listing we need a breadcrumb back from.
-    $prophecy = $this->prophesize('Drupal\taxonomy\Entity\Term');
+    $prophecy = $this->prophesize(Term::class);
     $prophecy->label()->willReturn('You_should_not_see_this');
     $prophecy->id()->willReturn(23);
     $prophecy->getCacheTags()->willReturn(['taxonomy_term:23']);
@@ -201,7 +210,7 @@ public function testBuild() {
     $forum_listing = $prophecy->reveal();
 
     // Our data set.
-    $route_match = $this->getMock('Drupal\Core\Routing\RouteMatchInterface');
+    $route_match = $this->getMock(RouteMatchInterface::class);
     $route_match->expects($this->exactly(2))
       ->method('getParameter')
       ->with('taxonomy_term')
diff --git a/core/modules/forum/tests/src/Unit/Breadcrumb/ForumNodeBreadcrumbBuilderTest.php b/core/modules/forum/tests/src/Unit/Breadcrumb/ForumNodeBreadcrumbBuilderTest.php
index f4d3797..3ee582c 100644
--- a/core/modules/forum/tests/src/Unit/Breadcrumb/ForumNodeBreadcrumbBuilderTest.php
+++ b/core/modules/forum/tests/src/Unit/Breadcrumb/ForumNodeBreadcrumbBuilderTest.php
@@ -3,7 +3,17 @@
 namespace Drupal\Tests\forum\Unit\Breadcrumb;
 
 use Drupal\Core\Cache\Cache;
+use Drupal\Core\Cache\Context\CacheContextsManager;
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Entity\EntityStorageInterface;
 use Drupal\Core\Link;
+use Drupal\Core\Routing\RouteMatchInterface;
+use Drupal\Core\StringTranslation\TranslationInterface;
+use Drupal\forum\Breadcrumb\ForumNodeBreadcrumbBuilder;
+use Drupal\forum\ForumManagerInterface;
+use Drupal\node\Entity\Node;
+use Drupal\taxonomy\VocabularyInterface;
+use Drupal\taxonomy\Entity\Term;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\DependencyInjection\Container;
 
@@ -19,7 +29,7 @@ class ForumNodeBreadcrumbBuilderTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $cache_contexts_manager = $this->getMockBuilder('Drupal\Core\Cache\Context\CacheContextsManager')
+    $cache_contexts_manager = $this->getMockBuilder(CacheContextsManager::class)
       ->disableOriginalConstructor()
       ->getMock();
     $cache_contexts_manager->method('assertValidTokens')->willReturn(TRUE);
@@ -43,18 +53,18 @@ protected function setUp() {
    */
   public function testApplies($expected, $route_name = NULL, $parameter_map = []) {
     // Make some test doubles.
-    $entity_manager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
+    $entity_manager = $this->getMock(EntityManagerInterface::class);
     $config_factory = $this->getConfigFactoryStub([]);
 
-    $forum_manager = $this->getMock('Drupal\forum\ForumManagerInterface');
+    $forum_manager = $this->getMock(ForumManagerInterface::class);
     $forum_manager->expects($this->any())
       ->method('checkNodeType')
       ->will($this->returnValue(TRUE));
 
-    $translation_manager = $this->getMock('Drupal\Core\StringTranslation\TranslationInterface');
+    $translation_manager = $this->getMock(TranslationInterface::class);
 
     // Make an object to test.
-    $builder = $this->getMockBuilder('Drupal\forum\Breadcrumb\ForumNodeBreadcrumbBuilder')
+    $builder = $this->getMockBuilder(ForumNodeBreadcrumbBuilder::class)
       ->setConstructorArgs(
         [
           $entity_manager,
@@ -66,7 +76,7 @@ public function testApplies($expected, $route_name = NULL, $parameter_map = [])
       ->setMethods(NULL)
       ->getMock();
 
-    $route_match = $this->getMock('Drupal\Core\Routing\RouteMatchInterface');
+    $route_match = $this->getMock(RouteMatchInterface::class);
     $route_match->expects($this->once())
       ->method('getRouteName')
       ->will($this->returnValue($route_name));
@@ -89,7 +99,7 @@ public function testApplies($expected, $route_name = NULL, $parameter_map = [])
    */
   public function providerTestApplies() {
     // Send a Node mock, because NodeInterface cannot be mocked.
-    $mock_node = $this->getMockBuilder('Drupal\node\Entity\Node')
+    $mock_node = $this->getMockBuilder(Node::class)
       ->disableOriginalConstructor()
       ->getMock();
 
@@ -126,11 +136,11 @@ public function providerTestApplies() {
    */
   public function testBuild() {
     // Build all our dependencies, backwards.
-    $translation_manager = $this->getMockBuilder('Drupal\Core\StringTranslation\TranslationInterface')
+    $translation_manager = $this->getMockBuilder(TranslationInterface::class)
       ->disableOriginalConstructor()
       ->getMock();
 
-    $prophecy = $this->prophesize('Drupal\taxonomy\Entity\Term');
+    $prophecy = $this->prophesize(Term::class);
     $prophecy->label()->willReturn('Something');
     $prophecy->id()->willReturn(1);
     $prophecy->getCacheTags()->willReturn(['taxonomy_term:1']);
@@ -138,7 +148,7 @@ public function testBuild() {
     $prophecy->getCacheMaxAge()->willReturn(Cache::PERMANENT);
     $term1 = $prophecy->reveal();
 
-    $prophecy = $this->prophesize('Drupal\taxonomy\Entity\Term');
+    $prophecy = $this->prophesize(Term::class);
     $prophecy->label()->willReturn('Something else');
     $prophecy->id()->willReturn(2);
     $prophecy->getCacheTags()->willReturn(['taxonomy_term:2']);
@@ -146,7 +156,7 @@ public function testBuild() {
     $prophecy->getCacheMaxAge()->willReturn(Cache::PERMANENT);
     $term2 = $prophecy->reveal();
 
-    $forum_manager = $this->getMockBuilder('Drupal\forum\ForumManagerInterface')
+    $forum_manager = $this->getMockBuilder(ForumManagerInterface::class)
       ->disableOriginalConstructor()
       ->getMock();
     $forum_manager->expects($this->at(0))
@@ -156,20 +166,20 @@ public function testBuild() {
       ->method('getParents')
       ->will($this->returnValue([$term1, $term2]));
 
-    $prophecy = $this->prophesize('Drupal\taxonomy\VocabularyInterface');
+    $prophecy = $this->prophesize(VocabularyInterface::class);
     $prophecy->label()->willReturn('Forums');
     $prophecy->id()->willReturn(5);
     $prophecy->getCacheTags()->willReturn(['taxonomy_vocabulary:5']);
     $prophecy->getCacheContexts()->willReturn([]);
     $prophecy->getCacheMaxAge()->willReturn(Cache::PERMANENT);
-    $vocab_storage = $this->getMock('Drupal\Core\Entity\EntityStorageInterface');
+    $vocab_storage = $this->getMock(EntityStorageInterface::class);
     $vocab_storage->expects($this->any())
       ->method('load')
       ->will($this->returnValueMap([
         ['forums', $prophecy->reveal()],
       ]));
 
-    $entity_manager = $this->getMockBuilder('Drupal\Core\Entity\EntityManagerInterface')
+    $entity_manager = $this->getMockBuilder(EntityManagerInterface::class)
       ->disableOriginalConstructor()
       ->getMock();
     $entity_manager->expects($this->any())
@@ -188,7 +198,7 @@ public function testBuild() {
 
     // Build a breadcrumb builder to test.
     $breadcrumb_builder = $this->getMock(
-      'Drupal\forum\Breadcrumb\ForumNodeBreadcrumbBuilder', NULL, [
+      ForumNodeBreadcrumbBuilder::class, NULL, [
         $entity_manager,
         $config_factory,
         $forum_manager,
@@ -203,12 +213,12 @@ public function testBuild() {
     $property->setValue($breadcrumb_builder, $translation_manager);
 
     // The forum node we need a breadcrumb back from.
-    $forum_node = $this->getMockBuilder('Drupal\node\Entity\Node')
+    $forum_node = $this->getMockBuilder(Node::class)
       ->disableOriginalConstructor()
       ->getMock();
 
     // Our data set.
-    $route_match = $this->getMock('Drupal\Core\Routing\RouteMatchInterface');
+    $route_match = $this->getMock(RouteMatchInterface::class);
     $route_match->expects($this->exactly(2))
       ->method('getParameter')
       ->with('node')
diff --git a/core/modules/forum/tests/src/Unit/ForumManagerTest.php b/core/modules/forum/tests/src/Unit/ForumManagerTest.php
index ad59092..fa85b6b 100644
--- a/core/modules/forum/tests/src/Unit/ForumManagerTest.php
+++ b/core/modules/forum/tests/src/Unit/ForumManagerTest.php
@@ -2,6 +2,14 @@
 
 namespace Drupal\Tests\forum\Unit;
 
+use Drupal\comment\CommentManagerInterface;
+use Drupal\Core\Config\Config;
+use Drupal\Core\Config\ConfigFactoryInterface;
+use Drupal\Core\Database\Connection;
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\StringTranslation\TranslationManager;
+use Drupal\forum\ForumManager;
+use Drupal\taxonomy\VocabularyStorage;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -14,15 +22,15 @@ class ForumManagerTest extends UnitTestCase {
    * Tests ForumManager::getIndex().
    */
   public function testGetIndex() {
-    $entity_manager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
+    $entity_manager = $this->getMock(EntityManagerInterface::class);
 
-    $storage = $this->getMockBuilder('\Drupal\taxonomy\VocabularyStorage')
+    $storage = $this->getMockBuilder(VocabularyStorage::class)
       ->disableOriginalConstructor()
       ->getMock();
 
-    $config_factory = $this->getMock('\Drupal\Core\Config\ConfigFactoryInterface');
+    $config_factory = $this->getMock(ConfigFactoryInterface::class);
 
-    $config = $this->getMockBuilder('\Drupal\Core\Config\Config')
+    $config = $this->getMockBuilder(Config::class)
       ->disableOriginalConstructor()
       ->getMock();
 
@@ -45,19 +53,19 @@ public function testGetIndex() {
       ->method('create')
       ->will($this->returnValue($term));
 
-    $connection = $this->getMockBuilder('\Drupal\Core\Database\Connection')
+    $connection = $this->getMockBuilder(Connection::class)
       ->disableOriginalConstructor()
       ->getMock();
 
-    $translation_manager = $this->getMockBuilder('\Drupal\Core\StringTranslation\TranslationManager')
+    $translation_manager = $this->getMockBuilder(TranslationManager::class)
       ->disableOriginalConstructor()
       ->getMock();
 
-    $comment_manager = $this->getMockBuilder('\Drupal\comment\CommentManagerInterface')
+    $comment_manager = $this->getMockBuilder(CommentManagerInterface::class)
       ->disableOriginalConstructor()
       ->getMock();
 
-    $manager = $this->getMock('\Drupal\forum\ForumManager', ['getChildren'], [
+    $manager = $this->getMock(ForumManager::class, ['getChildren'], [
       $config_factory,
       $entity_manager,
       $connection,
diff --git a/core/modules/forum/tests/src/Unit/ForumUninstallValidatorTest.php b/core/modules/forum/tests/src/Unit/ForumUninstallValidatorTest.php
index fa1b0c1..55b4e66 100644
--- a/core/modules/forum/tests/src/Unit/ForumUninstallValidatorTest.php
+++ b/core/modules/forum/tests/src/Unit/ForumUninstallValidatorTest.php
@@ -2,7 +2,9 @@
 
 namespace Drupal\Tests\forum\Unit;
 
+use Drupal\forum\ForumUninstallValidator;
 use Drupal\simpletest\AssertHelperTrait;
+use Drupal\taxonomy\VocabularyInterface;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -23,7 +25,7 @@ class ForumUninstallValidatorTest extends UnitTestCase {
    */
   protected function setUp() {
     parent::setUp();
-    $this->forumUninstallValidator = $this->getMockBuilder('Drupal\forum\ForumUninstallValidator')
+    $this->forumUninstallValidator = $this->getMockBuilder(ForumUninstallValidator::class)
       ->disableOriginalConstructor()
       ->setMethods(['hasForumNodes', 'hasTermsForVocabulary', 'getForumVocabulary'])
       ->getMock();
@@ -55,7 +57,7 @@ public function testValidate() {
       ->method('hasForumNodes')
       ->willReturn(FALSE);
 
-    $vocabulary = $this->getMock('Drupal\taxonomy\VocabularyInterface');
+    $vocabulary = $this->getMock(VocabularyInterface::class);
     $this->forumUninstallValidator->expects($this->once())
       ->method('getForumVocabulary')
       ->willReturn($vocabulary);
@@ -78,7 +80,7 @@ public function testValidateHasForumNodes() {
       ->method('hasForumNodes')
       ->willReturn(TRUE);
 
-    $vocabulary = $this->getMock('Drupal\taxonomy\VocabularyInterface');
+    $vocabulary = $this->getMock(VocabularyInterface::class);
     $this->forumUninstallValidator->expects($this->once())
       ->method('getForumVocabulary')
       ->willReturn($vocabulary);
@@ -103,7 +105,7 @@ public function testValidateHasTermsForVocabularyWithNodesAccess() {
       ->method('hasForumNodes')
       ->willReturn(TRUE);
 
-    $vocabulary = $this->getMock('Drupal\taxonomy\VocabularyInterface');
+    $vocabulary = $this->getMock(VocabularyInterface::class);
     $vocabulary->expects($this->once())
       ->method('label')
       ->willReturn('Vocabulary label');
@@ -138,7 +140,7 @@ public function testValidateHasTermsForVocabularyWithNodesNoAccess() {
       ->method('hasForumNodes')
       ->willReturn(TRUE);
 
-    $vocabulary = $this->getMock('Drupal\taxonomy\VocabularyInterface');
+    $vocabulary = $this->getMock(VocabularyInterface::class);
     $vocabulary->expects($this->once())
       ->method('label')
       ->willReturn('Vocabulary label');
@@ -172,7 +174,7 @@ public function testValidateHasTermsForVocabularyAccess() {
       ->method('hasForumNodes')
       ->willReturn(FALSE);
 
-    $vocabulary = $this->getMock('Drupal\taxonomy\VocabularyInterface');
+    $vocabulary = $this->getMock(VocabularyInterface::class);
     $vocabulary->expects($this->once())
       ->method('url')
       ->willReturn('/path/to/vocabulary/overview');
@@ -206,7 +208,7 @@ public function testValidateHasTermsForVocabularyNoAccess() {
       ->method('hasForumNodes')
       ->willReturn(FALSE);
 
-    $vocabulary = $this->getMock('Drupal\taxonomy\VocabularyInterface');
+    $vocabulary = $this->getMock(VocabularyInterface::class);
     $vocabulary->expects($this->once())
       ->method('label')
       ->willReturn('Vocabulary label');
diff --git a/core/modules/image/tests/src/Unit/ImageStyleTest.php b/core/modules/image/tests/src/Unit/ImageStyleTest.php
index bc954b3..902304f 100644
--- a/core/modules/image/tests/src/Unit/ImageStyleTest.php
+++ b/core/modules/image/tests/src/Unit/ImageStyleTest.php
@@ -4,6 +4,12 @@
 
 use Drupal\Tests\UnitTestCase;
 use Drupal\Component\Utility\Crypt;
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Entity\EntityTypeInterface;
+use Drupal\image\ImageEffectBase;
+use Drupal\image\Entity\ImageStyle;
+use Drupal\image\ImageEffectManager;
+use Psr\Log\LoggerInterface;
 
 /**
  * @coversDefaultClass \Drupal\image\Entity\ImageStyle
@@ -45,7 +51,7 @@ class ImageStyleTest extends UnitTestCase {
    *   The mocked image style.
    */
   protected function getImageStyleMock($image_effect_id, $image_effect, $stubs = []) {
-    $effectManager = $this->getMockBuilder('\Drupal\image\ImageEffectManager')
+    $effectManager = $this->getMockBuilder(ImageEffectManager::class)
       ->disableOriginalConstructor()
       ->getMock();
     $effectManager->expects($this->any())
@@ -58,7 +64,7 @@ protected function getImageStyleMock($image_effect_id, $image_effect, $stubs = [
       'fileUriTarget',
       'fileDefaultScheme',
     ];
-    $image_style = $this->getMockBuilder('\Drupal\image\Entity\ImageStyle')
+    $image_style = $this->getMockBuilder(ImageStyle::class)
       ->setConstructorArgs([
         ['effects' => [$image_effect_id => ['id' => $image_effect_id]]],
         $this->entityTypeId,
@@ -88,11 +94,11 @@ protected function getImageStyleMock($image_effect_id, $image_effect, $stubs = [
   protected function setUp() {
     $this->entityTypeId = $this->randomMachineName();
     $this->provider = $this->randomMachineName();
-    $this->entityType = $this->getMock('\Drupal\Core\Entity\EntityTypeInterface');
+    $this->entityType = $this->getMock(EntityTypeInterface::class);
     $this->entityType->expects($this->any())
       ->method('getProvider')
       ->will($this->returnValue($this->provider));
-    $this->entityManager = $this->getMock('\Drupal\Core\Entity\EntityManagerInterface');
+    $this->entityManager = $this->getMock(EntityManagerInterface::class);
     $this->entityManager->expects($this->any())
       ->method('getDefinition')
       ->with($this->entityTypeId)
@@ -104,8 +110,8 @@ protected function setUp() {
    */
   public function testGetDerivativeExtension() {
     $image_effect_id = $this->randomMachineName();
-    $logger = $this->getMockBuilder('\Psr\Log\LoggerInterface')->getMock();
-    $image_effect = $this->getMockBuilder('\Drupal\image\ImageEffectBase')
+    $logger = $this->getMockBuilder(LoggerInterface::class)->getMock();
+    $image_effect = $this->getMockBuilder(ImageEffectBase::class)
       ->setConstructorArgs([[], $image_effect_id, [], $logger])
       ->getMock();
     $image_effect->expects($this->any())
@@ -127,8 +133,8 @@ public function testGetDerivativeExtension() {
   public function testBuildUri() {
     // Image style that changes the extension.
     $image_effect_id = $this->randomMachineName();
-    $logger = $this->getMockBuilder('\Psr\Log\LoggerInterface')->getMock();
-    $image_effect = $this->getMockBuilder('\Drupal\image\ImageEffectBase')
+    $logger = $this->getMockBuilder(LoggerInterface::class)->getMock();
+    $image_effect = $this->getMockBuilder(ImageEffectBase::class)
       ->setConstructorArgs([[], $image_effect_id, [], $logger])
       ->getMock();
     $image_effect->expects($this->any())
@@ -140,7 +146,7 @@ public function testBuildUri() {
 
     // Image style that doesn't change the extension.
     $image_effect_id = $this->randomMachineName();
-    $image_effect = $this->getMockBuilder('\Drupal\image\ImageEffectBase')
+    $image_effect = $this->getMockBuilder(ImageEffectBase::class)
       ->setConstructorArgs([[], $image_effect_id, [], $logger])
       ->getMock();
     $image_effect->expects($this->any())
@@ -155,13 +161,13 @@ public function testBuildUri() {
    * @covers ::getPathToken
    */
   public function testGetPathToken() {
-    $logger = $this->getMockBuilder('\Psr\Log\LoggerInterface')->getMock();
+    $logger = $this->getMockBuilder(LoggerInterface::class)->getMock();
     $private_key = $this->randomMachineName();
     $hash_salt = $this->randomMachineName();
 
     // Image style that changes the extension.
     $image_effect_id = $this->randomMachineName();
-    $image_effect = $this->getMockBuilder('\Drupal\image\ImageEffectBase')
+    $image_effect = $this->getMockBuilder(ImageEffectBase::class)
       ->setConstructorArgs([[], $image_effect_id, [], $logger])
       ->getMock();
     $image_effect->expects($this->any())
@@ -183,7 +189,7 @@ public function testGetPathToken() {
 
     // Image style that doesn't change the extension.
     $image_effect_id = $this->randomMachineName();
-    $image_effect = $this->getMockBuilder('\Drupal\image\ImageEffectBase')
+    $image_effect = $this->getMockBuilder(ImageEffectBase::class)
       ->setConstructorArgs([[], $image_effect_id, [], $logger])
       ->getMock();
     $image_effect->expects($this->any())
diff --git a/core/modules/image/tests/src/Unit/PageCache/DenyPrivateImageStyleDownloadTest.php b/core/modules/image/tests/src/Unit/PageCache/DenyPrivateImageStyleDownloadTest.php
index 6533090..44ccee3 100644
--- a/core/modules/image/tests/src/Unit/PageCache/DenyPrivateImageStyleDownloadTest.php
+++ b/core/modules/image/tests/src/Unit/PageCache/DenyPrivateImageStyleDownloadTest.php
@@ -3,6 +3,7 @@
 namespace Drupal\Tests\image\Unit\PageCache;
 
 use Drupal\Core\PageCache\ResponsePolicyInterface;
+use Drupal\Core\Routing\RouteMatchInterface;
 use Drupal\image\PageCache\DenyPrivateImageStyleDownload;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\HttpFoundation\Request;
@@ -43,7 +44,7 @@ class DenyPrivateImageStyleDownloadTest extends UnitTestCase {
   protected $routeMatch;
 
   protected function setUp() {
-    $this->routeMatch = $this->getMock('Drupal\Core\Routing\RouteMatchInterface');
+    $this->routeMatch = $this->getMock(RouteMatchInterface::class);
     $this->policy = new DenyPrivateImageStyleDownload($this->routeMatch);
     $this->response = new Response();
     $this->request = new Request();
diff --git a/core/modules/language/tests/src/Kernel/ConfigurableLanguageManagerTest.php b/core/modules/language/tests/src/Kernel/ConfigurableLanguageManagerTest.php
index 92ab889..b295365 100644
--- a/core/modules/language/tests/src/Kernel/ConfigurableLanguageManagerTest.php
+++ b/core/modules/language/tests/src/Kernel/ConfigurableLanguageManagerTest.php
@@ -3,6 +3,7 @@
 namespace Drupal\Tests\language\Kernel;
 
 use Drupal\Core\Language\LanguageInterface;
+use Drupal\Core\Session\AccountInterface;
 use Drupal\Core\Url;
 
 /**
@@ -49,7 +50,7 @@ protected function setUp() {
    * @covers ::getLanguageSwitchLinks
    */
   public function testLanguageSwitchLinks() {
-    $this->languageNegotiator->setCurrentUser($this->prophesize('Drupal\Core\Session\AccountInterface')->reveal());
+    $this->languageNegotiator->setCurrentUser($this->prophesize(AccountInterface::class)->reveal());
     $this->languageManager->getLanguageSwitchLinks(LanguageInterface::TYPE_INTERFACE, new Url('<current>'));
   }
 
diff --git a/core/modules/language/tests/src/Unit/Config/LanguageConfigOverrideTest.php b/core/modules/language/tests/src/Unit/Config/LanguageConfigOverrideTest.php
index 805cef9..0378065 100644
--- a/core/modules/language/tests/src/Unit/Config/LanguageConfigOverrideTest.php
+++ b/core/modules/language/tests/src/Unit/Config/LanguageConfigOverrideTest.php
@@ -2,9 +2,13 @@
 
 namespace Drupal\Tests\language\Unit\Config;
 
+use Drupal\Core\Cache\CacheTagsInvalidatorInterface;
+use Drupal\Core\Config\StorageInterface;
+use Drupal\Core\Config\TypedConfigManagerInterface;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
 use Drupal\language\Config\LanguageConfigOverride;
 use Drupal\Tests\UnitTestCase;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 
 /**
  * @coversDefaultClass \Drupal\language\Config\LanguageConfigOverride
@@ -52,11 +56,11 @@ class LanguageConfigOverrideTest extends UnitTestCase {
    * {@inheritdoc}
    */
   protected function setUp() {
-    $this->storage = $this->getMock('Drupal\Core\Config\StorageInterface');
-    $this->eventDispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
-    $this->typedConfig = $this->getMock('\Drupal\Core\Config\TypedConfigManagerInterface');
+    $this->storage = $this->getMock(StorageInterface::class);
+    $this->eventDispatcher = $this->getMock(EventDispatcherInterface::class);
+    $this->typedConfig = $this->getMock(TypedConfigManagerInterface::class);
     $this->configTranslation = new LanguageConfigOverride('config.test', $this->storage, $this->typedConfig, $this->eventDispatcher);
-    $this->cacheTagsInvalidator = $this->getMock('Drupal\Core\Cache\CacheTagsInvalidatorInterface');
+    $this->cacheTagsInvalidator = $this->getMock(CacheTagsInvalidatorInterface::class);
 
     $container = new ContainerBuilder();
     $container->set('cache_tags.invalidator', $this->cacheTagsInvalidator);
diff --git a/core/modules/language/tests/src/Unit/ContentLanguageSettingsUnitTest.php b/core/modules/language/tests/src/Unit/ContentLanguageSettingsUnitTest.php
index 06820d0..20b42f2 100644
--- a/core/modules/language/tests/src/Unit/ContentLanguageSettingsUnitTest.php
+++ b/core/modules/language/tests/src/Unit/ContentLanguageSettingsUnitTest.php
@@ -2,8 +2,13 @@
 
 namespace Drupal\Tests\language\Unit;
 
+use Drupal\Component\Uuid\UuidInterface;
+use Drupal\Core\Config\TypedConfigManagerInterface;
 use Drupal\Core\Language\LanguageInterface;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Entity\EntityStorageInterface;
+use Drupal\Core\Entity\EntityTypeInterface;
 use Drupal\language\Entity\ContentLanguageSettings;
 use Drupal\Tests\UnitTestCase;
 
@@ -60,15 +65,15 @@ class ContentLanguageSettingsUnitTest extends UnitTestCase {
    */
   protected function setUp() {
     $this->entityTypeId = $this->randomMachineName();
-    $this->entityType = $this->getMock('\Drupal\Core\Entity\EntityTypeInterface');
+    $this->entityType = $this->getMock(EntityTypeInterface::class);
 
-    $this->entityManager = $this->getMock('\Drupal\Core\Entity\EntityManagerInterface');
+    $this->entityManager = $this->getMock(EntityManagerInterface::class);
 
-    $this->uuid = $this->getMock('\Drupal\Component\Uuid\UuidInterface');
+    $this->uuid = $this->getMock(UuidInterface::class);
 
-    $this->typedConfigManager = $this->getMock('Drupal\Core\Config\TypedConfigManagerInterface');
+    $this->typedConfigManager = $this->getMock(TypedConfigManagerInterface::class);
 
-    $this->configEntityStorageInterface = $this->getMock('Drupal\Core\Entity\EntityStorageInterface');
+    $this->configEntityStorageInterface = $this->getMock(EntityStorageInterface::class);
 
     $container = new ContainerBuilder();
     $container->set('entity.manager', $this->entityManager);
@@ -83,7 +88,7 @@ protected function setUp() {
    */
   public function testCalculateDependencies() {
     // Mock the interfaces necessary to create a dependency on a bundle entity.
-    $target_entity_type = $this->getMock('\Drupal\Core\Entity\EntityTypeInterface');
+    $target_entity_type = $this->getMock(EntityTypeInterface::class);
     $target_entity_type->expects($this->any())
       ->method('getBundleConfigDependency')
       ->will($this->returnValue(['type' => 'config', 'name' => 'test.test_entity_type.id']));
diff --git a/core/modules/language/tests/src/Unit/LanguageNegotiationUrlTest.php b/core/modules/language/tests/src/Unit/LanguageNegotiationUrlTest.php
index 825ca7d..58f380b 100644
--- a/core/modules/language/tests/src/Unit/LanguageNegotiationUrlTest.php
+++ b/core/modules/language/tests/src/Unit/LanguageNegotiationUrlTest.php
@@ -3,9 +3,12 @@
 namespace Drupal\Tests\language\Unit;
 
 use Drupal\Core\Cache\Cache;
+use Drupal\Core\Cache\Context\CacheContextsManager;
 use Drupal\Core\Language\LanguageInterface;
 use Drupal\Core\Render\BubbleableMetadata;
+use Drupal\Core\Session\AccountInterface;
 use Drupal\Tests\UnitTestCase;
+use Drupal\language\ConfigurableLanguageManagerInterface;
 use Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUrl;
 use Symfony\Component\DependencyInjection\ContainerBuilder;
 use Symfony\Component\HttpFoundation\Request;
@@ -25,11 +28,11 @@ class LanguageNegotiationUrlTest extends UnitTestCase {
   protected function setUp() {
 
     // Set up some languages to be used by the language-based path processor.
-    $language_de = $this->getMock('\Drupal\Core\Language\LanguageInterface');
+    $language_de = $this->getMock(LanguageInterface::class);
     $language_de->expects($this->any())
       ->method('getId')
       ->will($this->returnValue('de'));
-    $language_en = $this->getMock('\Drupal\Core\Language\LanguageInterface');
+    $language_en = $this->getMock(LanguageInterface::class);
     $language_en->expects($this->any())
       ->method('getId')
       ->will($this->returnValue('en'));
@@ -40,7 +43,7 @@ protected function setUp() {
     $this->languages = $languages;
 
     // Create a language manager stub.
-    $language_manager = $this->getMockBuilder('Drupal\language\ConfigurableLanguageManagerInterface')
+    $language_manager = $this->getMockBuilder(ConfigurableLanguageManagerInterface::class)
       ->getMock();
     $language_manager->expects($this->any())
       ->method('getLanguages')
@@ -48,10 +51,10 @@ protected function setUp() {
     $this->languageManager = $language_manager;
 
     // Create a user stub.
-    $this->user = $this->getMockBuilder('Drupal\Core\Session\AccountInterface')
+    $this->user = $this->getMockBuilder(AccountInterface::class)
       ->getMock();
 
-    $cache_contexts_manager = $this->getMockBuilder('Drupal\Core\Cache\Context\CacheContextsManager')
+    $cache_contexts_manager = $this->getMockBuilder(CacheContextsManager::class)
       ->disableOriginalConstructor()
       ->getMock();
     $cache_contexts_manager->method('assertValidTokens')->willReturn(TRUE);
diff --git a/core/modules/link/tests/src/Unit/Plugin/Validation/Constraint/LinkAccessConstraintValidatorTest.php b/core/modules/link/tests/src/Unit/Plugin/Validation/Constraint/LinkAccessConstraintValidatorTest.php
index c2290bc..b769635 100644
--- a/core/modules/link/tests/src/Unit/Plugin/Validation/Constraint/LinkAccessConstraintValidatorTest.php
+++ b/core/modules/link/tests/src/Unit/Plugin/Validation/Constraint/LinkAccessConstraintValidatorTest.php
@@ -2,6 +2,9 @@
 
 namespace Drupal\Tests\link\Unit\Plugin\Validation\Constraint;
 
+use Drupal\Core\Session\AccountProxyInterface;
+use Drupal\Core\Url;
+use Drupal\link\LinkItemInterface;
 use Drupal\link\Plugin\Validation\Constraint\LinkAccessConstraint;
 use Drupal\link\Plugin\Validation\Constraint\LinkAccessConstraintValidator;
 use Drupal\Tests\UnitTestCase;
@@ -68,20 +71,20 @@ public function providerValidate() {
 
     foreach ($cases as $case) {
       // Mock a Url object that returns a boolean indicating user access.
-      $url = $this->getMockBuilder('Drupal\Core\Url')
+      $url = $this->getMockBuilder(Url::class)
         ->disableOriginalConstructor()
         ->getMock();
       $url->expects($this->once())
         ->method('access')
         ->willReturn($case['url_access']);
       // Mock a link object that returns the URL object.
-      $link = $this->getMock('Drupal\link\LinkItemInterface');
+      $link = $this->getMock(LinkItemInterface::class);
       $link->expects($this->any())
         ->method('getUrl')
         ->willReturn($url);
       // Mock a user object that returns a boolean indicating user access to all
       // links.
-      $user = $this->getMock('Drupal\Core\Session\AccountProxyInterface');
+      $user = $this->getMock(AccountProxyInterface::class);
       $user->expects($this->any())
         ->method('hasPermission')
         ->with($this->equalTo('link to any page'))
diff --git a/core/modules/link/tests/src/Unit/Plugin/Validation/Constraint/LinkExternalProtocolsConstraintValidatorTest.php b/core/modules/link/tests/src/Unit/Plugin/Validation/Constraint/LinkExternalProtocolsConstraintValidatorTest.php
index 0de416f..5d7bfb0 100644
--- a/core/modules/link/tests/src/Unit/Plugin/Validation/Constraint/LinkExternalProtocolsConstraintValidatorTest.php
+++ b/core/modules/link/tests/src/Unit/Plugin/Validation/Constraint/LinkExternalProtocolsConstraintValidatorTest.php
@@ -4,6 +4,7 @@
 
 use Drupal\Component\Utility\UrlHelper;
 use Drupal\Core\Url;
+use Drupal\link\LinkItemInterface;
 use Drupal\link\Plugin\Validation\Constraint\LinkExternalProtocolsConstraint;
 use Drupal\link\Plugin\Validation\Constraint\LinkExternalProtocolsConstraintValidator;
 use Drupal\Tests\UnitTestCase;
@@ -57,7 +58,7 @@ public function providerValidate() {
 
     foreach ($data as &$single_data) {
       $url = Url::fromUri($single_data[0]);
-      $link = $this->getMock('Drupal\link\LinkItemInterface');
+      $link = $this->getMock(LinkItemInterface::class);
       $link->expects($this->any())
         ->method('getUrl')
         ->willReturn($url);
@@ -73,7 +74,7 @@ public function providerValidate() {
    * @see \Drupal\Core\Url::fromUri
    */
   public function testValidateWithMalformedUri() {
-    $link = $this->getMock('Drupal\link\LinkItemInterface');
+    $link = $this->getMock(LinkItemInterface::class);
     $link->expects($this->any())
       ->method('getUrl')
       ->willThrowException(new \InvalidArgumentException());
@@ -93,7 +94,7 @@ public function testValidateWithMalformedUri() {
    * @covers ::validate
    */
   public function testValidateIgnoresInternalUrls() {
-    $link = $this->getMock('Drupal\link\LinkItemInterface');
+    $link = $this->getMock(LinkItemInterface::class);
     $link->expects($this->any())
       ->method('getUrl')
       ->willReturn(Url::fromRoute('example.test'));
diff --git a/core/modules/link/tests/src/Unit/Plugin/Validation/Constraint/LinkNotExistingInternalConstraintValidatorTest.php b/core/modules/link/tests/src/Unit/Plugin/Validation/Constraint/LinkNotExistingInternalConstraintValidatorTest.php
index 41ecd4a..0dcb16a 100644
--- a/core/modules/link/tests/src/Unit/Plugin/Validation/Constraint/LinkNotExistingInternalConstraintValidatorTest.php
+++ b/core/modules/link/tests/src/Unit/Plugin/Validation/Constraint/LinkNotExistingInternalConstraintValidatorTest.php
@@ -2,7 +2,9 @@
 
 namespace Drupal\Tests\link\Unit\Plugin\Validation\Constraint;
 
+use Drupal\Core\Routing\UrlGeneratorInterface;
 use Drupal\Core\Url;
+use Drupal\link\LinkItemInterface;
 use Drupal\link\Plugin\Validation\Constraint\LinkNotExistingInternalConstraint;
 use Drupal\link\Plugin\Validation\Constraint\LinkNotExistingInternalConstraintValidator;
 use Drupal\Tests\UnitTestCase;
@@ -51,7 +53,7 @@ public function providerValidate() {
     // Existing routed URL.
     $url = Url::fromRoute('example.existing_route');
 
-    $url_generator = $this->getMock('Drupal\Core\Routing\UrlGeneratorInterface');
+    $url_generator = $this->getMock(UrlGeneratorInterface::class);
     $url_generator->expects($this->any())
       ->method('generateFromRoute')
       ->with('example.existing_route', [], [])
@@ -63,7 +65,7 @@ public function providerValidate() {
     // Not existing routed URL.
     $url = Url::fromRoute('example.not_existing_route');
 
-    $url_generator = $this->getMock('Drupal\Core\Routing\UrlGeneratorInterface');
+    $url_generator = $this->getMock(UrlGeneratorInterface::class);
     $url_generator->expects($this->any())
       ->method('generateFromRoute')
       ->with('example.not_existing_route', [], [])
@@ -73,7 +75,7 @@ public function providerValidate() {
     $data[] = [$url, FALSE];
 
     foreach ($data as &$single_data) {
-      $link = $this->getMock('Drupal\link\LinkItemInterface');
+      $link = $this->getMock(LinkItemInterface::class);
       $link->expects($this->any())
         ->method('getUrl')
         ->willReturn($single_data[0]);
@@ -90,7 +92,7 @@ public function providerValidate() {
    * @see \Drupal\Core\Url::fromUri
    */
   public function testValidateWithMalformedUri() {
-    $link = $this->getMock('Drupal\link\LinkItemInterface');
+    $link = $this->getMock(LinkItemInterface::class);
     $link->expects($this->any())
       ->method('getUrl')
       ->willThrowException(new \InvalidArgumentException());
diff --git a/core/modules/link/tests/src/Unit/Plugin/migrate/process/d6/FieldLinkTest.php b/core/modules/link/tests/src/Unit/Plugin/migrate/process/d6/FieldLinkTest.php
index 4b4eda2..b66a40d 100644
--- a/core/modules/link/tests/src/Unit/Plugin/migrate/process/d6/FieldLinkTest.php
+++ b/core/modules/link/tests/src/Unit/Plugin/migrate/process/d6/FieldLinkTest.php
@@ -3,6 +3,9 @@
 namespace Drupal\Tests\link\Unit\Plugin\migrate\process\d6;
 
 use Drupal\link\Plugin\migrate\process\d6\FieldLink;
+use Drupal\migrate\MigrateExecutableInterface;
+use Drupal\migrate\Row;
+use Drupal\migrate\Plugin\MigrationInterface;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -16,12 +19,12 @@ class FieldLinkTest extends UnitTestCase {
    * @dataProvider canonicalizeUriDataProvider
    */
   public function testCanonicalizeUri($url, $expected) {
-    $link_plugin = new FieldLink([], '', [], $this->getMock('\Drupal\migrate\Plugin\MigrationInterface'));
+    $link_plugin = new FieldLink([], '', [], $this->getMock(MigrationInterface::class));
     $transformed = $link_plugin->transform([
       'url' => $url,
       'title' => '',
       'attributes' => serialize([]),
-    ], $this->getMock('\Drupal\migrate\MigrateExecutableInterface'), $this->getMockBuilder('\Drupal\migrate\Row')->disableOriginalConstructor()->getMock(), NULL);
+    ], $this->getMock(MigrateExecutableInterface::class), $this->getMockBuilder(Row::class)->disableOriginalConstructor()->getMock(), NULL);
     $this->assertEquals($expected, $transformed['uri']);
   }
 
diff --git a/core/modules/locale/tests/src/Unit/LocaleLookupTest.php b/core/modules/locale/tests/src/Unit/LocaleLookupTest.php
index cbdd6de..e3e8bf0 100644
--- a/core/modules/locale/tests/src/Unit/LocaleLookupTest.php
+++ b/core/modules/locale/tests/src/Unit/LocaleLookupTest.php
@@ -2,8 +2,14 @@
 
 namespace Drupal\Tests\locale\Unit;
 
+use Drupal\Core\Cache\CacheBackendInterface;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
+use Drupal\Core\Language\LanguageManagerInterface;
+use Drupal\Core\Lock\LockBackendInterface;
+use Drupal\Core\Session\AccountInterface;
 use Drupal\locale\LocaleLookup;
+use Drupal\locale\StringInterface;
+use Drupal\locale\StringStorageInterface;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpFoundation\RequestStack;
@@ -67,20 +73,20 @@ class LocaleLookupTest extends UnitTestCase {
    * {@inheritdoc}
    */
   protected function setUp() {
-    $this->storage = $this->getMock('Drupal\locale\StringStorageInterface');
-    $this->cache = $this->getMock('Drupal\Core\Cache\CacheBackendInterface');
-    $this->lock = $this->getMock('Drupal\Core\Lock\LockBackendInterface');
+    $this->storage = $this->getMock(StringStorageInterface::class);
+    $this->cache = $this->getMock(CacheBackendInterface::class);
+    $this->lock = $this->getMock(LockBackendInterface::class);
     $this->lock->expects($this->never())
       ->method($this->anything());
 
-    $this->user = $this->getMock('Drupal\Core\Session\AccountInterface');
+    $this->user = $this->getMock(AccountInterface::class);
     $this->user->expects($this->any())
       ->method('getRoles')
       ->will($this->returnValue(['anonymous']));
 
     $this->configFactory = $this->getConfigFactoryStub(['locale.settings' => ['cache_strings' => FALSE]]);
 
-    $this->languageManager = $this->getMock('Drupal\Core\Language\LanguageManagerInterface');
+    $this->languageManager = $this->getMock(LanguageManagerInterface::class);
     $this->requestStack = new RequestStack();
 
     $container = new ContainerBuilder();
@@ -113,7 +119,7 @@ public function testResolveCacheMissWithoutFallback() {
       ->with($this->equalTo($args))
       ->will($this->returnValue($result));
 
-    $locale_lookup = $this->getMockBuilder('Drupal\locale\LocaleLookup')
+    $locale_lookup = $this->getMockBuilder(LocaleLookup::class)
       ->setConstructorArgs(['en', 'irrelevant', $this->storage, $this->cache, $this->lock, $this->configFactory, $this->languageManager, $this->requestStack])
       ->setMethods(['persist'])
       ->getMock();
@@ -226,7 +232,7 @@ public function testResolveCacheMissWithPersist() {
       ->will($this->returnValue($result));
 
     $this->configFactory = $this->getConfigFactoryStub(['locale.settings' => ['cache_strings' => TRUE]]);
-    $locale_lookup = $this->getMockBuilder('Drupal\locale\LocaleLookup')
+    $locale_lookup = $this->getMockBuilder(LocaleLookup::class)
       ->setConstructorArgs(['en', 'irrelevant', $this->storage, $this->cache, $this->lock, $this->configFactory, $this->languageManager, $this->requestStack])
       ->setMethods(['persist'])
       ->getMock();
@@ -242,7 +248,7 @@ public function testResolveCacheMissWithPersist() {
    * @covers ::resolveCacheMiss
    */
   public function testResolveCacheMissNoTranslation() {
-    $string = $this->getMock('Drupal\locale\StringInterface');
+    $string = $this->getMock(StringInterface::class);
     $string->expects($this->once())
       ->method('addLocation')
       ->will($this->returnSelf());
@@ -256,7 +262,7 @@ public function testResolveCacheMissNoTranslation() {
     $request = Request::create('/test');
     $this->requestStack->push($request);
 
-    $locale_lookup = $this->getMockBuilder('Drupal\locale\LocaleLookup')
+    $locale_lookup = $this->getMockBuilder(LocaleLookup::class)
       ->setConstructorArgs(['en', 'irrelevant', $this->storage, $this->cache, $this->lock, $this->configFactory, $this->languageManager, $this->requestStack])
       ->setMethods(['persist'])
       ->getMock();
diff --git a/core/modules/locale/tests/src/Unit/LocaleTranslationTest.php b/core/modules/locale/tests/src/Unit/LocaleTranslationTest.php
index c4a3f1e..1d6bd6d 100644
--- a/core/modules/locale/tests/src/Unit/LocaleTranslationTest.php
+++ b/core/modules/locale/tests/src/Unit/LocaleTranslationTest.php
@@ -2,7 +2,11 @@
 
 namespace Drupal\Tests\locale\Unit;
 
+use Drupal\Core\Cache\CacheBackendInterface;
+use Drupal\Core\Language\LanguageManagerInterface;
+use Drupal\Core\Lock\LockBackendInterface;
 use Drupal\locale\LocaleTranslation;
+use Drupal\locale\StringStorageInterface;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\HttpFoundation\RequestStack;
 
@@ -37,10 +41,10 @@ class LocaleTranslationTest extends UnitTestCase {
    * {@inheritdoc}
    */
   protected function setUp() {
-    $this->storage = $this->getMock('Drupal\locale\StringStorageInterface');
-    $this->cache = $this->getMock('Drupal\Core\Cache\CacheBackendInterface');
-    $this->lock = $this->getMock('Drupal\Core\Lock\LockBackendInterface');
-    $this->languageManager = $this->getMock('Drupal\Core\Language\LanguageManagerInterface');
+    $this->storage = $this->getMock(StringStorageInterface::class);
+    $this->cache = $this->getMock(CacheBackendInterface::class);
+    $this->lock = $this->getMock(LockBackendInterface::class);
+    $this->languageManager = $this->getMock(LanguageManagerInterface::class);
     $this->requestStack = new RequestStack();
   }
 
diff --git a/core/modules/migrate/tests/src/Unit/Event/EventBaseTest.php b/core/modules/migrate/tests/src/Unit/Event/EventBaseTest.php
index b712d31..bd680b6 100644
--- a/core/modules/migrate/tests/src/Unit/Event/EventBaseTest.php
+++ b/core/modules/migrate/tests/src/Unit/Event/EventBaseTest.php
@@ -2,7 +2,10 @@
 
 namespace Drupal\Tests\migrate\Unit\Event;
 
+use Drupal\migrate\MigrateMessageInterface;
+use Drupal\migrate\Row;
 use Drupal\migrate\Event\EventBase;
+use Drupal\migrate\Plugin\MigrationInterface;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -18,9 +21,9 @@ class EventBaseTest extends UnitTestCase {
    * @covers ::getMigration
    */
   public function testGetMigration() {
-    $migration = $this->prophesize('\Drupal\migrate\Plugin\MigrationInterface')->reveal();
-    $message_service = $this->prophesize('\Drupal\migrate\MigrateMessageInterface')->reveal();
-    $row = $this->prophesize('\Drupal\migrate\Row')->reveal();
+    $migration = $this->prophesize(MigrationInterface::class)->reveal();
+    $message_service = $this->prophesize(MigrateMessageInterface::class)->reveal();
+    $row = $this->prophesize(Row::class)->reveal();
     $event = new EventBase($migration, $message_service, $row, [1, 2, 3]);
     $this->assertSame($migration, $event->getMigration());
   }
@@ -32,8 +35,8 @@ public function testGetMigration() {
    * @covers ::logMessage
    */
   public function testLogMessage() {
-    $migration = $this->prophesize('\Drupal\migrate\Plugin\MigrationInterface')->reveal();
-    $message_service = $this->prophesize('\Drupal\migrate\MigrateMessageInterface');
+    $migration = $this->prophesize(MigrationInterface::class)->reveal();
+    $message_service = $this->prophesize(MigrateMessageInterface::class);
     $event = new EventBase($migration, $message_service->reveal());
     // Assert that the intended calls to the services happen.
     $message_service->display('status message', 'status')->shouldBeCalledTimes(1);
diff --git a/core/modules/migrate/tests/src/Unit/Event/MigrateImportEventTest.php b/core/modules/migrate/tests/src/Unit/Event/MigrateImportEventTest.php
index d281433..abd72b1 100644
--- a/core/modules/migrate/tests/src/Unit/Event/MigrateImportEventTest.php
+++ b/core/modules/migrate/tests/src/Unit/Event/MigrateImportEventTest.php
@@ -2,7 +2,9 @@
 
 namespace Drupal\Tests\migrate\Unit\Event;
 
+use Drupal\migrate\MigrateMessageInterface;
 use Drupal\migrate\Event\MigrateImportEvent;
+use Drupal\migrate\Plugin\MigrationInterface;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -18,8 +20,8 @@ class MigrateImportEventTest extends UnitTestCase {
    * @covers ::getMigration
    */
   public function testGetMigration() {
-    $migration = $this->prophesize('\Drupal\migrate\Plugin\MigrationInterface')->reveal();
-    $message_service = $this->prophesize('\Drupal\migrate\MigrateMessageInterface')->reveal();
+    $migration = $this->prophesize(MigrationInterface::class)->reveal();
+    $message_service = $this->prophesize(MigrateMessageInterface::class)->reveal();
     $event = new MigrateImportEvent($migration, $message_service);
     $this->assertSame($migration, $event->getMigration());
   }
@@ -31,8 +33,8 @@ public function testGetMigration() {
    * @covers ::logMessage
    */
   public function testLogMessage() {
-    $migration = $this->prophesize('\Drupal\migrate\Plugin\MigrationInterface');
-    $message_service = $this->prophesize('\Drupal\migrate\MigrateMessageInterface');
+    $migration = $this->prophesize(MigrationInterface::class);
+    $message_service = $this->prophesize(MigrateMessageInterface::class);
     $event = new MigrateImportEvent($migration->reveal(), $message_service->reveal());
     // Assert that the intended calls to the services happen.
     $message_service->display('status message', 'status')->shouldBeCalledTimes(1);
diff --git a/core/modules/migrate/tests/src/Unit/Event/MigratePostRowSaveEventTest.php b/core/modules/migrate/tests/src/Unit/Event/MigratePostRowSaveEventTest.php
index f42cb06..4b9cce9 100644
--- a/core/modules/migrate/tests/src/Unit/Event/MigratePostRowSaveEventTest.php
+++ b/core/modules/migrate/tests/src/Unit/Event/MigratePostRowSaveEventTest.php
@@ -2,7 +2,10 @@
 
 namespace Drupal\Tests\migrate\Unit\Event;
 
+use Drupal\migrate\MigrateMessageInterface;
+use Drupal\migrate\Row;
 use Drupal\migrate\Event\MigratePostRowSaveEvent;
+use Drupal\migrate\Plugin\MigrationInterface;
 
 /**
  * @coversDefaultClass \Drupal\migrate\Event\MigratePostRowSaveEvent
@@ -17,9 +20,9 @@ class MigratePostRowSaveEventTest extends EventBaseTest {
    * @covers ::getDestinationIdValues
    */
   public function testGetDestinationIdValues() {
-    $migration = $this->prophesize('\Drupal\migrate\Plugin\MigrationInterface')->reveal();
-    $message_service = $this->prophesize('\Drupal\migrate\MigrateMessageInterface')->reveal();
-    $row = $this->prophesize('\Drupal\migrate\Row')->reveal();
+    $migration = $this->prophesize(MigrationInterface::class)->reveal();
+    $message_service = $this->prophesize(MigrateMessageInterface::class)->reveal();
+    $row = $this->prophesize(Row::class)->reveal();
     $event = new MigratePostRowSaveEvent($migration, $message_service, $row, [1, 2, 3]);
     $this->assertSame([1, 2, 3], $event->getDestinationIdValues());
   }
@@ -31,9 +34,9 @@ public function testGetDestinationIdValues() {
    * @covers ::getRow
    */
   public function testGetRow() {
-    $migration = $this->prophesize('\Drupal\migrate\Plugin\MigrationInterface')->reveal();
-    $message_service = $this->prophesize('\Drupal\migrate\MigrateMessageInterface');
-    $row = $this->prophesize('\Drupal\migrate\Row')->reveal();
+    $migration = $this->prophesize(MigrationInterface::class)->reveal();
+    $message_service = $this->prophesize(MigrateMessageInterface::class);
+    $row = $this->prophesize(Row::class)->reveal();
     $event = new MigratePostRowSaveEvent($migration, $message_service->reveal(), $row, [1, 2, 3]);
     $this->assertSame($row, $event->getRow());
   }
diff --git a/core/modules/migrate/tests/src/Unit/Event/MigratePreRowSaveEventTest.php b/core/modules/migrate/tests/src/Unit/Event/MigratePreRowSaveEventTest.php
index f15dac1..5d3efea 100644
--- a/core/modules/migrate/tests/src/Unit/Event/MigratePreRowSaveEventTest.php
+++ b/core/modules/migrate/tests/src/Unit/Event/MigratePreRowSaveEventTest.php
@@ -2,7 +2,10 @@
 
 namespace Drupal\Tests\migrate\Unit\Event;
 
+use Drupal\migrate\MigrateMessageInterface;
+use Drupal\migrate\Row;
 use Drupal\migrate\Event\MigratePreRowSaveEvent;
+use Drupal\migrate\Plugin\MigrationInterface;
 
 /**
  * @coversDefaultClass \Drupal\migrate\Event\MigratePreRowSaveEvent
@@ -17,9 +20,9 @@ class MigratePreRowSaveEventTest extends EventBaseTest {
    * @covers ::getRow
    */
   public function testGetRow() {
-    $migration = $this->prophesize('\Drupal\migrate\Plugin\MigrationInterface')->reveal();
-    $message_service = $this->prophesize('\Drupal\migrate\MigrateMessageInterface')->reveal();
-    $row = $this->prophesize('\Drupal\migrate\Row')->reveal();
+    $migration = $this->prophesize(MigrationInterface::class)->reveal();
+    $message_service = $this->prophesize(MigrateMessageInterface::class)->reveal();
+    $row = $this->prophesize(Row::class)->reveal();
     $event = new MigratePreRowSaveEvent($migration, $message_service, $row);
     $this->assertSame($row, $event->getRow());
   }
diff --git a/core/modules/migrate/tests/src/Unit/MigrateExecutableMemoryExceededTest.php b/core/modules/migrate/tests/src/Unit/MigrateExecutableMemoryExceededTest.php
index d14e54a..6694060 100644
--- a/core/modules/migrate/tests/src/Unit/MigrateExecutableMemoryExceededTest.php
+++ b/core/modules/migrate/tests/src/Unit/MigrateExecutableMemoryExceededTest.php
@@ -2,6 +2,8 @@
 
 namespace Drupal\Tests\migrate\Unit;
 
+use Drupal\migrate\MigrateMessageInterface;
+
 /**
  * Tests the \Drupal\migrate\MigrateExecutable::memoryExceeded() method.
  *
@@ -52,7 +54,7 @@ class MigrateExecutableMemoryExceededTest extends MigrateTestCase {
   protected function setUp() {
     parent::setUp();
     $this->migration = $this->getMigration();
-    $this->message = $this->getMock('Drupal\migrate\MigrateMessageInterface');
+    $this->message = $this->getMock(MigrateMessageInterface::class);
 
     $this->executable = new TestMigrateExecutable($this->migration, $this->message);
     $this->executable->setStringTranslation($this->getStringTranslationStub());
diff --git a/core/modules/migrate/tests/src/Unit/MigrateExecutableTest.php b/core/modules/migrate/tests/src/Unit/MigrateExecutableTest.php
index 5e7cbac..03a2c9c 100644
--- a/core/modules/migrate/tests/src/Unit/MigrateExecutableTest.php
+++ b/core/modules/migrate/tests/src/Unit/MigrateExecutableTest.php
@@ -3,11 +3,15 @@
 namespace Drupal\Tests\migrate\Unit;
 
 use Drupal\Component\Utility\Html;
+use Drupal\migrate\Plugin\MigrateDestinationInterface;
 use Drupal\migrate\Plugin\MigrateProcessInterface;
 use Drupal\migrate\Plugin\MigrationInterface;
 use Drupal\migrate\Plugin\MigrateIdMapInterface;
+use Drupal\migrate\Plugin\MigrateSourceInterface;
 use Drupal\migrate\MigrateException;
+use Drupal\migrate\MigrateMessageInterface;
 use Drupal\migrate\Row;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 
 /**
  * @coversDefaultClass \Drupal\migrate\MigrateExecutable
@@ -51,8 +55,8 @@ class MigrateExecutableTest extends MigrateTestCase {
   protected function setUp() {
     parent::setUp();
     $this->migration = $this->getMigration();
-    $this->message = $this->getMock('Drupal\migrate\MigrateMessageInterface');
-    $event_dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
+    $this->message = $this->getMock(MigrateMessageInterface::class);
+    $event_dispatcher = $this->getMock(EventDispatcherInterface::class);
     $this->executable = new TestMigrateExecutable($this->migration, $this->message, $event_dispatcher);
     $this->executable->setStringTranslation($this->getStringTranslationStub());
   }
@@ -62,7 +66,7 @@ protected function setUp() {
    */
   public function testImportWithFailingRewind() {
     $exception_message = $this->getRandomGenerator()->string();
-    $source = $this->getMock('Drupal\migrate\Plugin\MigrateSourceInterface');
+    $source = $this->getMock(MigrateSourceInterface::class);
     $source->expects($this->once())
       ->method('rewind')
       ->will($this->throwException(new \Exception($exception_message)));
@@ -86,7 +90,7 @@ public function testImportWithFailingRewind() {
   public function testImportWithValidRow() {
     $source = $this->getMockSource();
 
-    $row = $this->getMockBuilder('Drupal\migrate\Row')
+    $row = $this->getMockBuilder(Row::class)
       ->disableOriginalConstructor()
       ->getMock();
 
@@ -109,7 +113,7 @@ public function testImportWithValidRow() {
       ->method('getProcessPlugins')
       ->will($this->returnValue([]));
 
-    $destination = $this->getMock('Drupal\migrate\Plugin\MigrateDestinationInterface');
+    $destination = $this->getMock(MigrateDestinationInterface::class);
     $destination->expects($this->once())
       ->method('import')
       ->with($row, ['test'])
@@ -128,7 +132,7 @@ public function testImportWithValidRow() {
   public function testImportWithValidRowWithoutDestinationId() {
     $source = $this->getMockSource();
 
-    $row = $this->getMockBuilder('Drupal\migrate\Row')
+    $row = $this->getMockBuilder(Row::class)
       ->disableOriginalConstructor()
       ->getMock();
 
@@ -151,7 +155,7 @@ public function testImportWithValidRowWithoutDestinationId() {
       ->method('getProcessPlugins')
       ->will($this->returnValue([]));
 
-    $destination = $this->getMock('Drupal\migrate\Plugin\MigrateDestinationInterface');
+    $destination = $this->getMock(MigrateDestinationInterface::class);
     $destination->expects($this->once())
       ->method('import')
       ->with($row, ['test'])
@@ -173,7 +177,7 @@ public function testImportWithValidRowWithoutDestinationId() {
   public function testImportWithValidRowNoDestinationValues() {
     $source = $this->getMockSource();
 
-    $row = $this->getMockBuilder('Drupal\migrate\Row')
+    $row = $this->getMockBuilder(Row::class)
       ->disableOriginalConstructor()
       ->getMock();
 
@@ -191,7 +195,7 @@ public function testImportWithValidRowNoDestinationValues() {
       ->method('getProcessPlugins')
       ->will($this->returnValue([]));
 
-    $destination = $this->getMock('Drupal\migrate\Plugin\MigrateDestinationInterface');
+    $destination = $this->getMock(MigrateDestinationInterface::class);
     $destination->expects($this->once())
       ->method('import')
       ->with($row, ['test'])
@@ -233,7 +237,7 @@ public function testImportWithValidRowWithDestinationMigrateException() {
     $exception_message = $this->getRandomGenerator()->string();
     $source = $this->getMockSource();
 
-    $row = $this->getMockBuilder('Drupal\migrate\Row')
+    $row = $this->getMockBuilder(Row::class)
       ->disableOriginalConstructor()
       ->getMock();
 
@@ -251,7 +255,7 @@ public function testImportWithValidRowWithDestinationMigrateException() {
       ->method('getProcessPlugins')
       ->will($this->returnValue([]));
 
-    $destination = $this->getMock('Drupal\migrate\Plugin\MigrateDestinationInterface');
+    $destination = $this->getMock(MigrateDestinationInterface::class);
     $destination->expects($this->once())
       ->method('import')
       ->with($row, ['test'])
@@ -285,7 +289,7 @@ public function testImportWithValidRowWithProcesMigrateException() {
     $exception_message = $this->getRandomGenerator()->string();
     $source = $this->getMockSource();
 
-    $row = $this->getMockBuilder('Drupal\migrate\Row')
+    $row = $this->getMockBuilder(Row::class)
       ->disableOriginalConstructor()
       ->getMock();
 
@@ -303,7 +307,7 @@ public function testImportWithValidRowWithProcesMigrateException() {
       ->method('getProcessPlugins')
       ->willThrowException(new MigrateException($exception_message));
 
-    $destination = $this->getMock('Drupal\migrate\Plugin\MigrateDestinationInterface');
+    $destination = $this->getMock(MigrateDestinationInterface::class);
     $destination->expects($this->never())
       ->method('import');
 
@@ -331,7 +335,7 @@ public function testImportWithValidRowWithException() {
     $exception_message = $this->getRandomGenerator()->string();
     $source = $this->getMockSource();
 
-    $row = $this->getMockBuilder('Drupal\migrate\Row')
+    $row = $this->getMockBuilder(Row::class)
       ->disableOriginalConstructor()
       ->getMock();
 
@@ -349,7 +353,7 @@ public function testImportWithValidRowWithException() {
       ->method('getProcessPlugins')
       ->will($this->returnValue([]));
 
-    $destination = $this->getMock('Drupal\migrate\Plugin\MigrateDestinationInterface');
+    $destination = $this->getMock(MigrateDestinationInterface::class);
     $destination->expects($this->once())
       ->method('import')
       ->with($row, ['test'])
@@ -387,7 +391,7 @@ public function testProcessRow() {
       'test1' => 'test1 destination'
     ];
     foreach ($expected as $key => $value) {
-      $plugins[$key][0] = $this->getMock('Drupal\migrate\Plugin\MigrateProcessInterface');
+      $plugins[$key][0] = $this->getMock(MigrateProcessInterface::class);
       $plugins[$key][0]->expects($this->once())
         ->method('getPluginDefinition')
         ->will($this->returnValue([]));
@@ -446,7 +450,7 @@ public function testProcessRowPipelineException() {
    *   The mocked migration source.
    */
   protected function getMockSource() {
-    $iterator = $this->getMock('\Iterator');
+    $iterator = $this->getMock(\Iterator::class);
 
     $class = 'Drupal\migrate\Plugin\migrate\source\SourcePluginBase';
     $source = $this->getMockBuilder($class)
diff --git a/core/modules/migrate/tests/src/Unit/MigrateSourceTest.php b/core/modules/migrate/tests/src/Unit/MigrateSourceTest.php
index 7f3d293..13b3f9c 100644
--- a/core/modules/migrate/tests/src/Unit/MigrateSourceTest.php
+++ b/core/modules/migrate/tests/src/Unit/MigrateSourceTest.php
@@ -14,10 +14,12 @@
 use Drupal\Core\KeyValueStore\KeyValueStoreInterface;
 use Drupal\migrate\MigrateException;
 use Drupal\migrate\MigrateExecutable;
+use Drupal\migrate\MigrateMessageInterface;
 use Drupal\migrate\MigrateSkipRowException;
 use Drupal\migrate\Plugin\migrate\source\SourcePluginBase;
 use Drupal\migrate\Plugin\MigrateIdMapInterface;
 use Drupal\migrate\Row;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 
 /**
  * @coversDefaultClass \Drupal\migrate\Plugin\migrate\source\SourcePluginBase
@@ -440,9 +442,9 @@ public function testDefaultPropertiesValues() {
    */
   protected function getMigrateExecutable($migration) {
     /** @var \Drupal\migrate\MigrateMessageInterface $message */
-    $message = $this->getMock('Drupal\migrate\MigrateMessageInterface');
+    $message = $this->getMock(MigrateMessageInterface::class);
     /** @var \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher */
-    $event_dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
+    $event_dispatcher = $this->getMock(EventDispatcherInterface::class);
     return new MigrateExecutable($migration, $message, $event_dispatcher);
   }
 
diff --git a/core/modules/migrate/tests/src/Unit/MigrateSqlIdMapEnsureTablesTest.php b/core/modules/migrate/tests/src/Unit/MigrateSqlIdMapEnsureTablesTest.php
index 3c3cba8..91eea3b 100644
--- a/core/modules/migrate/tests/src/Unit/MigrateSqlIdMapEnsureTablesTest.php
+++ b/core/modules/migrate/tests/src/Unit/MigrateSqlIdMapEnsureTablesTest.php
@@ -2,7 +2,11 @@
 
 namespace Drupal\Tests\migrate\Unit;
 
+use Drupal\Core\Database\Connection;
+use Drupal\Core\Database\Schema;
 use Drupal\migrate\Plugin\MigrateIdMapInterface;
+use Drupal\migrate\Plugin\MigrateSourceInterface;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 
 /**
  * Tests the SQL ID map plugin ensureTables() method.
@@ -80,7 +84,7 @@ public function testEnsureTablesNotExist() {
         'source' => ['sourceid1', 'sourceid2'],
       ],
     ];
-    $schema = $this->getMockBuilder('Drupal\Core\Database\Schema')
+    $schema = $this->getMockBuilder(Schema::class)
       ->disableOriginalConstructor()
       ->getMock();
     $schema->expects($this->at(0))
@@ -136,7 +140,7 @@ public function testEnsureTablesNotExist() {
    * Tests the ensureTables method when the tables exist.
    */
   public function testEnsureTablesExist() {
-    $schema = $this->getMockBuilder('Drupal\Core\Database\Schema')
+    $schema = $this->getMockBuilder(Schema::class)
       ->disableOriginalConstructor()
       ->getMock();
     $schema->expects($this->at(0))
@@ -198,14 +202,14 @@ public function testEnsureTablesExist() {
    *   it are the actual test and there are no additional asserts added.
    */
   protected function runEnsureTablesTest($schema) {
-    $database = $this->getMockBuilder('Drupal\Core\Database\Connection')
+    $database = $this->getMockBuilder(Connection::class)
       ->disableOriginalConstructor()
       ->getMock();
     $database->expects($this->any())
       ->method('schema')
       ->willReturn($schema);
     $migration = $this->getMigration();
-    $plugin = $this->getMock('Drupal\migrate\Plugin\MigrateSourceInterface');
+    $plugin = $this->getMock(MigrateSourceInterface::class);
     $plugin->expects($this->any())
       ->method('getIds')
       ->willReturn([
@@ -219,7 +223,7 @@ protected function runEnsureTablesTest($schema) {
     $migration->expects($this->any())
       ->method('getSourcePlugin')
       ->willReturn($plugin);
-    $plugin = $this->getMock('Drupal\migrate\Plugin\MigrateSourceInterface');
+    $plugin = $this->getMock(MigrateSourceInterface::class);
     $plugin->expects($this->any())
       ->method('getIds')
       ->willReturn([
@@ -231,7 +235,7 @@ protected function runEnsureTablesTest($schema) {
       ->method('getDestinationPlugin')
       ->willReturn($plugin);
     /** @var \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher */
-    $event_dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
+    $event_dispatcher = $this->getMock(EventDispatcherInterface::class);
     $map = new TestSqlIdMap($database, [], 'sql', [], $migration, $event_dispatcher);
     $map->getDatabase();
   }
diff --git a/core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php b/core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php
index 2ad2b3d..e8f1ffd 100644
--- a/core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php
+++ b/core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php
@@ -3,10 +3,14 @@
 namespace Drupal\Tests\migrate\Unit;
 
 use Drupal\Core\Database\Driver\sqlite\Connection;
+use Drupal\migrate\Plugin\MigrateDestinationInterface;
 use Drupal\migrate\Plugin\MigrationInterface;
 use Drupal\migrate\MigrateException;
+use Drupal\migrate\MigrateMessageInterface;
 use Drupal\migrate\Plugin\MigrateIdMapInterface;
+use Drupal\migrate\Plugin\MigrateSourceInterface;
 use Drupal\migrate\Row;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 
 /**
  * Tests the SQL ID map plugin.
@@ -95,7 +99,7 @@ protected function saveMap(array $map) {
   protected function getIdMap() {
     $migration = $this->getMigration();
 
-    $plugin = $this->getMock('Drupal\migrate\Plugin\MigrateSourceInterface');
+    $plugin = $this->getMock(MigrateSourceInterface::class);
     $plugin
       ->method('getIds')
       ->willReturn($this->sourceIds);
@@ -103,14 +107,14 @@ protected function getIdMap() {
       ->method('getSourcePlugin')
       ->willReturn($plugin);
 
-    $plugin = $this->getMock('Drupal\migrate\Plugin\MigrateDestinationInterface');
+    $plugin = $this->getMock(MigrateDestinationInterface::class);
     $plugin
       ->method('getIds')
       ->willReturn($this->destinationIds);
     $migration
       ->method('getDestinationPlugin')
       ->willReturn($plugin);
-    $event_dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
+    $event_dispatcher = $this->getMock(EventDispatcherInterface::class);
 
     $id_map = new TestSqlIdMap($this->database, [], 'sql', [], $migration, $event_dispatcher);
     $migration
@@ -191,7 +195,7 @@ public function testSaveIdMapping() {
    * Tests the SQL ID map set message method.
    */
   public function testSetMessage() {
-    $message = $this->getMock('Drupal\migrate\MigrateMessageInterface');
+    $message = $this->getMock(MigrateMessageInterface::class);
     $id_map = $this->getIdMap();
     $id_map->setMessage($message);
     $this->assertAttributeEquals($message, 'message', $id_map);
diff --git a/core/modules/migrate/tests/src/Unit/MigrationPluginManagerTest.php b/core/modules/migrate/tests/src/Unit/MigrationPluginManagerTest.php
index 91351cf..488fd89 100644
--- a/core/modules/migrate/tests/src/Unit/MigrationPluginManagerTest.php
+++ b/core/modules/migrate/tests/src/Unit/MigrationPluginManagerTest.php
@@ -2,6 +2,9 @@
 
 namespace Drupal\Tests\migrate\Unit;
 
+use Drupal\Core\Cache\CacheBackendInterface;
+use Drupal\Core\Extension\ModuleHandlerInterface;
+use Drupal\Core\Language\LanguageManagerInterface;
 use Drupal\migrate\Plugin\Migration;
 use Drupal\migrate\Plugin\MigrationPluginManager;
 use Drupal\Tests\UnitTestCase;
@@ -26,9 +29,9 @@ public function setUp() {
     parent::setUp();
 
     // Get a plugin manager for testing.
-    $module_handler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface');
-    $cache_backend = $this->getMock('Drupal\Core\Cache\CacheBackendInterface');
-    $language_manager = $this->getMock('Drupal\Core\Language\LanguageManagerInterface');
+    $module_handler = $this->getMock(ModuleHandlerInterface::class);
+    $cache_backend = $this->getMock(CacheBackendInterface::class);
+    $language_manager = $this->getMock(LanguageManagerInterface::class);
     $this->pluginManager = new MigrationPluginManager($module_handler, $cache_backend, $language_manager);
   }
 
diff --git a/core/modules/migrate/tests/src/Unit/MigrationTest.php b/core/modules/migrate/tests/src/Unit/MigrationTest.php
index 649104b..43f4c6a 100644
--- a/core/modules/migrate/tests/src/Unit/MigrationTest.php
+++ b/core/modules/migrate/tests/src/Unit/MigrationTest.php
@@ -14,6 +14,8 @@
 use Drupal\migrate\Plugin\MigrateSourceInterface;
 use Drupal\migrate\Plugin\MigrationPluginManagerInterface;
 use Drupal\migrate\Plugin\RequirementsInterface;
+use Drupal\Tests\migrate\Unit\RequirementsAwareDestinationInterface;
+use Drupal\Tests\migrate\Unit\RequirementsAwareSourceInterface;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -31,11 +33,11 @@ class MigrationTest extends UnitTestCase {
   public function testRequirementsForSourcePlugin() {
     $migration = new TestMigration();
 
-    $source_plugin = $this->getMock('Drupal\Tests\migrate\Unit\RequirementsAwareSourceInterface');
+    $source_plugin = $this->getMock(RequirementsAwareSourceInterface::class);
     $source_plugin->expects($this->once())
       ->method('checkRequirements')
       ->willThrowException(new RequirementsException('Missing source requirement', ['key' => 'value']));
-    $destination_plugin = $this->getMock('Drupal\Tests\migrate\Unit\RequirementsAwareDestinationInterface');
+    $destination_plugin = $this->getMock(RequirementsAwareDestinationInterface::class);
 
     $migration->setSourcePlugin($source_plugin);
     $migration->setDestinationPlugin($destination_plugin);
@@ -52,8 +54,8 @@ public function testRequirementsForSourcePlugin() {
   public function testRequirementsForDestinationPlugin() {
     $migration = new TestMigration();
 
-    $source_plugin = $this->getMock('Drupal\migrate\Plugin\MigrateSourceInterface');
-    $destination_plugin = $this->getMock('Drupal\Tests\migrate\Unit\RequirementsAwareDestinationInterface');
+    $source_plugin = $this->getMock(MigrateSourceInterface::class);
+    $destination_plugin = $this->getMock(RequirementsAwareDestinationInterface::class);
     $destination_plugin->expects($this->once())
       ->method('checkRequirements')
       ->willThrowException(new RequirementsException('Missing destination requirement', ['key' => 'value']));
@@ -74,12 +76,12 @@ public function testRequirementsForMigrations() {
     $migration = new TestMigration();
 
     // Setup source and destination plugins without any requirements.
-    $source_plugin = $this->getMock('Drupal\migrate\Plugin\MigrateSourceInterface');
-    $destination_plugin = $this->getMock('Drupal\migrate\Plugin\MigrateDestinationInterface');
+    $source_plugin = $this->getMock(MigrateSourceInterface::class);
+    $destination_plugin = $this->getMock(MigrateDestinationInterface::class);
     $migration->setSourcePlugin($source_plugin);
     $migration->setDestinationPlugin($destination_plugin);
 
-    $plugin_manager = $this->getMock('Drupal\migrate\Plugin\MigrationPluginManagerInterface');
+    $plugin_manager = $this->getMock(MigrationPluginManagerInterface::class);
     $migration->setMigrationPluginManager($plugin_manager);
 
     // We setup the requirements that test_a doesn't exist and test_c is not
diff --git a/core/modules/migrate/tests/src/Unit/SqlBaseTest.php b/core/modules/migrate/tests/src/Unit/SqlBaseTest.php
index b8097a3..8b872fa 100644
--- a/core/modules/migrate/tests/src/Unit/SqlBaseTest.php
+++ b/core/modules/migrate/tests/src/Unit/SqlBaseTest.php
@@ -7,6 +7,8 @@
 
 namespace Drupal\Tests\migrate\Unit;
 
+use Drupal\Core\Database\Connection;
+use Drupal\migrate\Plugin\migrate\id_map\Sql;
 use Drupal\migrate\Plugin\MigrationInterface;
 use Drupal\migrate\Plugin\migrate\source\SqlBase;
 use Drupal\Tests\UnitTestCase;
@@ -38,7 +40,7 @@ class SqlBaseTest extends UnitTestCase {
    */
   public function testMapJoinable($expected_result, $id_map_is_sql, $with_id_map, $source_options = [], $idmap_options = []) {
     // Setup a connection object.
-    $source_connection = $this->getMockBuilder('Drupal\Core\Database\Connection')
+    $source_connection = $this->getMockBuilder(Connection::class)
       ->disableOriginalConstructor()
       ->getMock();
     $source_connection->expects($id_map_is_sql && $with_id_map ? $this->once() : $this->never())
@@ -46,7 +48,7 @@ public function testMapJoinable($expected_result, $id_map_is_sql, $with_id_map,
       ->willReturn($source_options);
 
     // Setup the ID map connection.
-    $idmap_connection = $this->getMockBuilder('Drupal\Core\Database\Connection')
+    $idmap_connection = $this->getMockBuilder(Connection::class)
       ->disableOriginalConstructor()
       ->getMock();
     $idmap_connection->expects($id_map_is_sql && $with_id_map ? $this->once() : $this->never())
@@ -54,7 +56,7 @@ public function testMapJoinable($expected_result, $id_map_is_sql, $with_id_map,
       ->willReturn($idmap_options);
 
     // Setup the Sql object.
-    $sql = $this->getMockBuilder('Drupal\migrate\Plugin\migrate\id_map\Sql')
+    $sql = $this->getMockBuilder(Sql::class)
       ->disableOriginalConstructor()
       ->getMock();
     $sql->expects($id_map_is_sql && $with_id_map ? $this->once() : $this->never())
diff --git a/core/modules/migrate/tests/src/Unit/destination/ConfigTest.php b/core/modules/migrate/tests/src/Unit/destination/ConfigTest.php
index b57cffe..fd37fe9 100644
--- a/core/modules/migrate/tests/src/Unit/destination/ConfigTest.php
+++ b/core/modules/migrate/tests/src/Unit/destination/ConfigTest.php
@@ -2,6 +2,11 @@
 
 namespace Drupal\Tests\migrate\Unit\destination;
 
+use Drupal\Core\Config\Config;
+use Drupal\Core\Config\ConfigFactoryInterface;
+use Drupal\language\ConfigurableLanguageManagerInterface;
+use Drupal\migrate\Row;
+use Drupal\migrate\Plugin\Migration;
 use Drupal\migrate\Plugin\MigrationInterface;
 use Drupal\migrate\Plugin\migrate\destination\Config;
 use Drupal\Tests\UnitTestCase;
@@ -19,10 +24,10 @@ public function testImport() {
     $source = [
       'test' => 'x',
     ];
-    $migration = $this->getMockBuilder('Drupal\migrate\Plugin\Migration')
+    $migration = $this->getMockBuilder(Migration::class)
       ->disableOriginalConstructor()
       ->getMock();
-    $config = $this->getMockBuilder('Drupal\Core\Config\Config')
+    $config = $this->getMockBuilder(Config::class)
       ->disableOriginalConstructor()
       ->getMock();
     foreach ($source as $key => $val) {
@@ -36,18 +41,18 @@ public function testImport() {
     $config->expects($this->once())
       ->method('getName')
       ->willReturn('d8_config');
-    $config_factory = $this->getMock('Drupal\Core\Config\ConfigFactoryInterface');
+    $config_factory = $this->getMock(ConfigFactoryInterface::class);
     $config_factory->expects($this->once())
       ->method('getEditable')
       ->with('d8_config')
       ->will($this->returnValue($config));
-    $row = $this->getMockBuilder('Drupal\migrate\Row')
+    $row = $this->getMockBuilder(Row::class)
       ->disableOriginalConstructor()
       ->getMock();
     $row->expects($this->any())
       ->method('getRawDestination')
       ->will($this->returnValue($source));
-    $language_manager = $this->getMockBuilder('Drupal\language\ConfigurableLanguageManagerInterface')
+    $language_manager = $this->getMockBuilder(ConfigurableLanguageManagerInterface::class)
       ->disableOriginalConstructor()
       ->getMock();
     $language_manager->expects($this->never())
@@ -69,7 +74,7 @@ public function testLanguageImport() {
     $migration = $this->getMockBuilder(MigrationInterface::class)
       ->disableOriginalConstructor()
       ->getMock();
-    $config = $this->getMockBuilder('Drupal\Core\Config\Config')
+    $config = $this->getMockBuilder(Config::class)
       ->disableOriginalConstructor()
       ->getMock();
     foreach ($source as $key => $val) {
@@ -83,12 +88,12 @@ public function testLanguageImport() {
     $config->expects($this->any())
       ->method('getName')
       ->willReturn('d8_config');
-    $config_factory = $this->getMock('Drupal\Core\Config\ConfigFactoryInterface');
+    $config_factory = $this->getMock(ConfigFactoryInterface::class);
     $config_factory->expects($this->once())
       ->method('getEditable')
       ->with('d8_config')
       ->will($this->returnValue($config));
-    $row = $this->getMockBuilder('Drupal\migrate\Row')
+    $row = $this->getMockBuilder(Row::class)
       ->disableOriginalConstructor()
       ->getMock();
     $row->expects($this->any())
@@ -97,7 +102,7 @@ public function testLanguageImport() {
     $row->expects($this->any())
       ->method('getDestinationProperty')
       ->will($this->returnValue($source['langcode']));
-    $language_manager = $this->getMockBuilder('Drupal\language\ConfigurableLanguageManagerInterface')
+    $language_manager = $this->getMockBuilder(ConfigurableLanguageManagerInterface::class)
       ->disableOriginalConstructor()
       ->getMock();
     $language_manager->expects($this->any())
diff --git a/core/modules/migrate/tests/src/Unit/destination/EntityRevisionTest.php b/core/modules/migrate/tests/src/Unit/destination/EntityRevisionTest.php
index f68c2be..db92600 100644
--- a/core/modules/migrate/tests/src/Unit/destination/EntityRevisionTest.php
+++ b/core/modules/migrate/tests/src/Unit/destination/EntityRevisionTest.php
@@ -9,6 +9,10 @@
 
 use Drupal\Core\Entity\ContentEntityInterface;
 use Drupal\Core\Entity\EntityInterface;
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Entity\EntityStorageInterface;
+use Drupal\Core\Entity\EntityTypeInterface;
+use Drupal\Core\Field\FieldTypePluginManagerInterface;
 use Drupal\migrate\Plugin\MigrationInterface;
 use Drupal\migrate\Plugin\migrate\destination\EntityRevision as RealEntityRevision;
 use Drupal\migrate\Row;
@@ -47,9 +51,9 @@ protected function setUp() {
 
     // Setup mocks to be used when creating a revision destination.
     $this->migration = $this->prophesize(MigrationInterface::class);
-    $this->storage = $this->prophesize('\Drupal\Core\Entity\EntityStorageInterface');
-    $this->entityManager = $this->prophesize('\Drupal\Core\Entity\EntityManagerInterface');
-    $this->fieldTypeManager = $this->prophesize('\Drupal\Core\Field\FieldTypePluginManagerInterface');
+    $this->storage = $this->prophesize(EntityStorageInterface::class);
+    $this->entityManager = $this->prophesize(EntityManagerInterface::class);
+    $this->fieldTypeManager = $this->prophesize(FieldTypePluginManagerInterface::class);
   }
 
   /**
@@ -60,7 +64,7 @@ protected function setUp() {
   public function testGetEntityDestinationValues() {
     $destination = $this->getEntityRevisionDestination([]);
     // Return a dummy because we don't care what gets called.
-    $entity = $this->prophesize('\Drupal\Core\Entity\EntityInterface')
+    $entity = $this->prophesize(EntityInterface::class)
       ->willImplement('\Drupal\Core\Entity\RevisionableInterface');
     // Assert that the first ID from the destination values is used to load the
     // entity.
@@ -78,10 +82,10 @@ public function testGetEntityDestinationValues() {
    */
   public function testGetEntityUpdateRevision() {
     $destination = $this->getEntityRevisionDestination([]);
-    $entity = $this->prophesize('\Drupal\Core\Entity\EntityInterface')
+    $entity = $this->prophesize(EntityInterface::class)
       ->willImplement('\Drupal\Core\Entity\RevisionableInterface');
 
-    $entity_type = $this->prophesize('\Drupal\Core\Entity\EntityTypeInterface');
+    $entity_type = $this->prophesize(EntityTypeInterface::class);
     $entity_type->getKey('id')->willReturn('nid');
     $entity_type->getKey('revision')->willReturn('vid');
     $this->storage->getEntityType()->willReturn($entity_type->reveal());
@@ -106,10 +110,10 @@ public function testGetEntityUpdateRevision() {
    */
   public function testGetEntityNewRevision() {
     $destination = $this->getEntityRevisionDestination([]);
-    $entity = $this->prophesize('\Drupal\Core\Entity\EntityInterface')
+    $entity = $this->prophesize(EntityInterface::class)
       ->willImplement('\Drupal\Core\Entity\RevisionableInterface');
 
-    $entity_type = $this->prophesize('\Drupal\Core\Entity\EntityTypeInterface');
+    $entity_type = $this->prophesize(EntityTypeInterface::class);
     $entity_type->getKey('id')->willReturn('nid');
     $entity_type->getKey('revision')->willReturn('vid');
     $this->storage->getEntityType()->willReturn($entity_type->reveal());
@@ -138,7 +142,7 @@ public function testGetEntityNewRevision() {
   public function testGetEntityLoadFailure() {
     $destination = $this->getEntityRevisionDestination([]);
 
-    $entity_type = $this->prophesize('\Drupal\Core\Entity\EntityTypeInterface');
+    $entity_type = $this->prophesize(EntityTypeInterface::class);
     $entity_type->getKey('id')->willReturn('nid');
     $entity_type->getKey('revision')->willReturn('vid');
     $this->storage->getEntityType()->willReturn($entity_type->reveal());
@@ -159,7 +163,7 @@ public function testGetEntityLoadFailure() {
    * @covers ::save
    */
   public function testSave() {
-    $entity = $this->prophesize('\Drupal\Core\Entity\ContentEntityInterface');
+    $entity = $this->prophesize(ContentEntityInterface::class);
     $entity->save()
       ->shouldBeCalled();
     $entity->getRevisionId()
diff --git a/core/modules/migrate/tests/src/Unit/destination/PerComponentEntityDisplayTest.php b/core/modules/migrate/tests/src/Unit/destination/PerComponentEntityDisplayTest.php
index 6deaec8..6b0f0f1 100644
--- a/core/modules/migrate/tests/src/Unit/destination/PerComponentEntityDisplayTest.php
+++ b/core/modules/migrate/tests/src/Unit/destination/PerComponentEntityDisplayTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\Tests\migrate\Unit\destination;
 
+use Drupal\Core\Entity\Entity\EntityViewDisplay;
 use Drupal\migrate\Plugin\migrate\destination\ComponentEntityDisplayBase;
 use Drupal\migrate\Row;
 use Drupal\Tests\migrate\Unit\MigrateTestCase;
@@ -33,7 +34,7 @@ public function testImport() {
     foreach ($values as $key => $value) {
       $row->setDestinationProperty($key, $value);
     }
-    $entity = $this->getMockBuilder('Drupal\Core\Entity\Entity\EntityViewDisplay')
+    $entity = $this->getMockBuilder(EntityViewDisplay::class)
       ->disableOriginalConstructor()
       ->getMock();
     $entity->expects($this->once())
diff --git a/core/modules/migrate/tests/src/Unit/destination/PerComponentEntityFormDisplayTest.php b/core/modules/migrate/tests/src/Unit/destination/PerComponentEntityFormDisplayTest.php
index 0424ceb..7e904d4 100644
--- a/core/modules/migrate/tests/src/Unit/destination/PerComponentEntityFormDisplayTest.php
+++ b/core/modules/migrate/tests/src/Unit/destination/PerComponentEntityFormDisplayTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\Tests\migrate\Unit\destination;
 
+use Drupal\Core\Entity\Entity\EntityFormDisplay;
 use Drupal\migrate\Plugin\migrate\destination\PerComponentEntityFormDisplay;
 use Drupal\migrate\Row;
 use Drupal\Tests\migrate\Unit\MigrateTestCase;
@@ -33,7 +34,7 @@ public function testImport() {
     foreach ($values as $key => $value) {
       $row->setDestinationProperty($key, $value);
     }
-    $entity = $this->getMockBuilder('Drupal\Core\Entity\Entity\EntityFormDisplay')
+    $entity = $this->getMockBuilder(EntityFormDisplay::class)
       ->disableOriginalConstructor()
       ->getMock();
     $entity->expects($this->once())
diff --git a/core/modules/migrate/tests/src/Unit/process/DedupeEntityTest.php b/core/modules/migrate/tests/src/Unit/process/DedupeEntityTest.php
index 3775334..b21c151 100644
--- a/core/modules/migrate/tests/src/Unit/process/DedupeEntityTest.php
+++ b/core/modules/migrate/tests/src/Unit/process/DedupeEntityTest.php
@@ -5,6 +5,7 @@
 use Drupal\Core\Entity\EntityStorageInterface;
 use Drupal\Core\Entity\EntityTypeManagerInterface;
 use Drupal\Core\Entity\Query\QueryInterface;
+use Drupal\migrate\MigrateException;
 use Drupal\migrate\Plugin\migrate\process\DedupeEntity;
 use Drupal\Component\Utility\Unicode;
 
@@ -43,7 +44,7 @@ class DedupeEntityTest extends MigrateProcessTestCase {
    * {@inheritdoc}
    */
   protected function setUp() {
-    $this->entityQuery = $this->getMockBuilder('Drupal\Core\Entity\Query\QueryInterface')
+    $this->entityQuery = $this->getMockBuilder(QueryInterface::class)
       ->disableOriginalConstructor()
       ->getMock();
     $this->entityTypeManager = $this->getMock(EntityTypeManagerInterface::class);
@@ -93,7 +94,7 @@ public function testDedupeEntityInvalidStart() {
       'start' => 'foobar',
     ];
     $plugin = new DedupeEntity($configuration, 'dedupe_entity', [], $this->getMigration(), $this->entityTypeManager);
-    $this->setExpectedException('Drupal\migrate\MigrateException', 'The start position configuration key should be an integer. Omit this key to capture from the beginning of the string.');
+    $this->setExpectedException(MigrateException::class, 'The start position configuration key should be an integer. Omit this key to capture from the beginning of the string.');
     $plugin->transform('test_start', $this->migrateExecutable, $this->row, 'testproperty');
   }
 
@@ -107,7 +108,7 @@ public function testDedupeEntityInvalidLength() {
       'length' => 'foobar',
     ];
     $plugin = new DedupeEntity($configuration, 'dedupe_entity', [], $this->getMigration(), $this->entityTypeManager);
-    $this->setExpectedException('Drupal\migrate\MigrateException', 'The character length configuration key should be an integer. Omit this key to capture the entire string.');
+    $this->setExpectedException(MigrateException::class, 'The character length configuration key should be an integer. Omit this key to capture the entire string.');
     $plugin->transform('test_length', $this->migrateExecutable, $this->row, 'testproperty');
   }
 
diff --git a/core/modules/migrate/tests/src/Unit/process/IteratorTest.php b/core/modules/migrate/tests/src/Unit/process/IteratorTest.php
index 46daade..2cb955f 100644
--- a/core/modules/migrate/tests/src/Unit/process/IteratorTest.php
+++ b/core/modules/migrate/tests/src/Unit/process/IteratorTest.php
@@ -3,10 +3,12 @@
 namespace Drupal\Tests\migrate\Unit\process;
 
 use Drupal\migrate\MigrateExecutable;
+use Drupal\migrate\MigrateMessageInterface;
 use Drupal\migrate\Plugin\migrate\process\Get;
 use Drupal\migrate\Plugin\migrate\process\Iterator;
 use Drupal\migrate\Row;
 use Drupal\Tests\migrate\Unit\MigrateTestCase;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 
 /**
  * Tests the iterator process plugin.
@@ -58,8 +60,8 @@ public function testIterator() {
     $migration->expects($this->at(2))
       ->method('getProcessPlugins')
       ->will($this->returnValue($key_plugin));
-    $event_dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
-    $migrate_executable = new MigrateExecutable($migration, $this->getMock('Drupal\migrate\MigrateMessageInterface'), $event_dispatcher);
+    $event_dispatcher = $this->getMock(EventDispatcherInterface::class);
+    $migrate_executable = new MigrateExecutable($migration, $this->getMock(MigrateMessageInterface::class), $event_dispatcher);
 
     // The current value of the pipeline.
     $current_value = [
diff --git a/core/modules/migrate/tests/src/Unit/process/MachineNameTest.php b/core/modules/migrate/tests/src/Unit/process/MachineNameTest.php
index 5bc9158..866c242 100644
--- a/core/modules/migrate/tests/src/Unit/process/MachineNameTest.php
+++ b/core/modules/migrate/tests/src/Unit/process/MachineNameTest.php
@@ -2,6 +2,9 @@
 
 namespace Drupal\Tests\migrate\Unit\process;
 
+use Drupal\Component\Transliteration\TransliterationInterface;
+use Drupal\migrate\MigrateExecutable;
+use Drupal\migrate\Row;
 use Drupal\migrate\Plugin\migrate\process\MachineName;
 
 /**
@@ -22,13 +25,13 @@ class MachineNameTest extends MigrateProcessTestCase {
    * {@inheritdoc}
    */
   protected function setUp() {
-    $this->transliteration = $this->getMockBuilder('Drupal\Component\Transliteration\TransliterationInterface')
+    $this->transliteration = $this->getMockBuilder(TransliterationInterface::class)
       ->disableOriginalConstructor()
       ->getMock();
-    $this->row = $this->getMockBuilder('Drupal\migrate\Row')
+    $this->row = $this->getMockBuilder(Row::class)
       ->disableOriginalConstructor()
       ->getMock();
-    $this->migrateExecutable = $this->getMockBuilder('Drupal\migrate\MigrateExecutable')
+    $this->migrateExecutable = $this->getMockBuilder(MigrateExecutable::class)
       ->disableOriginalConstructor()
       ->getMock();
     parent::setUp();
diff --git a/core/modules/migrate/tests/src/Unit/process/MakeUniqueEntityFieldTest.php b/core/modules/migrate/tests/src/Unit/process/MakeUniqueEntityFieldTest.php
index 2f33e62..d02cc71 100644
--- a/core/modules/migrate/tests/src/Unit/process/MakeUniqueEntityFieldTest.php
+++ b/core/modules/migrate/tests/src/Unit/process/MakeUniqueEntityFieldTest.php
@@ -5,6 +5,7 @@
 use Drupal\Core\Entity\EntityStorageInterface;
 use Drupal\Core\Entity\EntityTypeManagerInterface;
 use Drupal\Core\Entity\Query\QueryInterface;
+use Drupal\migrate\MigrateException;
 use Drupal\migrate\Plugin\migrate\process\MakeUniqueEntityField;
 use Drupal\Component\Utility\Unicode;
 
@@ -42,7 +43,7 @@ class MakeUniqueEntityFieldTest extends MigrateProcessTestCase {
    * {@inheritdoc}
    */
   protected function setUp() {
-    $this->entityQuery = $this->getMockBuilder('Drupal\Core\Entity\Query\QueryInterface')
+    $this->entityQuery = $this->getMockBuilder(QueryInterface::class)
       ->disableOriginalConstructor()
       ->getMock();
     $this->entityTypeManager = $this->getMock(EntityTypeManagerInterface::class);
@@ -92,7 +93,7 @@ public function testMakeUniqueEntityFieldEntityInvalidStart() {
       'start' => 'foobar',
     ];
     $plugin = new MakeUniqueEntityField($configuration, 'make_unique', [], $this->getMigration(), $this->entityTypeManager);
-    $this->setExpectedException('Drupal\migrate\MigrateException', 'The start position configuration key should be an integer. Omit this key to capture from the beginning of the string.');
+    $this->setExpectedException(MigrateException::class, 'The start position configuration key should be an integer. Omit this key to capture from the beginning of the string.');
     $plugin->transform('test_start', $this->migrateExecutable, $this->row, 'testproperty');
   }
 
@@ -106,7 +107,7 @@ public function testMakeUniqueEntityFieldEntityInvalidLength() {
       'length' => 'foobar',
     ];
     $plugin = new MakeUniqueEntityField($configuration, 'make_unique', [], $this->getMigration(), $this->entityTypeManager);
-    $this->setExpectedException('Drupal\migrate\MigrateException', 'The character length configuration key should be an integer. Omit this key to capture the entire string.');
+    $this->setExpectedException(MigrateException::class, 'The character length configuration key should be an integer. Omit this key to capture the entire string.');
     $plugin->transform('test_length', $this->migrateExecutable, $this->row, 'testproperty');
   }
 
diff --git a/core/modules/migrate/tests/src/Unit/process/MigrationLookupTest.php b/core/modules/migrate/tests/src/Unit/process/MigrationLookupTest.php
index f30c184..df10efe 100644
--- a/core/modules/migrate/tests/src/Unit/process/MigrationLookupTest.php
+++ b/core/modules/migrate/tests/src/Unit/process/MigrationLookupTest.php
@@ -10,6 +10,7 @@
 use Drupal\migrate\Plugin\MigrateIdMapInterface;
 use Drupal\migrate\Plugin\MigratePluginManager;
 use Drupal\migrate\Plugin\MigrateSourceInterface;
+use Drupal\migrate\Plugin\Migration;
 use Drupal\migrate\Plugin\MigrationPluginManagerInterface;
 use Prophecy\Argument;
 
@@ -58,7 +59,7 @@ public function testTransformWithStubbing() {
     $process_plugin_manager = $this->prophesize(MigratePluginManager::class);
 
     $destination_id_map = $this->prophesize(MigrateIdMapInterface::class);
-    $destination_migration = $this->prophesize('Drupal\migrate\Plugin\Migration');
+    $destination_migration = $this->prophesize(Migration::class);
     $destination_migration->getIdMap()->willReturn($destination_id_map->reveal());
     $migration_plugin_manager->createInstances(['destination_migration'])
       ->willReturn(['destination_migration' => $destination_migration->reveal()]);
diff --git a/core/modules/migrate/tests/src/Unit/process/SubProcessTest.php b/core/modules/migrate/tests/src/Unit/process/SubProcessTest.php
index dfcdec3..2bc142c 100644
--- a/core/modules/migrate/tests/src/Unit/process/SubProcessTest.php
+++ b/core/modules/migrate/tests/src/Unit/process/SubProcessTest.php
@@ -3,10 +3,12 @@
 namespace Drupal\Tests\migrate\Unit\process;
 
 use Drupal\migrate\MigrateExecutable;
+use Drupal\migrate\MigrateMessageInterface;
 use Drupal\migrate\Plugin\migrate\process\Get;
 use Drupal\migrate\Plugin\migrate\process\SubProcess;
 use Drupal\migrate\Row;
 use Drupal\Tests\migrate\Unit\MigrateTestCase;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 
 /**
  * Tests the sub_process process plugin.
@@ -56,8 +58,8 @@ public function testSubProcess() {
     $migration->expects($this->at(2))
       ->method('getProcessPlugins')
       ->will($this->returnValue($key_plugin));
-    $event_dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
-    $migrate_executable = new MigrateExecutable($migration, $this->getMock('Drupal\migrate\MigrateMessageInterface'), $event_dispatcher);
+    $event_dispatcher = $this->getMock(EventDispatcherInterface::class);
+    $migrate_executable = new MigrateExecutable($migration, $this->getMock(MigrateMessageInterface::class), $event_dispatcher);
 
     // The current value of the pipeline.
     $current_value = [
diff --git a/core/modules/migrate_drupal/tests/src/Unit/source/DrupalSqlBaseTest.php b/core/modules/migrate_drupal/tests/src/Unit/source/DrupalSqlBaseTest.php
index 6dd5925..23d319c 100644
--- a/core/modules/migrate_drupal/tests/src/Unit/source/DrupalSqlBaseTest.php
+++ b/core/modules/migrate_drupal/tests/src/Unit/source/DrupalSqlBaseTest.php
@@ -2,6 +2,8 @@
 
 namespace Drupal\Tests\migrate_drupal\Unit\source;
 
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\State\StateInterface;
 use Drupal\Tests\migrate\Unit\MigrateTestCase;
 use Drupal\migrate\Exception\RequirementsException;
 
@@ -45,9 +47,9 @@ public function testSourceProviderNotActive() {
     $plugin_definition['requirements_met'] = TRUE;
     $plugin_definition['source_provider'] = 'module1';
     /** @var \Drupal\Core\State\StateInterface $state */
-    $state = $this->getMock('Drupal\Core\State\StateInterface');
+    $state = $this->getMock(StateInterface::class);
     /** @var \Drupal\Core\Entity\EntityManagerInterface $entity_manager */
-    $entity_manager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
+    $entity_manager = $this->getMock(EntityManagerInterface::class);
     $plugin = new TestDrupalSqlBase([], 'placeholder_id', $plugin_definition, $this->getMigration(), $state, $entity_manager);
     $plugin->setDatabase($this->getDatabase($this->databaseContents));
     $system_data = $plugin->getSystemData();
diff --git a/core/modules/migrate_drupal/tests/src/Unit/source/d6/Drupal6SqlBaseTest.php b/core/modules/migrate_drupal/tests/src/Unit/source/d6/Drupal6SqlBaseTest.php
index 55d1282..0a9f33c 100644
--- a/core/modules/migrate_drupal/tests/src/Unit/source/d6/Drupal6SqlBaseTest.php
+++ b/core/modules/migrate_drupal/tests/src/Unit/source/d6/Drupal6SqlBaseTest.php
@@ -7,6 +7,8 @@
 
 namespace Drupal\Tests\migrate_drupal\Unit\source\d6;
 
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\State\StateInterface;
 use Drupal\Tests\migrate\Unit\MigrateTestCase;
 
 /**
@@ -69,9 +71,9 @@ class Drupal6SqlBaseTest extends MigrateTestCase {
   protected function setUp() {
     $plugin = 'placeholder_id';
     /** @var \Drupal\Core\State\StateInterface $state */
-    $state = $this->getMock('Drupal\Core\State\StateInterface');
+    $state = $this->getMock(StateInterface::class);
     /** @var \Drupal\Core\Entity\EntityManagerInterface $entity_manager */
-    $entity_manager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
+    $entity_manager = $this->getMock(EntityManagerInterface::class);
     $this->base = new TestDrupal6SqlBase($this->migrationConfiguration, $plugin, [], $this->getMigration(), $state, $entity_manager);
     $this->base->setDatabase($this->getDatabase($this->databaseContents));
   }
diff --git a/core/modules/node/tests/src/Unit/PageCache/DenyNodePreviewTest.php b/core/modules/node/tests/src/Unit/PageCache/DenyNodePreviewTest.php
index 42ab01d..ceb26cd 100644
--- a/core/modules/node/tests/src/Unit/PageCache/DenyNodePreviewTest.php
+++ b/core/modules/node/tests/src/Unit/PageCache/DenyNodePreviewTest.php
@@ -3,6 +3,7 @@
 namespace Drupal\Tests\node\Unit\PageCache;
 
 use Drupal\Core\PageCache\ResponsePolicyInterface;
+use Drupal\Core\Routing\RouteMatchInterface;
 use Drupal\node\PageCache\DenyNodePreview;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\HttpFoundation\Request;
@@ -43,7 +44,7 @@ class DenyNodePreviewTest extends UnitTestCase {
   protected $routeMatch;
 
   protected function setUp() {
-    $this->routeMatch = $this->getMock('Drupal\Core\Routing\RouteMatchInterface');
+    $this->routeMatch = $this->getMock(RouteMatchInterface::class);
     $this->policy = new DenyNodePreview($this->routeMatch);
     $this->response = new Response();
     $this->request = new Request();
diff --git a/core/modules/node/tests/src/Unit/Plugin/views/field/NodeBulkFormTest.php b/core/modules/node/tests/src/Unit/Plugin/views/field/NodeBulkFormTest.php
index eb92f8c..41cfbcb 100644
--- a/core/modules/node/tests/src/Unit/Plugin/views/field/NodeBulkFormTest.php
+++ b/core/modules/node/tests/src/Unit/Plugin/views/field/NodeBulkFormTest.php
@@ -3,8 +3,16 @@
 namespace Drupal\Tests\node\Unit\Plugin\views\field;
 
 use Drupal\Core\DependencyInjection\ContainerBuilder;
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Entity\EntityStorageInterface;
+use Drupal\Core\Language\LanguageManagerInterface;
 use Drupal\node\Plugin\views\field\NodeBulkForm;
+use Drupal\system\ActionConfigEntityInterface;
 use Drupal\Tests\UnitTestCase;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
+use Drupal\views\ViewEntityInterface;
+use Drupal\views\ViewExecutable;
+use Drupal\views\ViewsData;
 
 /**
  * @coversDefaultClass \Drupal\node\Plugin\views\field\NodeBulkForm
@@ -28,33 +36,33 @@ public function testConstructor() {
     $actions = [];
 
     for ($i = 1; $i <= 2; $i++) {
-      $action = $this->getMock('\Drupal\system\ActionConfigEntityInterface');
+      $action = $this->getMock(ActionConfigEntityInterface::class);
       $action->expects($this->any())
         ->method('getType')
         ->will($this->returnValue('node'));
       $actions[$i] = $action;
     }
 
-    $action = $this->getMock('\Drupal\system\ActionConfigEntityInterface');
+    $action = $this->getMock(ActionConfigEntityInterface::class);
     $action->expects($this->any())
       ->method('getType')
       ->will($this->returnValue('user'));
     $actions[] = $action;
 
-    $entity_storage = $this->getMock('Drupal\Core\Entity\EntityStorageInterface');
+    $entity_storage = $this->getMock(EntityStorageInterface::class);
     $entity_storage->expects($this->any())
       ->method('loadMultiple')
       ->will($this->returnValue($actions));
 
-    $entity_manager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
+    $entity_manager = $this->getMock(EntityManagerInterface::class);
     $entity_manager->expects($this->once())
       ->method('getStorage')
       ->with('action')
       ->will($this->returnValue($entity_storage));
 
-    $language_manager = $this->getMock('Drupal\Core\Language\LanguageManagerInterface');
+    $language_manager = $this->getMock(LanguageManagerInterface::class);
 
-    $views_data = $this->getMockBuilder('Drupal\views\ViewsData')
+    $views_data = $this->getMockBuilder(ViewsData::class)
       ->disableOriginalConstructor()
       ->getMock();
     $views_data->expects($this->any())
@@ -66,18 +74,18 @@ public function testConstructor() {
     $container->set('string_translation', $this->getStringTranslationStub());
     \Drupal::setContainer($container);
 
-    $storage = $this->getMock('Drupal\views\ViewEntityInterface');
+    $storage = $this->getMock(ViewEntityInterface::class);
     $storage->expects($this->any())
       ->method('get')
       ->with('base_table')
       ->will($this->returnValue('node'));
 
-    $executable = $this->getMockBuilder('Drupal\views\ViewExecutable')
+    $executable = $this->getMockBuilder(ViewExecutable::class)
       ->disableOriginalConstructor()
       ->getMock();
     $executable->storage = $storage;
 
-    $display = $this->getMockBuilder('Drupal\views\Plugin\views\display\DisplayPluginBase')
+    $display = $this->getMockBuilder(DisplayPluginBase::class)
       ->disableOriginalConstructor()
       ->getMock();
 
diff --git a/core/modules/quickedit/tests/src/Unit/Access/QuickEditEntityFieldAccessCheckTest.php b/core/modules/quickedit/tests/src/Unit/Access/QuickEditEntityFieldAccessCheckTest.php
index 0827436..ee4e490 100644
--- a/core/modules/quickedit/tests/src/Unit/Access/QuickEditEntityFieldAccessCheckTest.php
+++ b/core/modules/quickedit/tests/src/Unit/Access/QuickEditEntityFieldAccessCheckTest.php
@@ -8,6 +8,9 @@
 use Drupal\quickedit\Access\QuickEditEntityFieldAccessCheck;
 use Drupal\Tests\UnitTestCase;
 use Drupal\Core\Language\LanguageInterface;
+use Drupal\Core\Session\AccountInterface;
+use Drupal\entity_test\Entity\EntityTest;
+use Drupal\field\FieldStorageConfigInterface;
 
 /**
  * @coversDefaultClass \Drupal\quickedit\Access\QuickEditEntityFieldAccessCheck
@@ -70,7 +73,7 @@ public function testAccess($entity_is_editable, $field_storage_is_accessible, Ac
       ->method('access')
       ->willReturn(AccessResult::allowedIf($entity_is_editable)->cachePerPermissions());
 
-    $field_storage = $this->getMock('Drupal\field\FieldStorageConfigInterface');
+    $field_storage = $this->getMock(FieldStorageConfigInterface::class);
     $field_storage->expects($this->any())
       ->method('access')
       ->willReturn(AccessResult::allowedIf($field_storage_is_accessible));
@@ -88,7 +91,7 @@ public function testAccess($entity_is_editable, $field_storage_is_accessible, Ac
       ->with(LanguageInterface::LANGCODE_NOT_SPECIFIED)
       ->will($this->returnValue(TRUE));
 
-    $account = $this->getMock('Drupal\Core\Session\AccountInterface');
+    $account = $this->getMock(AccountInterface::class);
     $access = $this->editAccessCheck->access($entity_with_field, $field_name, LanguageInterface::LANGCODE_NOT_SPECIFIED, $account);
     $this->assertEquals($expected_result, $access);
   }
@@ -99,7 +102,7 @@ public function testAccess($entity_is_editable, $field_storage_is_accessible, Ac
    * @dataProvider providerTestAccessForbidden
    */
   public function testAccessForbidden($field_name, $langcode) {
-    $account = $this->getMock('Drupal\Core\Session\AccountInterface');
+    $account = $this->getMock(AccountInterface::class);
     $entity = $this->createMockEntity();
     $this->assertEquals(AccessResult::forbidden(), $this->editAccessCheck->access($entity, $field_name, $langcode, $account));
   }
@@ -126,7 +129,7 @@ public function providerTestAccessForbidden() {
    * @return \Drupal\Core\Entity\EntityInterface|\PHPUnit_Framework_MockObject_MockObject
    */
   protected function createMockEntity() {
-    $entity = $this->getMockBuilder('Drupal\entity_test\Entity\EntityTest')
+    $entity = $this->getMockBuilder(EntityTest::class)
       ->disableOriginalConstructor()
       ->getMock();
 
diff --git a/core/modules/rdf/tests/src/Unit/RdfMappingConfigEntityUnitTest.php b/core/modules/rdf/tests/src/Unit/RdfMappingConfigEntityUnitTest.php
index 5908ee7..48c2de4 100644
--- a/core/modules/rdf/tests/src/Unit/RdfMappingConfigEntityUnitTest.php
+++ b/core/modules/rdf/tests/src/Unit/RdfMappingConfigEntityUnitTest.php
@@ -2,7 +2,10 @@
 
 namespace Drupal\Tests\rdf\Unit;
 
+use Drupal\Component\Uuid\UuidInterface;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Entity\EntityTypeInterface;
 use Drupal\Tests\UnitTestCase;
 use Drupal\rdf\Entity\RdfMapping;
 
@@ -46,14 +49,14 @@ class RdfMappingConfigEntityUnitTest extends UnitTestCase {
   protected function setUp() {
     $this->entityTypeId = $this->randomMachineName();
 
-    $this->entityType = $this->getMock('\Drupal\Core\Entity\EntityTypeInterface');
+    $this->entityType = $this->getMock(EntityTypeInterface::class);
     $this->entityType->expects($this->any())
       ->method('getProvider')
       ->will($this->returnValue('entity'));
 
-    $this->entityManager = $this->getMock('\Drupal\Core\Entity\EntityManagerInterface');
+    $this->entityManager = $this->getMock(EntityManagerInterface::class);
 
-    $this->uuid = $this->getMock('\Drupal\Component\Uuid\UuidInterface');
+    $this->uuid = $this->getMock(UuidInterface::class);
 
     $container = new ContainerBuilder();
     $container->set('entity.manager', $this->entityManager);
@@ -68,7 +71,7 @@ protected function setUp() {
   public function testCalculateDependencies() {
     $target_entity_type_id = $this->randomMachineName(16);
 
-    $target_entity_type = $this->getMock('\Drupal\Core\Entity\EntityTypeInterface');
+    $target_entity_type = $this->getMock(EntityTypeInterface::class);
     $target_entity_type->expects($this->any())
       ->method('getProvider')
       ->will($this->returnValue('test_module'));
@@ -97,7 +100,7 @@ public function testCalculateDependencies() {
    */
   public function testCalculateDependenciesWithEntityBundle() {
     $target_entity_type_id = $this->randomMachineName(16);
-    $target_entity_type = $this->getMock('\Drupal\Core\Entity\EntityTypeInterface');
+    $target_entity_type = $this->getMock(EntityTypeInterface::class);
     $target_entity_type->expects($this->any())
       ->method('getProvider')
       ->will($this->returnValue('test_module'));
diff --git a/core/modules/responsive_image/tests/src/Unit/ResponsiveImageStyleConfigEntityUnitTest.php b/core/modules/responsive_image/tests/src/Unit/ResponsiveImageStyleConfigEntityUnitTest.php
index bc9663d..1ddb58b 100644
--- a/core/modules/responsive_image/tests/src/Unit/ResponsiveImageStyleConfigEntityUnitTest.php
+++ b/core/modules/responsive_image/tests/src/Unit/ResponsiveImageStyleConfigEntityUnitTest.php
@@ -2,7 +2,12 @@
 
 namespace Drupal\Tests\responsive_image\Unit;
 
+use Drupal\breakpoint\BreakpointManagerInterface;
+use Drupal\Core\Config\Entity\ConfigEntityInterface;
+use Drupal\Core\Config\Entity\ConfigEntityStorageInterface;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Entity\EntityTypeInterface;
 use Drupal\responsive_image\Entity\ResponsiveImageStyle;
 use Drupal\Tests\UnitTestCase;
 
@@ -37,18 +42,18 @@ class ResponsiveImageStyleConfigEntityUnitTest extends UnitTestCase {
    * {@inheritdoc}
    */
   protected function setUp() {
-    $this->entityType = $this->getMock('\Drupal\Core\Entity\EntityTypeInterface');
+    $this->entityType = $this->getMock(EntityTypeInterface::class);
     $this->entityType->expects($this->any())
       ->method('getProvider')
       ->will($this->returnValue('responsive_image'));
 
-    $this->entityManager = $this->getMock('\Drupal\Core\Entity\EntityManagerInterface');
+    $this->entityManager = $this->getMock(EntityManagerInterface::class);
     $this->entityManager->expects($this->any())
       ->method('getDefinition')
       ->with('responsive_image_style')
       ->will($this->returnValue($this->entityType));
 
-    $this->breakpointManager = $this->getMock('\Drupal\breakpoint\BreakpointManagerInterface');
+    $this->breakpointManager = $this->getMock(BreakpointManagerInterface::class);
 
     $container = new ContainerBuilder();
     $container->set('entity.manager', $this->entityManager);
@@ -63,13 +68,13 @@ public function testCalculateDependencies() {
     // Set up image style loading mock.
     $styles = [];
     foreach (['fallback', 'small', 'medium', 'large'] as $style) {
-      $mock = $this->getMock('Drupal\Core\Config\Entity\ConfigEntityInterface');
+      $mock = $this->getMock(ConfigEntityInterface::class);
       $mock->expects($this->any())
         ->method('getConfigDependencyName')
         ->willReturn('image.style.' . $style);
       $styles[$style] = $mock;
     }
-    $storage = $this->getMock('\Drupal\Core\Config\Entity\ConfigEntityStorageInterface');
+    $storage = $this->getMock(ConfigEntityStorageInterface::class);
     $storage->expects($this->any())
       ->method('loadMultiple')
       ->with(array_keys($styles))
diff --git a/core/modules/rest/tests/src/Unit/CollectRoutesTest.php b/core/modules/rest/tests/src/Unit/CollectRoutesTest.php
index 3b1c1f7..52b311b 100644
--- a/core/modules/rest/tests/src/Unit/CollectRoutesTest.php
+++ b/core/modules/rest/tests/src/Unit/CollectRoutesTest.php
@@ -2,9 +2,19 @@
 
 namespace Drupal\Tests\rest\Unit;
 
+use Drupal\Core\Authentication\AuthenticationCollectorInterface;
 use Drupal\Tests\UnitTestCase;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
+use Drupal\Core\Render\RendererInterface;
+use Drupal\Core\Routing\RouteProviderInterface;
+use Drupal\Core\State\StateInterface;
 use Drupal\rest\Plugin\views\display\RestExport;
+use Drupal\rest\Plugin\views\style\Serializer;
+use Drupal\views\ViewExecutable;
+use Drupal\views\Entity\View;
+use Drupal\views\Plugin\views\access\None;
+use Drupal\views\Plugin\ViewsPluginManager;
+use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\Routing\Route;
 use Symfony\Component\Routing\RouteCollection;
 
@@ -35,16 +45,16 @@ protected function setUp() {
 
     $container = new ContainerBuilder();
 
-    $request = $this->getMockBuilder('\Symfony\Component\HttpFoundation\Request')
+    $request = $this->getMockBuilder(Request::class)
       ->disableOriginalConstructor()
       ->getMock();
 
-    $this->view = $this->getMock('\Drupal\views\Entity\View', ['initHandlers'], [
+    $this->view = $this->getMock(View::class, ['initHandlers'], [
       ['id' => 'test_view'],
       'view',
     ]);
 
-    $view_executable = $this->getMock('\Drupal\views\ViewExecutable', ['initHandlers', 'getTitle'], [], '', FALSE);
+    $view_executable = $this->getMock(ViewExecutable::class, ['initHandlers', 'getTitle'], [], '', FALSE);
     $view_executable->expects($this->any())
       ->method('getTitle')
       ->willReturn('View title');
@@ -52,33 +62,33 @@ protected function setUp() {
     $view_executable->storage = $this->view;
     $view_executable->argument = [];
 
-    $display_manager = $this->getMockBuilder('\Drupal\views\Plugin\ViewsPluginManager')
+    $display_manager = $this->getMockBuilder(ViewsPluginManager::class)
       ->disableOriginalConstructor()
       ->getMock();
     $container->set('plugin.manager.views.display', $display_manager);
 
-    $access_manager = $this->getMockBuilder('\Drupal\views\Plugin\ViewsPluginManager')
+    $access_manager = $this->getMockBuilder(ViewsPluginManager::class)
       ->disableOriginalConstructor()
       ->getMock();
     $container->set('plugin.manager.views.access', $access_manager);
 
-    $route_provider = $this->getMockBuilder('\Drupal\Core\Routing\RouteProviderInterface')
+    $route_provider = $this->getMockBuilder(RouteProviderInterface::class)
       ->disableOriginalConstructor()
       ->getMock();
     $container->set('router.route_provider', $route_provider);
 
     $container->setParameter('authentication_providers', ['basic_auth' => 'basic_auth']);
 
-    $state = $this->getMock('\Drupal\Core\State\StateInterface');
+    $state = $this->getMock(StateInterface::class);
     $container->set('state', $state);
 
-    $style_manager = $this->getMockBuilder('\Drupal\views\Plugin\ViewsPluginManager')
+    $style_manager = $this->getMockBuilder(ViewsPluginManager::class)
       ->disableOriginalConstructor()
       ->getMock();
     $container->set('plugin.manager.views.style', $style_manager);
-    $container->set('renderer', $this->getMock('Drupal\Core\Render\RendererInterface'));
+    $container->set('renderer', $this->getMock(RendererInterface::class));
 
-    $authentication_collector = $this->getMock('\Drupal\Core\Authentication\AuthenticationCollectorInterface');
+    $authentication_collector = $this->getMock(AuthenticationCollectorInterface::class);
     $container->set('authentication_collector', $authentication_collector);
     $authentication_collector->expects($this->any())
       ->method('getSortedProviders')
@@ -102,7 +112,7 @@ protected function setUp() {
       ->method('getDefinition')
       ->will($this->returnValue(['id' => 'test', 'provider' => 'test']));
 
-    $none = $this->getMockBuilder('\Drupal\views\Plugin\views\access\None')
+    $none = $this->getMockBuilder(None::class)
       ->disableOriginalConstructor()
       ->getMock();
 
@@ -110,7 +120,7 @@ protected function setUp() {
       ->method('createInstance')
       ->will($this->returnValue($none));
 
-    $style_plugin = $this->getMock('\Drupal\rest\Plugin\views\style\Serializer', ['getFormats', 'init'], [], '', FALSE);
+    $style_plugin = $this->getMock(Serializer::class, ['getFormats', 'init'], [], '', FALSE);
 
     $style_plugin->expects($this->once())
       ->method('getFormats')
diff --git a/core/modules/rest/tests/src/Unit/EntityResourceValidationTraitTest.php b/core/modules/rest/tests/src/Unit/EntityResourceValidationTraitTest.php
index 8c9758e..9ff010a 100644
--- a/core/modules/rest/tests/src/Unit/EntityResourceValidationTraitTest.php
+++ b/core/modules/rest/tests/src/Unit/EntityResourceValidationTraitTest.php
@@ -4,6 +4,7 @@
 
 use Drupal\Core\Entity\EntityConstraintViolationList;
 use Drupal\node\Entity\Node;
+use Drupal\rest\Plugin\rest\resource\EntityResourceValidationTrait;
 use Drupal\Tests\UnitTestCase;
 use Drupal\user\Entity\User;
 use Symfony\Component\HttpKernel\Exception\UnprocessableEntityHttpException;
@@ -19,7 +20,7 @@ class EntityResourceValidationTraitTest extends UnitTestCase {
    * @covers ::validate
    */
   public function testValidate() {
-    $trait = $this->getMockForTrait('Drupal\rest\Plugin\rest\resource\EntityResourceValidationTrait');
+    $trait = $this->getMockForTrait(EntityResourceValidationTrait::class);
 
     $method = new \ReflectionMethod($trait, 'validate');
     $method->setAccessible(TRUE);
@@ -59,7 +60,7 @@ public function testFailedValidate() {
 
     $entity->validate()->willReturn($violations);
 
-    $trait = $this->getMockForTrait('Drupal\rest\Plugin\rest\resource\EntityResourceValidationTrait');
+    $trait = $this->getMockForTrait(EntityResourceValidationTrait::class);
 
     $method = new \ReflectionMethod($trait, 'validate');
     $method->setAccessible(TRUE);
diff --git a/core/modules/search/tests/src/Unit/SearchPageRepositoryTest.php b/core/modules/search/tests/src/Unit/SearchPageRepositoryTest.php
index 69dffd8..92d2579 100644
--- a/core/modules/search/tests/src/Unit/SearchPageRepositoryTest.php
+++ b/core/modules/search/tests/src/Unit/SearchPageRepositoryTest.php
@@ -7,6 +7,13 @@
 
 namespace Drupal\Tests\search\Unit;
 
+use Drupal\Core\Config\Config;
+use Drupal\Core\Config\ConfigFactoryInterface;
+use Drupal\Core\Config\Entity\ConfigEntityStorageInterface;
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Entity\EntityTypeInterface;
+use Drupal\Core\Entity\Query\QueryInterface;
+use Drupal\search\SearchPageInterface;
 use Drupal\search\Entity\SearchPage;
 use Drupal\search\SearchPageRepository;
 use Drupal\Tests\UnitTestCase;
@@ -49,19 +56,19 @@ class SearchPageRepositoryTest extends UnitTestCase {
    * {@inheritdoc}
    */
   protected function setUp() {
-    $this->query = $this->getMock('Drupal\Core\Entity\Query\QueryInterface');
+    $this->query = $this->getMock(QueryInterface::class);
 
-    $this->storage = $this->getMock('Drupal\Core\Config\Entity\ConfigEntityStorageInterface');
+    $this->storage = $this->getMock(ConfigEntityStorageInterface::class);
     $this->storage->expects($this->any())
       ->method('getQuery')
       ->will($this->returnValue($this->query));
 
-    $entity_manager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
+    $entity_manager = $this->getMock(EntityManagerInterface::class);
     $entity_manager->expects($this->any())
       ->method('getStorage')
       ->will($this->returnValue($this->storage));
 
-    $this->configFactory = $this->getMock('Drupal\Core\Config\ConfigFactoryInterface');
+    $this->configFactory = $this->getMock(ConfigFactoryInterface::class);
     $this->searchPageRepository = new SearchPageRepository($this->configFactory, $entity_manager);
   }
 
@@ -78,8 +85,8 @@ public function testGetActiveSearchPages() {
       ->will($this->returnValue(['test' => 'test', 'other_test' => 'other_test']));
 
     $entities = [];
-    $entities['test'] = $this->getMock('Drupal\search\SearchPageInterface');
-    $entities['other_test'] = $this->getMock('Drupal\search\SearchPageInterface');
+    $entities['test'] = $this->getMock(SearchPageInterface::class);
+    $entities['other_test'] = $this->getMock(SearchPageInterface::class);
     $this->storage->expects($this->once())
       ->method('loadMultiple')
       ->with(['test' => 'test', 'other_test' => 'other_test'])
@@ -121,11 +128,11 @@ public function testGetIndexableSearchPages() {
       ->will($this->returnValue(['test' => 'test', 'other_test' => 'other_test']));
 
     $entities = [];
-    $entities['test'] = $this->getMock('Drupal\search\SearchPageInterface');
+    $entities['test'] = $this->getMock(SearchPageInterface::class);
     $entities['test']->expects($this->once())
       ->method('isIndexable')
       ->will($this->returnValue(TRUE));
-    $entities['other_test'] = $this->getMock('Drupal\search\SearchPageInterface');
+    $entities['other_test'] = $this->getMock(SearchPageInterface::class);
     $entities['other_test']->expects($this->once())
       ->method('isIndexable')
       ->will($this->returnValue(FALSE));
@@ -143,7 +150,7 @@ public function testGetIndexableSearchPages() {
    * Tests the clearDefaultSearchPage() method.
    */
   public function testClearDefaultSearchPage() {
-    $config = $this->getMockBuilder('Drupal\Core\Config\Config')
+    $config = $this->getMockBuilder(Config::class)
       ->disableOriginalConstructor()
       ->getMock();
     $config->expects($this->once())
@@ -169,7 +176,7 @@ public function testGetDefaultSearchPageWithActiveDefault() {
       ->method('execute')
       ->will($this->returnValue(['test' => 'test', 'other_test' => 'other_test']));
 
-    $config = $this->getMockBuilder('Drupal\Core\Config\Config')
+    $config = $this->getMockBuilder(Config::class)
       ->disableOriginalConstructor()
       ->getMock();
     $config->expects($this->once())
@@ -196,7 +203,7 @@ public function testGetDefaultSearchPageWithInactiveDefault() {
       ->method('execute')
       ->will($this->returnValue(['test' => 'test']));
 
-    $config = $this->getMockBuilder('Drupal\Core\Config\Config')
+    $config = $this->getMockBuilder(Config::class)
       ->disableOriginalConstructor()
       ->getMock();
     $config->expects($this->once())
@@ -216,7 +223,7 @@ public function testGetDefaultSearchPageWithInactiveDefault() {
    */
   public function testSetDefaultSearchPage() {
     $id = 'bananas';
-    $config = $this->getMockBuilder('Drupal\Core\Config\Config')
+    $config = $this->getMockBuilder(Config::class)
       ->disableOriginalConstructor()
       ->getMock();
     $config->expects($this->once())
@@ -231,7 +238,7 @@ public function testSetDefaultSearchPage() {
       ->with('search.settings')
       ->will($this->returnValue($config));
 
-    $search_page = $this->getMock('Drupal\search\SearchPageInterface');
+    $search_page = $this->getMock(SearchPageInterface::class);
     $search_page->expects($this->once())
       ->method('id')
       ->will($this->returnValue($id));
@@ -248,7 +255,7 @@ public function testSetDefaultSearchPage() {
    * Tests the sortSearchPages() method.
    */
   public function testSortSearchPages() {
-    $entity_type = $this->getMock('Drupal\Core\Entity\EntityTypeInterface');
+    $entity_type = $this->getMock(EntityTypeInterface::class);
     $entity_type->expects($this->any())
       ->method('getClass')
       ->will($this->returnValue('Drupal\Tests\search\Unit\TestSearchPage'));
diff --git a/core/modules/search/tests/src/Unit/SearchPluginCollectionTest.php b/core/modules/search/tests/src/Unit/SearchPluginCollectionTest.php
index 25ab873..1abbd7b 100644
--- a/core/modules/search/tests/src/Unit/SearchPluginCollectionTest.php
+++ b/core/modules/search/tests/src/Unit/SearchPluginCollectionTest.php
@@ -2,6 +2,9 @@
 
 namespace Drupal\Tests\search\Unit;
 
+use Drupal\Component\Plugin\PluginManagerInterface;
+use Drupal\search\Plugin\ConfigurableSearchPluginInterface;
+use Drupal\search\Plugin\SearchInterface;
 use Drupal\search\Plugin\SearchPluginCollection;
 use Drupal\Tests\UnitTestCase;
 
@@ -36,7 +39,7 @@ class SearchPluginCollectionTest extends UnitTestCase {
    * {@inheritdoc}
    */
   protected function setUp() {
-    $this->pluginManager = $this->getMock('Drupal\Component\Plugin\PluginManagerInterface');
+    $this->pluginManager = $this->getMock(PluginManagerInterface::class);
     $this->searchPluginCollection = new SearchPluginCollection($this->pluginManager, 'banana', ['id' => 'banana', 'color' => 'yellow'], 'fruit_stand');
   }
 
@@ -44,7 +47,7 @@ protected function setUp() {
    * Tests the get() method.
    */
   public function testGet() {
-    $plugin = $this->getMock('Drupal\search\Plugin\SearchInterface');
+    $plugin = $this->getMock(SearchInterface::class);
     $this->pluginManager->expects($this->once())
       ->method('createInstance')
       ->will($this->returnValue($plugin));
@@ -55,7 +58,7 @@ public function testGet() {
    * Tests the get() method with a configurable plugin.
    */
   public function testGetWithConfigurablePlugin() {
-    $plugin = $this->getMock('Drupal\search\Plugin\ConfigurableSearchPluginInterface');
+    $plugin = $this->getMock(ConfigurableSearchPluginInterface::class);
     $plugin->expects($this->once())
       ->method('setSearchPageId')
       ->with('fruit_stand')
diff --git a/core/modules/serialization/tests/src/Unit/EntityResolver/ChainEntityResolverTest.php b/core/modules/serialization/tests/src/Unit/EntityResolver/ChainEntityResolverTest.php
index 64e73b6..304b4a9 100644
--- a/core/modules/serialization/tests/src/Unit/EntityResolver/ChainEntityResolverTest.php
+++ b/core/modules/serialization/tests/src/Unit/EntityResolver/ChainEntityResolverTest.php
@@ -4,6 +4,8 @@
 
 use Drupal\Tests\UnitTestCase;
 use Drupal\serialization\EntityResolver\ChainEntityResolver;
+use Drupal\serialization\EntityResolver\EntityResolverInterface;
+use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
 
 /**
  * @coversDefaultClass \Drupal\serialization\EntityResolver\ChainEntityResolver
@@ -36,7 +38,7 @@ class ChainEntityResolverTest extends UnitTestCase {
    * {@inheritdoc}
    */
   protected function setUp() {
-    $this->testNormalizer = $this->getMock('Symfony\Component\Serializer\Normalizer\NormalizerInterface');
+    $this->testNormalizer = $this->getMock(NormalizerInterface::class);
     $this->testData = new \stdClass();
   }
 
@@ -134,7 +136,7 @@ public function testResolverWithResolvedToZero() {
    *   The mocked entity resolver.
    */
   protected function createEntityResolverMock($return = NULL, $called = TRUE) {
-    $mock = $this->getMock('Drupal\serialization\EntityResolver\EntityResolverInterface');
+    $mock = $this->getMock(EntityResolverInterface::class);
 
     if ($called) {
       $mock->expects($this->once())
diff --git a/core/modules/serialization/tests/src/Unit/EntityResolver/UuidResolverTest.php b/core/modules/serialization/tests/src/Unit/EntityResolver/UuidResolverTest.php
index 8123925..38d114d 100644
--- a/core/modules/serialization/tests/src/Unit/EntityResolver/UuidResolverTest.php
+++ b/core/modules/serialization/tests/src/Unit/EntityResolver/UuidResolverTest.php
@@ -2,8 +2,12 @@
 
 namespace Drupal\Tests\serialization\Unit\EntityResolver;
 
+use Drupal\Core\Entity\EntityInterface;
+use Drupal\Core\Entity\EntityManager;
+use Drupal\serialization\EntityResolver\UuidReferenceInterface;
 use Drupal\Tests\UnitTestCase;
 use Drupal\serialization\EntityResolver\UuidResolver;
+use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
 
 /**
  * @coversDefaultClass \Drupal\serialization\EntityResolver\UuidResolver
@@ -29,7 +33,7 @@ class UuidResolverTest extends UnitTestCase {
    * {@inheritdoc}
    */
   protected function setUp() {
-    $this->entityManager = $this->getMockBuilder('Drupal\Core\Entity\EntityManager')
+    $this->entityManager = $this->getMockBuilder(EntityManager::class)
       ->disableOriginalConstructor()
       ->getMock();
 
@@ -43,7 +47,7 @@ public function testResolveNotInInterface() {
     $this->entityManager->expects($this->never())
       ->method('loadEntityByUuid');
 
-    $normalizer = $this->getMock('Symfony\Component\Serializer\Normalizer\NormalizerInterface');
+    $normalizer = $this->getMock(NormalizerInterface::class);
     $this->assertNull($this->resolver->resolve($normalizer, [], 'test_type'));
   }
 
@@ -54,7 +58,7 @@ public function testResolveNoUuid() {
     $this->entityManager->expects($this->never())
       ->method('loadEntityByUuid');
 
-    $normalizer = $this->getMock('Drupal\serialization\EntityResolver\UuidReferenceInterface');
+    $normalizer = $this->getMock(UuidReferenceInterface::class);
     $normalizer->expects($this->once())
       ->method('getUuid')
       ->with([])
@@ -73,7 +77,7 @@ public function testResolveNoEntity() {
       ->with('test_type')
       ->will($this->returnValue(NULL));
 
-    $normalizer = $this->getMock('Drupal\serialization\EntityResolver\UuidReferenceInterface');
+    $normalizer = $this->getMock(UuidReferenceInterface::class);
     $normalizer->expects($this->once())
       ->method('getUuid')
       ->with([])
@@ -88,7 +92,7 @@ public function testResolveNoEntity() {
   public function testResolveWithEntity() {
     $uuid = '392eab92-35c2-4625-872d-a9dab4da008e';
 
-    $entity = $this->getMock('Drupal\Core\Entity\EntityInterface');
+    $entity = $this->getMock(EntityInterface::class);
     $entity->expects($this->once())
       ->method('id')
       ->will($this->returnValue(1));
@@ -98,7 +102,7 @@ public function testResolveWithEntity() {
       ->with('test_type', $uuid)
       ->will($this->returnValue($entity));
 
-    $normalizer = $this->getMock('Drupal\serialization\EntityResolver\UuidReferenceInterface');
+    $normalizer = $this->getMock(UuidReferenceInterface::class);
     $normalizer->expects($this->once())
       ->method('getUuid')
       ->with([])
diff --git a/core/modules/serialization/tests/src/Unit/Normalizer/ConfigEntityNormalizerTest.php b/core/modules/serialization/tests/src/Unit/Normalizer/ConfigEntityNormalizerTest.php
index 371450a..6076e4d 100644
--- a/core/modules/serialization/tests/src/Unit/Normalizer/ConfigEntityNormalizerTest.php
+++ b/core/modules/serialization/tests/src/Unit/Normalizer/ConfigEntityNormalizerTest.php
@@ -2,6 +2,8 @@
 
 namespace Drupal\Tests\serialization\Unit\Normalizer;
 
+use Drupal\Core\Config\Entity\ConfigEntityInterface;
+use Drupal\Core\Entity\EntityManagerInterface;
 use Drupal\serialization\Normalizer\ConfigEntityNormalizer;
 use Drupal\Tests\UnitTestCase;
 
@@ -19,10 +21,10 @@ class ConfigEntityNormalizerTest extends UnitTestCase {
   public function testNormalize() {
     $test_export_properties = ['test' => 'test'];
 
-    $entity_manager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
+    $entity_manager = $this->getMock(EntityManagerInterface::class);
     $normalizer = new ConfigEntityNormalizer($entity_manager);
 
-    $config_entity = $this->getMock('Drupal\Core\Config\Entity\ConfigEntityInterface');
+    $config_entity = $this->getMock(ConfigEntityInterface::class);
     $config_entity->expects($this->once())
       ->method('toArray')
       ->will($this->returnValue($test_export_properties));
diff --git a/core/modules/serialization/tests/src/Unit/Normalizer/ContentEntityNormalizerTest.php b/core/modules/serialization/tests/src/Unit/Normalizer/ContentEntityNormalizerTest.php
index 4beecf4..cf6621a 100644
--- a/core/modules/serialization/tests/src/Unit/Normalizer/ContentEntityNormalizerTest.php
+++ b/core/modules/serialization/tests/src/Unit/Normalizer/ContentEntityNormalizerTest.php
@@ -2,8 +2,15 @@
 
 namespace Drupal\Tests\serialization\Unit\Normalizer;
 
+use Drupal\Core\Entity\ConfigEntityInterface;
+use Drupal\Core\Entity\ContentEntityBase;
+use Drupal\Core\Entity\ContentEntityInterface;
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Field\FieldItemListInterface;
+use Drupal\Core\Session\AccountInterface;
 use Drupal\serialization\Normalizer\ContentEntityNormalizer;
 use Drupal\Tests\UnitTestCase;
+use Symfony\Component\Serializer\Serializer;
 
 /**
  * @coversDefaultClass \Drupal\serialization\Normalizer\ContentEntityNormalizer
@@ -36,9 +43,9 @@ class ContentEntityNormalizerTest extends UnitTestCase {
    * {@inheritdoc}
    */
   protected function setUp() {
-    $this->entityManager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
+    $this->entityManager = $this->getMock(EntityManagerInterface::class);
     $this->contentEntityNormalizer = new ContentEntityNormalizer($this->entityManager);
-    $this->serializer = $this->getMockBuilder('Symfony\Component\Serializer\Serializer')
+    $this->serializer = $this->getMockBuilder(Serializer::class)
       ->disableOriginalConstructor()
       ->setMethods(['normalize'])
       ->getMock();
@@ -49,8 +56,8 @@ protected function setUp() {
    * @covers ::supportsNormalization
    */
   public function testSupportsNormalization() {
-    $content_mock = $this->getMock('Drupal\Core\Entity\ContentEntityInterface');
-    $config_mock = $this->getMock('Drupal\Core\Entity\ConfigEntityInterface');
+    $content_mock = $this->getMock(ContentEntityInterface::class);
+    $config_mock = $this->getMock(ConfigEntityInterface::class);
     $this->assertTrue($this->contentEntityNormalizer->supportsNormalization($content_mock));
     $this->assertFalse($this->contentEntityNormalizer->supportsNormalization($config_mock));
   }
@@ -85,7 +92,7 @@ public function testNormalize() {
    * @covers ::normalize
    */
   public function testNormalizeWithAccountContext() {
-    $mock_account = $this->getMock('Drupal\Core\Session\AccountInterface');
+    $mock_account = $this->getMock(AccountInterface::class);
 
     $context = [
       'account' => $mock_account,
@@ -119,7 +126,7 @@ public function testNormalizeWithAccountContext() {
    * @return \PHPUnit_Framework_MockObject_MockObject
    */
   public function createMockForContentEntity($definitions) {
-    $content_entity_mock = $this->getMockBuilder('Drupal\Core\Entity\ContentEntityBase')
+    $content_entity_mock = $this->getMockBuilder(ContentEntityBase::class)
       ->disableOriginalConstructor()
       ->setMethods(['getFields'])
       ->getMockForAbstractClass();
@@ -138,7 +145,7 @@ public function createMockForContentEntity($definitions) {
    * @return \Drupal\Core\Field\FieldItemListInterface|\PHPUnit_Framework_MockObject_MockObject
    */
   protected function createMockFieldListItem($access = TRUE, $user_context = NULL) {
-    $mock = $this->getMock('Drupal\Core\Field\FieldItemListInterface');
+    $mock = $this->getMock(FieldItemListInterface::class);
     $mock->expects($this->once())
       ->method('access')
       ->with('view', $user_context)
diff --git a/core/modules/serialization/tests/src/Unit/Normalizer/EntityNormalizerTest.php b/core/modules/serialization/tests/src/Unit/Normalizer/EntityNormalizerTest.php
index 689d654..a919f1b 100644
--- a/core/modules/serialization/tests/src/Unit/Normalizer/EntityNormalizerTest.php
+++ b/core/modules/serialization/tests/src/Unit/Normalizer/EntityNormalizerTest.php
@@ -2,10 +2,19 @@
 
 namespace Drupal\Tests\serialization\Unit\Normalizer;
 
+use Drupal\Core\Entity\ContentEntityBase;
+use Drupal\Core\Entity\EntityInterface;
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Entity\EntityStorageInterface;
+use Drupal\Core\Entity\EntityTypeInterface;
 use Drupal\Core\Entity\FieldableEntityInterface;
+use Drupal\Core\Entity\Query\QueryInterface;
+use Drupal\Core\Field\FieldDefinitionInterface;
 use Drupal\Core\Field\FieldItemListInterface;
+use Drupal\Core\TypedData\TypedDataInterface;
 use Drupal\serialization\Normalizer\EntityNormalizer;
 use Drupal\Tests\UnitTestCase;
+use Symfony\Component\Serializer\Serializer;
 use Symfony\Component\Serializer\Exception\UnexpectedValueException;
 
 /**
@@ -39,7 +48,7 @@ class EntityNormalizerTest extends UnitTestCase {
    * {@inheritdoc}
    */
   protected function setUp() {
-    $this->entityManager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
+    $this->entityManager = $this->getMock(EntityManagerInterface::class);
     $this->entityNormalizer = new EntityNormalizer($this->entityManager);
   }
 
@@ -49,15 +58,15 @@ protected function setUp() {
    * @covers ::normalize
    */
   public function testNormalize() {
-    $list_item_1 = $this->getMock('Drupal\Core\TypedData\TypedDataInterface');
-    $list_item_2 = $this->getMock('Drupal\Core\TypedData\TypedDataInterface');
+    $list_item_1 = $this->getMock(TypedDataInterface::class);
+    $list_item_2 = $this->getMock(TypedDataInterface::class);
 
     $definitions = [
       'field_1' => $list_item_1,
       'field_2' => $list_item_2,
     ];
 
-    $content_entity = $this->getMockBuilder('Drupal\Core\Entity\ContentEntityBase')
+    $content_entity = $this->getMockBuilder(ContentEntityBase::class)
       ->disableOriginalConstructor()
       ->setMethods(['getFields'])
       ->getMockForAbstractClass();
@@ -65,7 +74,7 @@ public function testNormalize() {
       ->method('getFields')
       ->will($this->returnValue($definitions));
 
-    $serializer = $this->getMockBuilder('Symfony\Component\Serializer\Serializer')
+    $serializer = $this->getMockBuilder(Serializer::class)
       ->disableOriginalConstructor()
       ->setMethods(['normalize'])
       ->getMock();
@@ -105,7 +114,7 @@ public function testDenormalizeWithValidBundle() {
       ],
     ];
 
-    $entity_type = $this->getMock('Drupal\Core\Entity\EntityTypeInterface');
+    $entity_type = $this->getMock(EntityTypeInterface::class);
 
     $entity_type->expects($this->once())
       ->method('id')
@@ -132,7 +141,7 @@ public function testDenormalizeWithValidBundle() {
       ->method('getMainPropertyName')
       ->will($this->returnValue('name'));
 
-    $entity_type_definition = $this->getMock('Drupal\Core\Field\FieldDefinitionInterface');
+    $entity_type_definition = $this->getMock(FieldDefinitionInterface::class);
     $entity_type_definition->expects($this->once())
       ->method('getFieldStorageDefinition')
       ->will($this->returnValue($entity_type_storage_definition));
@@ -150,12 +159,12 @@ public function testDenormalizeWithValidBundle() {
       ->with('test')
       ->will($this->returnValue($base_definitions));
 
-    $entity_query_mock = $this->getMock('Drupal\Core\Entity\Query\QueryInterface');
+    $entity_query_mock = $this->getMock(QueryInterface::class);
     $entity_query_mock->expects($this->once())
       ->method('execute')
       ->will($this->returnValue(['test_bundle' => 'test_bundle']));
 
-    $entity_type_storage = $this->getMock('Drupal\Core\Entity\EntityStorageInterface');
+    $entity_type_storage = $this->getMock(EntityStorageInterface::class);
     $entity_type_storage->expects($this->once())
       ->method('getQuery')
       ->will($this->returnValue($entity_query_mock));
@@ -178,7 +187,7 @@ public function testDenormalizeWithValidBundle() {
       ->with('key_2')
       ->willReturn($key_2);
 
-    $storage = $this->getMock('Drupal\Core\Entity\EntityStorageInterface');
+    $storage = $this->getMock(EntityStorageInterface::class);
     // Create should only be called with the bundle property at first.
     $expected_test_data = [
       'test_type' => 'test_bundle',
@@ -196,7 +205,7 @@ public function testDenormalizeWithValidBundle() {
 
     // Setup expectations for the serializer. This will be called for each field
     // item.
-    $serializer = $this->getMockBuilder('Symfony\Component\Serializer\Serializer')
+    $serializer = $this->getMockBuilder(Serializer::class)
       ->disableOriginalConstructor()
       ->setMethods(['denormalize'])
       ->getMock();
@@ -226,7 +235,7 @@ public function testDenormalizeWithInvalidBundle() {
       ],
     ];
 
-    $entity_type = $this->getMock('Drupal\Core\Entity\EntityTypeInterface');
+    $entity_type = $this->getMock(EntityTypeInterface::class);
 
     $entity_type->expects($this->once())
       ->method('id')
@@ -253,7 +262,7 @@ public function testDenormalizeWithInvalidBundle() {
       ->method('getMainPropertyName')
       ->will($this->returnValue('name'));
 
-    $entity_type_definition = $this->getMock('Drupal\Core\Field\FieldDefinitionInterface');
+    $entity_type_definition = $this->getMock(FieldDefinitionInterface::class);
     $entity_type_definition->expects($this->once())
       ->method('getFieldStorageDefinition')
       ->will($this->returnValue($entity_type_storage_definition));
@@ -271,12 +280,12 @@ public function testDenormalizeWithInvalidBundle() {
       ->with('test')
       ->will($this->returnValue($base_definitions));
 
-    $entity_query_mock = $this->getMock('Drupal\Core\Entity\Query\QueryInterface');
+    $entity_query_mock = $this->getMock(QueryInterface::class);
     $entity_query_mock->expects($this->once())
       ->method('execute')
       ->will($this->returnValue(['test_bundle_other' => 'test_bundle_other']));
 
-    $entity_type_storage = $this->getMock('Drupal\Core\Entity\EntityStorageInterface');
+    $entity_type_storage = $this->getMock(EntityStorageInterface::class);
     $entity_type_storage->expects($this->once())
       ->method('getQuery')
       ->will($this->returnValue($entity_query_mock));
@@ -301,7 +310,7 @@ public function testDenormalizeWithNoBundle() {
       'key_2' => 'value_2',
     ];
 
-    $entity_type = $this->getMock('Drupal\Core\Entity\EntityTypeInterface');
+    $entity_type = $this->getMock(EntityTypeInterface::class);
     $entity_type->expects($this->once())
       ->method('isSubClassOf')
       ->with(FieldableEntityInterface::class)
@@ -331,7 +340,7 @@ public function testDenormalizeWithNoBundle() {
       ->with('key_2')
       ->willReturn($key_2);
 
-    $storage = $this->getMock('Drupal\Core\Entity\EntityStorageInterface');
+    $storage = $this->getMock(EntityStorageInterface::class);
     $storage->expects($this->once())
       ->method('create')
       ->with([])
@@ -347,7 +356,7 @@ public function testDenormalizeWithNoBundle() {
 
     // Setup expectations for the serializer. This will be called for each field
     // item.
-    $serializer = $this->getMockBuilder('Symfony\Component\Serializer\Serializer')
+    $serializer = $this->getMockBuilder(Serializer::class)
       ->disableOriginalConstructor()
       ->setMethods(['denormalize'])
       ->getMock();
@@ -374,7 +383,7 @@ public function testDenormalizeWithNoFieldableEntityType() {
       'key_2' => 'value_2',
     ];
 
-    $entity_type = $this->getMock('Drupal\Core\Entity\EntityTypeInterface');
+    $entity_type = $this->getMock(EntityTypeInterface::class);
     $entity_type->expects($this->once())
       ->method('isSubClassOf')
       ->with(FieldableEntityInterface::class)
@@ -388,11 +397,11 @@ public function testDenormalizeWithNoFieldableEntityType() {
       ->with('test')
       ->will($this->returnValue($entity_type));
 
-    $storage = $this->getMock('Drupal\Core\Entity\EntityStorageInterface');
+    $storage = $this->getMock(EntityStorageInterface::class);
     $storage->expects($this->once())
       ->method('create')
       ->with($test_data)
-      ->will($this->returnValue($this->getMock('Drupal\Core\Entity\EntityInterface')));
+      ->will($this->returnValue($this->getMock(EntityInterface::class)));
 
     $this->entityManager->expects($this->once())
       ->method('getStorage')
diff --git a/core/modules/serialization/tests/src/Unit/Normalizer/ListNormalizerTest.php b/core/modules/serialization/tests/src/Unit/Normalizer/ListNormalizerTest.php
index fccc6db..b89a1a3 100644
--- a/core/modules/serialization/tests/src/Unit/Normalizer/ListNormalizerTest.php
+++ b/core/modules/serialization/tests/src/Unit/Normalizer/ListNormalizerTest.php
@@ -3,10 +3,12 @@
 namespace Drupal\Tests\serialization\Unit\Normalizer;
 
 use Drupal\Core\TypedData\DataDefinition;
+use Drupal\Core\TypedData\TypedDataInterface;
 use Drupal\Core\TypedData\TypedDataManagerInterface;
 use Drupal\Tests\UnitTestCase;
 use Drupal\serialization\Normalizer\ListNormalizer;
 use Drupal\Core\TypedData\Plugin\DataType\ItemList;
+use Symfony\Component\DependencyInjection\ContainerBuilder;
 use Symfony\Component\Serializer\Serializer;
 
 /**
@@ -45,7 +47,7 @@ class ListNormalizerTest extends UnitTestCase {
 
   protected function setUp() {
     // Mock the TypedDataManager to return a TypedDataInterface mock.
-    $this->typedData = $this->getMock('Drupal\Core\TypedData\TypedDataInterface');
+    $this->typedData = $this->getMock(TypedDataInterface::class);
     $typed_data_manager = $this->getMock(TypedDataManagerInterface::class);
     $typed_data_manager->expects($this->any())
       ->method('getPropertyInstance')
@@ -53,7 +55,7 @@ protected function setUp() {
 
     // Set up a mock container as ItemList() will call for the 'typed_data_manager'
     // service.
-    $container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')
+    $container = $this->getMockBuilder(ContainerBuilder::class)
       ->setMethods(['get'])
       ->getMock();
     $container->expects($this->any())
diff --git a/core/modules/serialization/tests/src/Unit/Normalizer/NormalizerBaseTest.php b/core/modules/serialization/tests/src/Unit/Normalizer/NormalizerBaseTest.php
index f5e8f0f..418433d 100644
--- a/core/modules/serialization/tests/src/Unit/Normalizer/NormalizerBaseTest.php
+++ b/core/modules/serialization/tests/src/Unit/Normalizer/NormalizerBaseTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\Tests\serialization\Unit\Normalizer;
 
+use Drupal\Tests\serialization\Unit\Normalizer\TestNormalizerBase;
 use Drupal\Tests\UnitTestCase;
 use Drupal\serialization\Normalizer\NormalizerBase;
 
@@ -29,7 +30,7 @@ class NormalizerBaseTest extends UnitTestCase {
    *   (optional) the supported interface or class to set on the normalizer.
    */
   public function testSupportsNormalization($expected_return, $data, $supported_interface_or_class = NULL) {
-    $normalizer_base = $this->getMockForAbstractClass('Drupal\Tests\serialization\Unit\Normalizer\TestNormalizerBase');
+    $normalizer_base = $this->getMockForAbstractClass(TestNormalizerBase::class);
 
     if (isset($supported_interface_or_class)) {
       $normalizer_base->setSupportedInterfaceOrClass($supported_interface_or_class);
diff --git a/core/modules/serialization/tests/src/Unit/Normalizer/NullNormalizerTest.php b/core/modules/serialization/tests/src/Unit/Normalizer/NullNormalizerTest.php
index 34a28b2..8784822 100644
--- a/core/modules/serialization/tests/src/Unit/Normalizer/NullNormalizerTest.php
+++ b/core/modules/serialization/tests/src/Unit/Normalizer/NullNormalizerTest.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\Tests\serialization\Unit\Normalizer;
 
+use Drupal\Core\TypedData\TypedDataInterface;
 use Drupal\serialization\Normalizer\NullNormalizer;
 use Drupal\Tests\UnitTestCase;
 
@@ -37,7 +38,7 @@ protected function setUp() {
    * @covers ::supportsNormalization
    */
   public function testSupportsNormalization() {
-    $mock = $this->getMock('Drupal\Core\TypedData\TypedDataInterface');
+    $mock = $this->getMock(TypedDataInterface::class);
     $this->assertTrue($this->normalizer->supportsNormalization($mock));
     // Also test that an object not implementing TypedDataInterface fails.
     $this->assertFalse($this->normalizer->supportsNormalization(new \stdClass()));
@@ -47,7 +48,7 @@ public function testSupportsNormalization() {
    * @covers ::normalize
    */
   public function testNormalize() {
-    $mock = $this->getMock('Drupal\Core\TypedData\TypedDataInterface');
+    $mock = $this->getMock(TypedDataInterface::class);
     $this->assertNull($this->normalizer->normalize($mock));
   }
 
diff --git a/core/modules/serialization/tests/src/Unit/Normalizer/TypedDataNormalizerTest.php b/core/modules/serialization/tests/src/Unit/Normalizer/TypedDataNormalizerTest.php
index 6a31e2e..477a7c8 100644
--- a/core/modules/serialization/tests/src/Unit/Normalizer/TypedDataNormalizerTest.php
+++ b/core/modules/serialization/tests/src/Unit/Normalizer/TypedDataNormalizerTest.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\Tests\serialization\Unit\Normalizer;
 
+use Drupal\Core\TypedData\TypedDataInterface;
 use Drupal\Tests\UnitTestCase;
 use Drupal\serialization\Normalizer\TypedDataNormalizer;
 
@@ -27,7 +28,7 @@ class TypedDataNormalizerTest extends UnitTestCase {
 
   protected function setUp() {
     $this->normalizer = new TypedDataNormalizer();
-    $this->typedData = $this->getMock('Drupal\Core\TypedData\TypedDataInterface');
+    $this->typedData = $this->getMock(TypedDataInterface::class);
   }
 
   /**
diff --git a/core/modules/simpletest/tests/src/Unit/TestBaseTest.php b/core/modules/simpletest/tests/src/Unit/TestBaseTest.php
index cdfe986..2b995d4 100644
--- a/core/modules/simpletest/tests/src/Unit/TestBaseTest.php
+++ b/core/modules/simpletest/tests/src/Unit/TestBaseTest.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\Tests\simpletest\Unit;
 
+use Drupal\simpletest\TestBase;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -24,7 +25,7 @@ class TestBaseTest extends UnitTestCase {
    *   Mock of Drupal\simpletest\TestBase.
    */
   public function getTestBaseForAssertionTests($test_id) {
-    $mock_test_base = $this->getMockBuilder('Drupal\simpletest\TestBase')
+    $mock_test_base = $this->getMockBuilder(TestBase::class)
       ->setConstructorArgs([$test_id])
       ->setMethods(['storeAssertion'])
       ->getMockForAbstractClass();
@@ -79,7 +80,7 @@ public function providerRandomStringValidate() {
    * @dataProvider providerRandomStringValidate
    */
   public function testRandomStringValidate($expected, $string) {
-    $mock_test_base = $this->getMockForAbstractClass('Drupal\simpletest\TestBase');
+    $mock_test_base = $this->getMockForAbstractClass(TestBase::class);
     $actual = $mock_test_base->randomStringValidate($string);
     $this->assertEquals($expected, $actual);
   }
@@ -108,7 +109,7 @@ public function providerRandomItems() {
    * @dataProvider providerRandomItems
    */
   public function testRandomString($length) {
-    $mock_test_base = $this->getMockForAbstractClass('Drupal\simpletest\TestBase');
+    $mock_test_base = $this->getMockForAbstractClass(TestBase::class);
     $string = $mock_test_base->randomString($length);
     $this->assertEquals($length, strlen($string));
     // randomString() should always include an ampersand ('&')  and a
@@ -435,7 +436,7 @@ public function providerError() {
    */
   public function testError($status, $group) {
     // Mock up a TestBase object.
-    $mock_test_base = $this->getMockBuilder('Drupal\simpletest\TestBase')
+    $mock_test_base = $this->getMockBuilder(TestBase::class)
       ->setMethods(['assert'])
       ->getMockForAbstractClass();
 
diff --git a/core/modules/simpletest/tests/src/Unit/WebTestBaseTest.php b/core/modules/simpletest/tests/src/Unit/WebTestBaseTest.php
index df90956..d12be91 100644
--- a/core/modules/simpletest/tests/src/Unit/WebTestBaseTest.php
+++ b/core/modules/simpletest/tests/src/Unit/WebTestBaseTest.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\Tests\simpletest\Unit;
 
+use Drupal\simpletest\WebTestBase;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -48,7 +49,7 @@ public function providerAssertFieldByName() {
   public function testAssertFieldByName($filename, $name, $value, $expected) {
     $content = file_get_contents(__DIR__ . '/../../fixtures/' . $filename . '.html');
 
-    $web_test = $this->getMockBuilder('Drupal\simpletest\WebTestBase')
+    $web_test = $this->getMockBuilder(WebTestBase::class)
       ->disableOriginalConstructor()
       ->setMethods(['getRawContent', 'assertTrue', 'pass'])
       ->getMock();
@@ -132,7 +133,7 @@ public function providerTestClickLink() {
    */
   public function testClickLink($expected, $label, $index, $xpath_data) {
     // Mock a WebTestBase object and some of its methods.
-    $web_test = $this->getMockBuilder('Drupal\simpletest\WebTestBase')
+    $web_test = $this->getMockBuilder(WebTestBase::class)
       ->disableOriginalConstructor()
       ->setMethods([
         'pass',
@@ -198,7 +199,7 @@ public function testClickLink($expected, $label, $index, $xpath_data) {
    * @dataProvider providerTestGetAbsoluteUrl
    */
   public function testGetAbsoluteUrl($href, $expected_absolute_path) {
-    $web_test = $this->getMockBuilder('Drupal\simpletest\WebTestBase')
+    $web_test = $this->getMockBuilder(WebTestBase::class)
       ->disableOriginalConstructor()
       ->setMethods(['getUrl'])
       ->getMock();
diff --git a/core/modules/syslog/tests/src/Kernel/SyslogTest.php b/core/modules/syslog/tests/src/Kernel/SyslogTest.php
index 22547f3..b8bcf62 100644
--- a/core/modules/syslog/tests/src/Kernel/SyslogTest.php
+++ b/core/modules/syslog/tests/src/Kernel/SyslogTest.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\Tests\syslog\Kernel;
 
+use Drupal\Core\Session\AccountInterface;
 use Drupal\KernelTests\KernelTestBase;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpFoundation\RequestStack;
@@ -33,7 +34,7 @@ public function testSyslogWriting() {
     $request->headers->set('Referer', 'other-site');
     \Drupal::requestStack()->push($request);
 
-    $user = $this->getMockBuilder('Drupal\Core\Session\AccountInterface')->getMock();
+    $user = $this->getMockBuilder(AccountInterface::class)->getMock();
     $user->method('id')->willReturn(42);
     $this->container->set('current_user', $user);
 
diff --git a/core/modules/system/tests/src/Unit/Breadcrumbs/PathBasedBreadcrumbBuilderTest.php b/core/modules/system/tests/src/Unit/Breadcrumbs/PathBasedBreadcrumbBuilderTest.php
index d1eb8fb..89521b4 100644
--- a/core/modules/system/tests/src/Unit/Breadcrumbs/PathBasedBreadcrumbBuilderTest.php
+++ b/core/modules/system/tests/src/Unit/Breadcrumbs/PathBasedBreadcrumbBuilderTest.php
@@ -7,10 +7,18 @@
 
 namespace Drupal\Tests\system\Unit\Breadcrumbs;
 
+use Drupal\Core\Access\AccessManagerInterface;
 use Drupal\Core\Access\AccessResult;
 use Drupal\Core\Cache\Cache;
+use Drupal\Core\Cache\Context\CacheContextsManager;
 use Drupal\Core\Link;
 use Drupal\Core\Access\AccessResultAllowed;
+use Drupal\Core\Controller\TitleResolverInterface;
+use Drupal\Core\Path\CurrentPathStack;
+use Drupal\Core\PathProcessor\InboundPathProcessorInterface;
+use Drupal\Core\Routing\RequestContext;
+use Drupal\Core\Routing\RouteMatchInterface;
+use Drupal\Core\Session\AccountInterface;
 use Drupal\Core\StringTranslation\TranslationInterface;
 use Drupal\Core\Url;
 use Drupal\Core\Utility\LinkGeneratorInterface;
@@ -20,6 +28,7 @@
 use Symfony\Component\DependencyInjection\Container;
 use Symfony\Component\HttpFoundation\ParameterBag;
 use Symfony\Component\HttpFoundation\Request;
+use Symfony\Component\Routing\Matcher\RequestMatcherInterface;
 use Symfony\Component\Routing\Route;
 
 /**
@@ -92,17 +101,17 @@ class PathBasedBreadcrumbBuilderTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $this->requestMatcher = $this->getMock('\Symfony\Component\Routing\Matcher\RequestMatcherInterface');
+    $this->requestMatcher = $this->getMock(RequestMatcherInterface::class);
 
     $config_factory = $this->getConfigFactoryStub(['system.site' => ['front' => 'test_frontpage']]);
 
-    $this->pathProcessor = $this->getMock('\Drupal\Core\PathProcessor\InboundPathProcessorInterface');
-    $this->context = $this->getMock('\Drupal\Core\Routing\RequestContext');
+    $this->pathProcessor = $this->getMock(InboundPathProcessorInterface::class);
+    $this->context = $this->getMock(RequestContext::class);
 
-    $this->accessManager = $this->getMock('\Drupal\Core\Access\AccessManagerInterface');
-    $this->titleResolver = $this->getMock('\Drupal\Core\Controller\TitleResolverInterface');
-    $this->currentUser = $this->getMock('Drupal\Core\Session\AccountInterface');
-    $this->currentPath = $this->getMockBuilder('Drupal\Core\Path\CurrentPathStack')
+    $this->accessManager = $this->getMock(AccessManagerInterface::class);
+    $this->titleResolver = $this->getMock(TitleResolverInterface::class);
+    $this->currentUser = $this->getMock(AccountInterface::class);
+    $this->currentPath = $this->getMockBuilder(CurrentPathStack::class)
       ->disableOriginalConstructor()
       ->getMock();
 
@@ -119,7 +128,7 @@ protected function setUp() {
 
     $this->builder->setStringTranslation($this->getStringTranslationStub());
 
-    $cache_contexts_manager = $this->getMockBuilder('Drupal\Core\Cache\Context\CacheContextsManager')
+    $cache_contexts_manager = $this->getMockBuilder(CacheContextsManager::class)
       ->disableOriginalConstructor()
       ->getMock();
     $cache_contexts_manager->method('assertValidTokens')->willReturn(TRUE);
@@ -140,7 +149,7 @@ public function testBuildOnFrontpage() {
       ->method('getPathInfo')
       ->will($this->returnValue('/'));
 
-    $breadcrumb = $this->builder->build($this->getMock('Drupal\Core\Routing\RouteMatchInterface'));
+    $breadcrumb = $this->builder->build($this->getMock(RouteMatchInterface::class));
     $this->assertEquals([], $breadcrumb->getLinks());
     $this->assertEquals(['url.path.parent'], $breadcrumb->getCacheContexts());
     $this->assertEquals([], $breadcrumb->getCacheTags());
@@ -157,7 +166,7 @@ public function testBuildWithOnePathElement() {
       ->method('getPathInfo')
       ->will($this->returnValue('/example'));
 
-    $breadcrumb = $this->builder->build($this->getMock('Drupal\Core\Routing\RouteMatchInterface'));
+    $breadcrumb = $this->builder->build($this->getMock(RouteMatchInterface::class));
     $this->assertEquals([0 => new Link('Home', new Url('<front>'))], $breadcrumb->getLinks());
     $this->assertEquals(['url.path.parent'], $breadcrumb->getCacheContexts());
     $this->assertEquals([], $breadcrumb->getCacheTags());
@@ -192,7 +201,7 @@ public function testBuildWithTwoPathElements() {
 
     $this->setupAccessManagerToAllow();
 
-    $breadcrumb = $this->builder->build($this->getMock('Drupal\Core\Routing\RouteMatchInterface'));
+    $breadcrumb = $this->builder->build($this->getMock(RouteMatchInterface::class));
     $this->assertEquals([0 => new Link('Home', new Url('<front>')), 1 => new Link('Example', new Url('example'))], $breadcrumb->getLinks());
     $this->assertEquals(['url.path.parent', 'user.permissions'], $breadcrumb->getCacheContexts());
     $this->assertEquals([], $breadcrumb->getCacheTags());
@@ -239,7 +248,7 @@ public function testBuildWithThreePathElements() {
         AccessResult::allowed()->cachePerPermissions(),
         AccessResult::allowed()->addCacheContexts(['bar'])->addCacheTags(['example'])
       );
-    $breadcrumb = $this->builder->build($this->getMock('Drupal\Core\Routing\RouteMatchInterface'));
+    $breadcrumb = $this->builder->build($this->getMock(RouteMatchInterface::class));
     $this->assertEquals([
       new Link('Home', new Url('<front>')),
       new Link('Example', new Url('example')),
@@ -268,7 +277,7 @@ public function testBuildWithException($exception_class, $exception_argument) {
       ->method('matchRequest')
       ->will($this->throwException(new $exception_class($exception_argument)));
 
-    $breadcrumb = $this->builder->build($this->getMock('Drupal\Core\Routing\RouteMatchInterface'));
+    $breadcrumb = $this->builder->build($this->getMock(RouteMatchInterface::class));
 
     // No path matched, though at least the frontpage is displayed.
     $this->assertEquals([0 => new Link('Home', new Url('<front>'))], $breadcrumb->getLinks());
@@ -312,7 +321,7 @@ public function testBuildWithNonProcessedPath() {
       ->method('matchRequest')
       ->will($this->returnValue([]));
 
-    $breadcrumb = $this->builder->build($this->getMock('Drupal\Core\Routing\RouteMatchInterface'));
+    $breadcrumb = $this->builder->build($this->getMock(RouteMatchInterface::class));
 
     // No path matched, though at least the frontpage is displayed.
     $this->assertEquals([0 => new Link('Home', new Url('<front>'))], $breadcrumb->getLinks());
@@ -327,7 +336,7 @@ public function testBuildWithNonProcessedPath() {
    * @covers ::applies
    */
   public function testApplies() {
-    $this->assertTrue($this->builder->applies($this->getMock('Drupal\Core\Routing\RouteMatchInterface')));
+    $this->assertTrue($this->builder->applies($this->getMock(RouteMatchInterface::class)));
   }
 
   /**
@@ -362,7 +371,7 @@ public function testBuildWithUserPath() {
       ->with($this->anything(), $route_1)
       ->will($this->returnValue('Admin'));
 
-    $breadcrumb = $this->builder->build($this->getMock('Drupal\Core\Routing\RouteMatchInterface'));
+    $breadcrumb = $this->builder->build($this->getMock(RouteMatchInterface::class));
     $this->assertEquals([0 => new Link('Home', new Url('<front>')), 1 => new Link('Admin', new Url('user_page'))], $breadcrumb->getLinks());
     $this->assertEquals(['url.path.parent', 'user.permissions'], $breadcrumb->getCacheContexts());
     $this->assertEquals([], $breadcrumb->getCacheTags());
diff --git a/core/modules/system/tests/src/Unit/Menu/MenuLinkTreeTest.php b/core/modules/system/tests/src/Unit/Menu/MenuLinkTreeTest.php
index c2014d5..8cdbc10 100644
--- a/core/modules/system/tests/src/Unit/Menu/MenuLinkTreeTest.php
+++ b/core/modules/system/tests/src/Unit/Menu/MenuLinkTreeTest.php
@@ -4,9 +4,15 @@
 
 use Drupal\Core\Access\AccessResult;
 use Drupal\Core\Cache\Cache;
+use Drupal\Core\Cache\Context\CacheContextsManager;
+use Drupal\Core\Controller\ControllerResolverInterface;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
+use Drupal\Core\Menu\MenuActiveTrailInterface;
+use Drupal\Core\Menu\MenuLinkManagerInterface;
 use Drupal\Core\Menu\MenuLinkTree;
 use Drupal\Core\Menu\MenuLinkTreeElement;
+use Drupal\Core\Menu\MenuTreeStorageInterface;
+use Drupal\Core\Routing\RouteProviderInterface;
 use Drupal\Core\Template\Attribute;
 use Drupal\Core\Url;
 use Drupal\Tests\Core\Menu\MenuLinkMock;
@@ -32,14 +38,14 @@ protected function setUp() {
     parent::setUp();
 
     $this->menuLinkTree = new MenuLinkTree(
-      $this->getMock('\Drupal\Core\Menu\MenuTreeStorageInterface'),
-      $this->getMock('\Drupal\Core\Menu\MenuLinkManagerInterface'),
-      $this->getMock('\Drupal\Core\Routing\RouteProviderInterface'),
-      $this->getMock('\Drupal\Core\Menu\MenuActiveTrailInterface'),
-      $this->getMock('\Drupal\Core\Controller\ControllerResolverInterface')
+      $this->getMock(MenuTreeStorageInterface::class),
+      $this->getMock(MenuLinkManagerInterface::class),
+      $this->getMock(RouteProviderInterface::class),
+      $this->getMock(MenuActiveTrailInterface::class),
+      $this->getMock(ControllerResolverInterface::class)
     );
 
-    $cache_contexts_manager = $this->getMockBuilder('Drupal\Core\Cache\Context\CacheContextsManager')
+    $cache_contexts_manager = $this->getMockBuilder(CacheContextsManager::class)
       ->disableOriginalConstructor()
       ->getMock();
     $cache_contexts_manager->method('assertValidTokens')->willReturn(TRUE);
diff --git a/core/modules/system/tests/src/Unit/Menu/SystemLocalTasksTest.php b/core/modules/system/tests/src/Unit/Menu/SystemLocalTasksTest.php
index c632a3e..3bab02f 100644
--- a/core/modules/system/tests/src/Unit/Menu/SystemLocalTasksTest.php
+++ b/core/modules/system/tests/src/Unit/Menu/SystemLocalTasksTest.php
@@ -3,6 +3,7 @@
 namespace Drupal\Tests\system\Unit\Menu;
 
 use Drupal\Core\Extension\Extension;
+use Drupal\Core\Extension\ThemeHandlerInterface;
 use Drupal\Tests\Core\Menu\LocalTaskIntegrationTestBase;
 
 /**
@@ -29,7 +30,7 @@ protected function setUp() {
       'system' => 'core/modules/system',
     ];
 
-    $this->themeHandler = $this->getMock('Drupal\Core\Extension\ThemeHandlerInterface');
+    $this->themeHandler = $this->getMock(ThemeHandlerInterface::class);
 
     $theme = new Extension($this->root, 'theme', '/core/themes/bartik', 'bartik.info.yml');
     $theme->status = 1;
diff --git a/core/modules/tour/tests/src/Unit/Entity/TourTest.php b/core/modules/tour/tests/src/Unit/Entity/TourTest.php
index 08944ee..b6a0791 100644
--- a/core/modules/tour/tests/src/Unit/Entity/TourTest.php
+++ b/core/modules/tour/tests/src/Unit/Entity/TourTest.php
@@ -3,6 +3,7 @@
 namespace Drupal\Tests\tour\Unit\Entity;
 
 use Drupal\Tests\UnitTestCase;
+use Drupal\tour\Entity\Tour;
 
 /**
  * @coversDefaultClass \Drupal\tour\Entity\Tour
@@ -27,7 +28,7 @@ class TourTest extends UnitTestCase {
    * @dataProvider routeProvider
    */
   public function testHasMatchingRoute($routes, $route_name, $route_params, $result) {
-    $tour = $this->getMockBuilder('\Drupal\tour\Entity\Tour')
+    $tour = $this->getMockBuilder(Tour::class)
       ->disableOriginalConstructor()
       ->setMethods(['getRoutes'])
       ->getMock();
diff --git a/core/modules/update/tests/src/Unit/UpdateFetcherTest.php b/core/modules/update/tests/src/Unit/UpdateFetcherTest.php
index c3e447d..5db09d1 100644
--- a/core/modules/update/tests/src/Unit/UpdateFetcherTest.php
+++ b/core/modules/update/tests/src/Unit/UpdateFetcherTest.php
@@ -4,6 +4,7 @@
 
 use Drupal\Tests\UnitTestCase;
 use Drupal\update\UpdateFetcher;
+use GuzzleHttp\ClientInterface;
 
 if (!defined('DRUPAL_CORE_COMPATIBILITY')) {
   define('DRUPAL_CORE_COMPATIBILITY', '8.x');
@@ -28,7 +29,7 @@ class UpdateFetcherTest extends UnitTestCase {
    */
   protected function setUp() {
     $config_factory = $this->getConfigFactoryStub(['update.settings' => ['fetch_url' => 'http://www.example.com']]);
-    $http_client_mock = $this->getMock('\GuzzleHttp\ClientInterface');
+    $http_client_mock = $this->getMock(ClientInterface::class);
     $this->updateFetcher = new UpdateFetcher($config_factory, $http_client_mock);
   }
 
diff --git a/core/modules/user/tests/src/Unit/PermissionAccessCheckTest.php b/core/modules/user/tests/src/Unit/PermissionAccessCheckTest.php
index 84290cc..39764d5 100644
--- a/core/modules/user/tests/src/Unit/PermissionAccessCheckTest.php
+++ b/core/modules/user/tests/src/Unit/PermissionAccessCheckTest.php
@@ -7,6 +7,7 @@
 use Drupal\user\Access\PermissionAccessCheck;
 use Symfony\Component\Routing\Route;
 use Drupal\Core\Cache\Context\CacheContextsManager;
+use Drupal\Core\Session\AccountInterface;
 use Symfony\Component\DependencyInjection\ContainerBuilder;
 
 /**
@@ -73,7 +74,7 @@ public function testAccess($requirements, $access, array $contexts = [], $messag
     if (!empty($message)) {
       $access_result->setReason($message);
     }
-    $user = $this->getMock('Drupal\Core\Session\AccountInterface');
+    $user = $this->getMock(AccountInterface::class);
     $user->expects($this->any())
       ->method('hasPermission')
       ->will($this->returnValueMap([
diff --git a/core/modules/user/tests/src/Unit/PermissionHandlerTest.php b/core/modules/user/tests/src/Unit/PermissionHandlerTest.php
index 2918d2f..08984ca 100644
--- a/core/modules/user/tests/src/Unit/PermissionHandlerTest.php
+++ b/core/modules/user/tests/src/Unit/PermissionHandlerTest.php
@@ -7,7 +7,9 @@
 
 namespace Drupal\Tests\user\Unit;
 
+use Drupal\Core\Controller\ControllerResolverInterface;
 use Drupal\Core\Extension\Extension;
+use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\StringTranslation\PluralTranslatableMarkup;
 use Drupal\Core\StringTranslation\TranslatableMarkup;
 use Drupal\Core\StringTranslation\TranslationInterface;
@@ -61,7 +63,7 @@ protected function setUp() {
     parent::setUp();
 
     $this->stringTranslation = new TestTranslationManager();
-    $this->controllerResolver = $this->getMock('Drupal\Core\Controller\ControllerResolverInterface');
+    $this->controllerResolver = $this->getMock(ControllerResolverInterface::class);
   }
 
   /**
@@ -94,7 +96,7 @@ public function testBuildPermissionsYaml() {
     $root = new vfsStreamDirectory('modules');
     vfsStreamWrapper::setRoot($root);
 
-    $this->moduleHandler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface');
+    $this->moduleHandler = $this->getMock(ModuleHandlerInterface::class);
     $this->moduleHandler->expects($this->once())
       ->method('getModuleDirectories')
       ->willReturn([
@@ -169,7 +171,7 @@ public function testBuildPermissionsSortPerModule() {
     $root = new vfsStreamDirectory('modules');
     vfsStreamWrapper::setRoot($root);
 
-    $this->moduleHandler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface');
+    $this->moduleHandler = $this->getMock(ModuleHandlerInterface::class);
     $this->moduleHandler->expects($this->once())
       ->method('getModuleDirectories')
       ->willReturn([
@@ -224,7 +226,7 @@ public function testBuildPermissionsYamlCallback() {
     $root = new vfsStreamDirectory('modules');
     vfsStreamWrapper::setRoot($root);
 
-    $this->moduleHandler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface');
+    $this->moduleHandler = $this->getMock(ModuleHandlerInterface::class);
     $this->moduleHandler->expects($this->once())
       ->method('getModuleDirectories')
       ->willReturn([
@@ -304,7 +306,7 @@ public function testPermissionsYamlStaticAndCallback() {
     $root = new vfsStreamDirectory('modules');
     vfsStreamWrapper::setRoot($root);
 
-    $this->moduleHandler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface');
+    $this->moduleHandler = $this->getMock(ModuleHandlerInterface::class);
     $this->moduleHandler->expects($this->once())
       ->method('getModuleDirectories')
       ->willReturn([
diff --git a/core/modules/user/tests/src/Unit/Plugin/Core/Entity/UserTest.php b/core/modules/user/tests/src/Unit/Plugin/Core/Entity/UserTest.php
index 623203e..94ed3a4 100644
--- a/core/modules/user/tests/src/Unit/Plugin/Core/Entity/UserTest.php
+++ b/core/modules/user/tests/src/Unit/Plugin/Core/Entity/UserTest.php
@@ -3,6 +3,7 @@
 namespace Drupal\Tests\user\Unit\Plugin\Core\Entity;
 
 use Drupal\Tests\Core\Session\UserSessionTest;
+use Drupal\user\Entity\User;
 use Drupal\user\RoleInterface;
 
 /**
@@ -15,7 +16,7 @@ class UserTest extends UserSessionTest {
    * {@inheritdoc}
    */
   protected function createUserSession(array $rids = [], $authenticated = FALSE) {
-    $user = $this->getMockBuilder('Drupal\user\Entity\User')
+    $user = $this->getMockBuilder(User::class)
       ->disableOriginalConstructor()
       ->setMethods(['get', 'id'])
       ->getMock();
diff --git a/core/modules/user/tests/src/Unit/Plugin/Validation/Constraint/ProtectedUserFieldConstraintValidatorTest.php b/core/modules/user/tests/src/Unit/Plugin/Validation/Constraint/ProtectedUserFieldConstraintValidatorTest.php
index 805c96e..d202cb5 100644
--- a/core/modules/user/tests/src/Unit/Plugin/Validation/Constraint/ProtectedUserFieldConstraintValidatorTest.php
+++ b/core/modules/user/tests/src/Unit/Plugin/Validation/Constraint/ProtectedUserFieldConstraintValidatorTest.php
@@ -2,7 +2,12 @@
 
 namespace Drupal\Tests\user\Unit\Plugin\Validation\Constraint;
 
+use Drupal\Core\Field\FieldDefinitionInterface;
+use Drupal\Core\Field\FieldItemListInterface;
+use Drupal\Core\Session\AccountProxyInterface;
 use Drupal\Tests\UnitTestCase;
+use Drupal\user\UserInterface;
+use Drupal\user\UserStorageInterface;
 use Drupal\user\Plugin\Validation\Constraint\ProtectedUserFieldConstraint;
 use Drupal\user\Plugin\Validation\Constraint\ProtectedUserFieldConstraintValidator;
 use Symfony\Component\Validator\Context\ExecutionContextInterface;
@@ -18,20 +23,20 @@ class ProtectedUserFieldConstraintValidatorTest extends UnitTestCase {
    */
   protected function createValidator() {
     // Setup mocks that don't need to change.
-    $unchanged_field = $this->getMock('Drupal\Core\Field\FieldItemListInterface');
+    $unchanged_field = $this->getMock(FieldItemListInterface::class);
     $unchanged_field->expects($this->any())
       ->method('getValue')
       ->willReturn('unchanged-value');
 
-    $unchanged_account = $this->getMock('Drupal\user\UserInterface');
+    $unchanged_account = $this->getMock(UserInterface::class);
     $unchanged_account->expects($this->any())
       ->method('get')
       ->willReturn($unchanged_field);
-    $user_storage = $this->getMock('Drupal\user\UserStorageInterface');
+    $user_storage = $this->getMock(UserStorageInterface::class);
     $user_storage->expects($this->any())
       ->method('loadUnchanged')
       ->willReturn($unchanged_account);
-    $current_user = $this->getMock('Drupal\Core\Session\AccountProxyInterface');
+    $current_user = $this->getMock(AccountProxyInterface::class);
     $current_user->expects($this->any())
       ->method('id')
       ->willReturn('current-user');
@@ -75,8 +80,8 @@ public function providerTestValidate() {
     $cases[] = [NULL, FALSE];
 
     // Case 2: Empty user should be ignored.
-    $field_definition = $this->getMock('Drupal\Core\Field\FieldDefinitionInterface');
-    $items = $this->getMock('Drupal\Core\Field\FieldItemListInterface');
+    $field_definition = $this->getMock(FieldDefinitionInterface::class);
+    $items = $this->getMock(FieldItemListInterface::class);
     $items->expects($this->once())
       ->method('getFieldDefinition')
       ->willReturn($field_definition);
@@ -86,10 +91,10 @@ public function providerTestValidate() {
     $cases[] = [$items, FALSE];
 
     // Case 3: Account flagged to skip protected user should be ignored.
-    $field_definition = $this->getMock('Drupal\Core\Field\FieldDefinitionInterface');
-    $account = $this->getMock('Drupal\user\UserInterface');
+    $field_definition = $this->getMock(FieldDefinitionInterface::class);
+    $account = $this->getMock(UserInterface::class);
     $account->_skipProtectedUserFieldConstraint = TRUE;
-    $items = $this->getMock('Drupal\Core\Field\FieldItemListInterface');
+    $items = $this->getMock(FieldItemListInterface::class);
     $items->expects($this->once())
       ->method('getFieldDefinition')
       ->willReturn($field_definition);
@@ -99,12 +104,12 @@ public function providerTestValidate() {
     $cases[] = [$items, FALSE];
 
     // Case 4: New user should be ignored.
-    $field_definition = $this->getMock('Drupal\Core\Field\FieldDefinitionInterface');
-    $account = $this->getMock('Drupal\user\UserInterface');
+    $field_definition = $this->getMock(FieldDefinitionInterface::class);
+    $account = $this->getMock(UserInterface::class);
     $account->expects($this->once())
       ->method('isNew')
       ->willReturn(TRUE);
-    $items = $this->getMock('Drupal\Core\Field\FieldItemListInterface');
+    $items = $this->getMock(FieldItemListInterface::class);
     $items->expects($this->once())
       ->method('getFieldDefinition')
       ->willReturn($field_definition);
@@ -114,14 +119,14 @@ public function providerTestValidate() {
     $cases[] = [$items, FALSE];
 
     // Case 5: Mismatching user IDs should also be ignored.
-    $account = $this->getMock('Drupal\user\UserInterface');
+    $account = $this->getMock(UserInterface::class);
     $account->expects($this->once())
       ->method('isNew')
       ->willReturn(FALSE);
     $account->expects($this->once())
       ->method('id')
       ->willReturn('not-current-user');
-    $items = $this->getMock('Drupal\Core\Field\FieldItemListInterface');
+    $items = $this->getMock(FieldItemListInterface::class);
     $items->expects($this->once())
       ->method('getFieldDefinition')
       ->willReturn($field_definition);
@@ -131,11 +136,11 @@ public function providerTestValidate() {
     $cases[] = [$items, FALSE];
 
     // Case 6: Non-password fields that have not changed should be ignored.
-    $field_definition = $this->getMock('Drupal\Core\Field\FieldDefinitionInterface');
+    $field_definition = $this->getMock(FieldDefinitionInterface::class);
     $field_definition->expects($this->exactly(2))
       ->method('getName')
       ->willReturn('field_not_password');
-    $account = $this->getMock('Drupal\user\UserInterface');
+    $account = $this->getMock(UserInterface::class);
     $account->expects($this->once())
       ->method('isNew')
       ->willReturn(FALSE);
@@ -144,7 +149,7 @@ public function providerTestValidate() {
       ->willReturn('current-user');
     $account->expects($this->never())
       ->method('checkExistingPassword');
-    $items = $this->getMock('Drupal\Core\Field\FieldItemListInterface');
+    $items = $this->getMock(FieldItemListInterface::class);
     $items->expects($this->once())
       ->method('getFieldDefinition')
       ->willReturn($field_definition);
@@ -157,11 +162,11 @@ public function providerTestValidate() {
     $cases[] = [$items, FALSE];
 
     // Case 7: Password field with no value set should be ignored.
-    $field_definition = $this->getMock('Drupal\Core\Field\FieldDefinitionInterface');
+    $field_definition = $this->getMock(FieldDefinitionInterface::class);
     $field_definition->expects($this->once())
       ->method('getName')
       ->willReturn('pass');
-    $account = $this->getMock('Drupal\user\UserInterface');
+    $account = $this->getMock(UserInterface::class);
     $account->expects($this->once())
       ->method('isNew')
       ->willReturn(FALSE);
@@ -170,7 +175,7 @@ public function providerTestValidate() {
       ->willReturn('current-user');
     $account->expects($this->never())
       ->method('checkExistingPassword');
-    $items = $this->getMock('Drupal\Core\Field\FieldItemListInterface');
+    $items = $this->getMock(FieldItemListInterface::class);
     $items->expects($this->once())
       ->method('getFieldDefinition')
       ->willReturn($field_definition);
@@ -181,11 +186,11 @@ public function providerTestValidate() {
 
     // Case 8: Non-password field changed, but user has passed provided current
     // password.
-    $field_definition = $this->getMock('Drupal\Core\Field\FieldDefinitionInterface');
+    $field_definition = $this->getMock(FieldDefinitionInterface::class);
     $field_definition->expects($this->exactly(2))
       ->method('getName')
       ->willReturn('field_not_password');
-    $account = $this->getMock('Drupal\user\UserInterface');
+    $account = $this->getMock(UserInterface::class);
     $account->expects($this->once())
       ->method('isNew')
       ->willReturn(FALSE);
@@ -195,7 +200,7 @@ public function providerTestValidate() {
     $account->expects($this->once())
       ->method('checkExistingPassword')
       ->willReturn(TRUE);
-    $items = $this->getMock('Drupal\Core\Field\FieldItemListInterface');
+    $items = $this->getMock(FieldItemListInterface::class);
     $items->expects($this->once())
       ->method('getFieldDefinition')
       ->willReturn($field_definition);
@@ -208,11 +213,11 @@ public function providerTestValidate() {
     $cases[] = [$items, FALSE];
 
     // Case 9: Password field changed, current password confirmed.
-    $field_definition = $this->getMock('Drupal\Core\Field\FieldDefinitionInterface');
+    $field_definition = $this->getMock(FieldDefinitionInterface::class);
     $field_definition->expects($this->exactly(2))
       ->method('getName')
       ->willReturn('pass');
-    $account = $this->getMock('Drupal\user\UserInterface');
+    $account = $this->getMock(UserInterface::class);
     $account->expects($this->once())
       ->method('isNew')
       ->willReturn(FALSE);
@@ -222,7 +227,7 @@ public function providerTestValidate() {
     $account->expects($this->once())
       ->method('checkExistingPassword')
       ->willReturn(TRUE);
-    $items = $this->getMock('Drupal\Core\Field\FieldItemListInterface');
+    $items = $this->getMock(FieldItemListInterface::class);
     $items->expects($this->once())
       ->method('getFieldDefinition')
       ->willReturn($field_definition);
@@ -241,14 +246,14 @@ public function providerTestValidate() {
     // The below calls should result in a violation.
 
     // Case 10: Password field changed, current password not confirmed.
-    $field_definition = $this->getMock('Drupal\Core\Field\FieldDefinitionInterface');
+    $field_definition = $this->getMock(FieldDefinitionInterface::class);
     $field_definition->expects($this->exactly(2))
       ->method('getName')
       ->willReturn('pass');
     $field_definition->expects($this->any())
       ->method('getLabel')
       ->willReturn('Password');
-    $account = $this->getMock('Drupal\user\UserInterface');
+    $account = $this->getMock(UserInterface::class);
     $account->expects($this->once())
       ->method('isNew')
       ->willReturn(FALSE);
@@ -258,7 +263,7 @@ public function providerTestValidate() {
     $account->expects($this->once())
       ->method('checkExistingPassword')
       ->willReturn(FALSE);
-    $items = $this->getMock('Drupal\Core\Field\FieldItemListInterface');
+    $items = $this->getMock(FieldItemListInterface::class);
     $items->expects($this->once())
       ->method('getFieldDefinition')
       ->willReturn($field_definition);
@@ -275,14 +280,14 @@ public function providerTestValidate() {
     $cases[] = [$items, TRUE, 'Password'];
 
     // Case 11: Non-password field changed, current password not confirmed.
-    $field_definition = $this->getMock('Drupal\Core\Field\FieldDefinitionInterface');
+    $field_definition = $this->getMock(FieldDefinitionInterface::class);
     $field_definition->expects($this->exactly(2))
       ->method('getName')
       ->willReturn('field_not_password');
     $field_definition->expects($this->any())
       ->method('getLabel')
       ->willReturn('Protected field');
-    $account = $this->getMock('Drupal\user\UserInterface');
+    $account = $this->getMock(UserInterface::class);
     $account->expects($this->once())
       ->method('isNew')
       ->willReturn(FALSE);
@@ -292,7 +297,7 @@ public function providerTestValidate() {
     $account->expects($this->once())
       ->method('checkExistingPassword')
       ->willReturn(FALSE);
-    $items = $this->getMock('Drupal\Core\Field\FieldItemListInterface');
+    $items = $this->getMock(FieldItemListInterface::class);
     $items->expects($this->once())
       ->method('getFieldDefinition')
       ->willReturn($field_definition);
diff --git a/core/modules/user/tests/src/Unit/Plugin/views/field/UserBulkFormTest.php b/core/modules/user/tests/src/Unit/Plugin/views/field/UserBulkFormTest.php
index 11a970a..f258823 100644
--- a/core/modules/user/tests/src/Unit/Plugin/views/field/UserBulkFormTest.php
+++ b/core/modules/user/tests/src/Unit/Plugin/views/field/UserBulkFormTest.php
@@ -3,8 +3,16 @@
 namespace Drupal\Tests\user\Unit\Plugin\views\field;
 
 use Drupal\Core\DependencyInjection\ContainerBuilder;
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Entity\EntityStorageInterface;
+use Drupal\Core\Language\LanguageManagerInterface;
+use Drupal\system\ActionConfigEntityInterface;
 use Drupal\Tests\UnitTestCase;
 use Drupal\user\Plugin\views\field\UserBulkForm;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
+use Drupal\views\ViewEntityInterface;
+use Drupal\views\ViewExecutable;
+use Drupal\views\ViewsData;
 
 /**
  * @coversDefaultClass \Drupal\user\Plugin\views\field\UserBulkForm
@@ -28,33 +36,33 @@ public function testConstructor() {
     $actions = [];
 
     for ($i = 1; $i <= 2; $i++) {
-      $action = $this->getMock('\Drupal\system\ActionConfigEntityInterface');
+      $action = $this->getMock(ActionConfigEntityInterface::class);
       $action->expects($this->any())
         ->method('getType')
         ->will($this->returnValue('user'));
       $actions[$i] = $action;
     }
 
-    $action = $this->getMock('\Drupal\system\ActionConfigEntityInterface');
+    $action = $this->getMock(ActionConfigEntityInterface::class);
     $action->expects($this->any())
       ->method('getType')
       ->will($this->returnValue('node'));
     $actions[] = $action;
 
-    $entity_storage = $this->getMock('Drupal\Core\Entity\EntityStorageInterface');
+    $entity_storage = $this->getMock(EntityStorageInterface::class);
     $entity_storage->expects($this->any())
       ->method('loadMultiple')
       ->will($this->returnValue($actions));
 
-    $entity_manager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
+    $entity_manager = $this->getMock(EntityManagerInterface::class);
     $entity_manager->expects($this->once())
       ->method('getStorage')
       ->with('action')
       ->will($this->returnValue($entity_storage));
 
-    $language_manager = $this->getMock('Drupal\Core\Language\LanguageManagerInterface');
+    $language_manager = $this->getMock(LanguageManagerInterface::class);
 
-    $views_data = $this->getMockBuilder('Drupal\views\ViewsData')
+    $views_data = $this->getMockBuilder(ViewsData::class)
       ->disableOriginalConstructor()
       ->getMock();
     $views_data->expects($this->any())
@@ -66,18 +74,18 @@ public function testConstructor() {
     $container->set('string_translation', $this->getStringTranslationStub());
     \Drupal::setContainer($container);
 
-    $storage = $this->getMock('Drupal\views\ViewEntityInterface');
+    $storage = $this->getMock(ViewEntityInterface::class);
     $storage->expects($this->any())
       ->method('get')
       ->with('base_table')
       ->will($this->returnValue('users'));
 
-    $executable = $this->getMockBuilder('Drupal\views\ViewExecutable')
+    $executable = $this->getMockBuilder(ViewExecutable::class)
       ->disableOriginalConstructor()
       ->getMock();
     $executable->storage = $storage;
 
-    $display = $this->getMockBuilder('Drupal\views\Plugin\views\display\DisplayPluginBase')
+    $display = $this->getMockBuilder(DisplayPluginBase::class)
       ->disableOriginalConstructor()
       ->getMock();
 
diff --git a/core/modules/user/tests/src/Unit/PrivateTempStoreTest.php b/core/modules/user/tests/src/Unit/PrivateTempStoreTest.php
index 8d18811..d46b256 100644
--- a/core/modules/user/tests/src/Unit/PrivateTempStoreTest.php
+++ b/core/modules/user/tests/src/Unit/PrivateTempStoreTest.php
@@ -2,6 +2,9 @@
 
 namespace Drupal\Tests\user\Unit;
 
+use Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface;
+use Drupal\Core\Lock\LockBackendInterface;
+use Drupal\Core\Session\AccountProxyInterface;
 use Drupal\Tests\UnitTestCase;
 use Drupal\user\PrivateTempStore;
 use Drupal\user\TempStoreException;
@@ -69,9 +72,9 @@ class PrivateTempStoreTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $this->keyValue = $this->getMock('Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface');
-    $this->lock = $this->getMock('Drupal\Core\Lock\LockBackendInterface');
-    $this->currentUser = $this->getMock('Drupal\Core\Session\AccountProxyInterface');
+    $this->keyValue = $this->getMock(KeyValueStoreExpirableInterface::class);
+    $this->lock = $this->getMock(LockBackendInterface::class);
+    $this->currentUser = $this->getMock(AccountProxyInterface::class);
     $this->currentUser->expects($this->any())
       ->method('id')
       ->willReturn(1);
diff --git a/core/modules/user/tests/src/Unit/SharedTempStoreTest.php b/core/modules/user/tests/src/Unit/SharedTempStoreTest.php
index 33bde41..ad35907 100644
--- a/core/modules/user/tests/src/Unit/SharedTempStoreTest.php
+++ b/core/modules/user/tests/src/Unit/SharedTempStoreTest.php
@@ -2,6 +2,8 @@
 
 namespace Drupal\Tests\user\Unit;
 
+use Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface;
+use Drupal\Core\Lock\LockBackendInterface;
 use Drupal\Tests\UnitTestCase;
 use Drupal\user\SharedTempStore;
 use Drupal\user\TempStoreException;
@@ -69,8 +71,8 @@ class SharedTempStoreTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $this->keyValue = $this->getMock('Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface');
-    $this->lock = $this->getMock('Drupal\Core\Lock\LockBackendInterface');
+    $this->keyValue = $this->getMock(KeyValueStoreExpirableInterface::class);
+    $this->lock = $this->getMock(LockBackendInterface::class);
     $this->requestStack = new RequestStack();
     $request = Request::createFromGlobals();
     $this->requestStack->push($request);
diff --git a/core/modules/user/tests/src/Unit/UserAccessControlHandlerTest.php b/core/modules/user/tests/src/Unit/UserAccessControlHandlerTest.php
index 216e8d6..d5a4b41 100644
--- a/core/modules/user/tests/src/Unit/UserAccessControlHandlerTest.php
+++ b/core/modules/user/tests/src/Unit/UserAccessControlHandlerTest.php
@@ -5,6 +5,11 @@
 use Drupal\Core\Access\AccessResult;
 use Drupal\Core\Cache\Context\CacheContextsManager;
 use Drupal\Core\DependencyInjection\Container;
+use Drupal\Core\Entity\EntityTypeInterface;
+use Drupal\Core\Extension\ModuleHandlerInterface;
+use Drupal\Core\Field\FieldDefinitionInterface;
+use Drupal\Core\Field\FieldItemList;
+use Drupal\Core\Session\AccountInterface;
 use Drupal\Tests\UnitTestCase;
 use Drupal\user\UserAccessControlHandler;
 
@@ -66,7 +71,7 @@ protected function setUp() {
     $container->set('cache_contexts_manager', $cache_contexts_manager);
     \Drupal::setContainer($container);
 
-    $this->viewer = $this->getMock('\Drupal\Core\Session\AccountInterface');
+    $this->viewer = $this->getMock(AccountInterface::class);
     $this->viewer
       ->expects($this->any())
       ->method('hasPermission')
@@ -76,7 +81,7 @@ protected function setUp() {
       ->method('id')
       ->will($this->returnValue(1));
 
-    $this->owner = $this->getMock('\Drupal\Core\Session\AccountInterface');
+    $this->owner = $this->getMock(AccountInterface::class);
     $this->owner
       ->expects($this->any())
       ->method('hasPermission')
@@ -90,22 +95,22 @@ protected function setUp() {
       ->method('id')
       ->will($this->returnValue(2));
 
-    $this->admin = $this->getMock('\Drupal\Core\Session\AccountInterface');
+    $this->admin = $this->getMock(AccountInterface::class);
     $this->admin
       ->expects($this->any())
       ->method('hasPermission')
       ->will($this->returnValue(TRUE));
 
-    $entity_type = $this->getMock('Drupal\Core\Entity\EntityTypeInterface');
+    $entity_type = $this->getMock(EntityTypeInterface::class);
 
     $this->accessControlHandler = new UserAccessControlHandler($entity_type);
-    $module_handler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface');
+    $module_handler = $this->getMock(ModuleHandlerInterface::class);
     $module_handler->expects($this->any())
       ->method('getImplementations')
       ->will($this->returnValue([]));
     $this->accessControlHandler->setModuleHandler($module_handler);
 
-    $this->items = $this->getMockBuilder('Drupal\Core\Field\FieldItemList')
+    $this->items = $this->getMockBuilder(FieldItemList::class)
       ->disableOriginalConstructor()
       ->getMock();
     $this->items
@@ -118,7 +123,7 @@ protected function setUp() {
    * Asserts correct field access grants for a field.
    */
   public function assertFieldAccess($field, $viewer, $target, $view, $edit) {
-    $field_definition = $this->getMock('Drupal\Core\Field\FieldDefinitionInterface');
+    $field_definition = $this->getMock(FieldDefinitionInterface::class);
     $field_definition->expects($this->any())
       ->method('getName')
       ->will($this->returnValue($field));
diff --git a/core/modules/user/tests/src/Unit/UserAuthTest.php b/core/modules/user/tests/src/Unit/UserAuthTest.php
index 698c8b5..18d1611 100644
--- a/core/modules/user/tests/src/Unit/UserAuthTest.php
+++ b/core/modules/user/tests/src/Unit/UserAuthTest.php
@@ -2,7 +2,11 @@
 
 namespace Drupal\Tests\user\Unit;
 
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Entity\EntityStorageInterface;
+use Drupal\Core\Password\PasswordInterface;
 use Drupal\Tests\UnitTestCase;
+use Drupal\user\Entity\User;
 use Drupal\user\UserAuth;
 
 /**
@@ -57,17 +61,17 @@ class UserAuthTest extends UnitTestCase {
    * {@inheritdoc}
    */
   protected function setUp() {
-    $this->userStorage = $this->getMock('Drupal\Core\Entity\EntityStorageInterface');
+    $this->userStorage = $this->getMock(EntityStorageInterface::class);
 
-    $entity_manager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
+    $entity_manager = $this->getMock(EntityManagerInterface::class);
     $entity_manager->expects($this->any())
       ->method('getStorage')
       ->with('user')
       ->will($this->returnValue($this->userStorage));
 
-    $this->passwordService = $this->getMock('Drupal\Core\Password\PasswordInterface');
+    $this->passwordService = $this->getMock(PasswordInterface::class);
 
-    $this->testUser = $this->getMockBuilder('Drupal\user\Entity\User')
+    $this->testUser = $this->getMockBuilder(User::class)
       ->disableOriginalConstructor()
       ->setMethods(['id', 'setPassword', 'save', 'getPassword'])
       ->getMock();
diff --git a/core/modules/user/tests/src/Unit/Views/Argument/RolesRidTest.php b/core/modules/user/tests/src/Unit/Views/Argument/RolesRidTest.php
index b8f2888..6c347d1 100644
--- a/core/modules/user/tests/src/Unit/Views/Argument/RolesRidTest.php
+++ b/core/modules/user/tests/src/Unit/Views/Argument/RolesRidTest.php
@@ -3,6 +3,9 @@
 namespace Drupal\Tests\user\Unit\Views\Argument;
 
 use Drupal\Core\DependencyInjection\ContainerBuilder;
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Entity\EntityStorageInterface;
+use Drupal\Core\Entity\EntityTypeInterface;
 use Drupal\Tests\UnitTestCase;
 use Drupal\user\Entity\Role;
 use Drupal\user\Plugin\views\argument\RolesRid;
@@ -29,7 +32,7 @@ public function testTitleQuery() {
     ], 'user_role');
 
     // Creates a stub entity storage;
-    $role_storage = $this->getMockForAbstractClass('Drupal\Core\Entity\EntityStorageInterface');
+    $role_storage = $this->getMockForAbstractClass(EntityStorageInterface::class);
     $role_storage->expects($this->any())
       ->method('loadMultiple')
       ->will($this->returnValueMap([
@@ -38,13 +41,13 @@ public function testTitleQuery() {
         [['test_rid_1', 'test_rid_2'], ['test_rid_1' => $role1, 'test_rid_2' => $role2]],
       ]));
 
-    $entity_type = $this->getMock('Drupal\Core\Entity\EntityTypeInterface');
+    $entity_type = $this->getMock(EntityTypeInterface::class);
     $entity_type->expects($this->any())
       ->method('getKey')
       ->with('label')
       ->will($this->returnValue('label'));
 
-    $entity_manager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
+    $entity_manager = $this->getMock(EntityManagerInterface::class);
     $entity_manager->expects($this->any())
       ->method('getDefinition')
       ->with($this->equalTo('user_role'))
diff --git a/core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php b/core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php
index f766975..6d094f7 100644
--- a/core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php
+++ b/core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php
@@ -2,10 +2,25 @@
 
 namespace Drupal\Tests\views\Unit\Controller;
 
+use Drupal\Core\Controller\ControllerResolverInterface;
+use Drupal\Core\Entity\EntityStorageInterface;
+use Drupal\Core\Path\CurrentPathStack;
+use Drupal\Core\Render\ElementInfoManagerInterface;
+use Drupal\Core\Render\PlaceholderGeneratorInterface;
+use Drupal\Core\Render\RenderCacheInterface;
 use Drupal\Core\Render\RenderContext;
+use Drupal\Core\Render\Renderer;
+use Drupal\Core\Render\RendererInterface;
+use Drupal\Core\Routing\RedirectDestinationInterface;
+use Drupal\Core\Theme\ThemeManagerInterface;
 use Drupal\Tests\UnitTestCase;
+use Drupal\views\DisplayPluginCollection;
+use Drupal\views\ViewExecutable;
+use Drupal\views\ViewExecutableFactory;
 use Drupal\views\Ajax\ViewAjaxResponse;
 use Drupal\views\Controller\ViewAjaxController;
+use Drupal\views\Entity\View;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\DependencyInjection\ContainerBuilder;
 use Symfony\Component\HttpFoundation\RequestStack;
@@ -64,11 +79,11 @@ class ViewAjaxControllerTest extends UnitTestCase {
    * {@inheritdoc}
    */
   protected function setUp() {
-    $this->viewStorage = $this->getMock('Drupal\Core\Entity\EntityStorageInterface');
-    $this->executableFactory = $this->getMockBuilder('Drupal\views\ViewExecutableFactory')
+    $this->viewStorage = $this->getMock(EntityStorageInterface::class);
+    $this->executableFactory = $this->getMockBuilder(ViewExecutableFactory::class)
       ->disableOriginalConstructor()
       ->getMock();
-    $this->renderer = $this->getMock('\Drupal\Core\Render\RendererInterface');
+    $this->renderer = $this->getMock(RendererInterface::class);
     $this->renderer->expects($this->any())
       ->method('render')
       ->will($this->returnCallback(function(array &$elements) {
@@ -80,22 +95,22 @@ protected function setUp() {
       ->willReturnCallback(function (RenderContext $context, callable $callable) {
         return $callable();
       });
-    $this->currentPath = $this->getMockBuilder('Drupal\Core\Path\CurrentPathStack')
+    $this->currentPath = $this->getMockBuilder(CurrentPathStack::class)
       ->disableOriginalConstructor()
       ->getMock();
-    $this->redirectDestination = $this->getMock('\Drupal\Core\Routing\RedirectDestinationInterface');
+    $this->redirectDestination = $this->getMock(RedirectDestinationInterface::class);
 
     $this->viewAjaxController = new ViewAjaxController($this->viewStorage, $this->executableFactory, $this->renderer, $this->currentPath, $this->redirectDestination);
 
-    $element_info_manager = $this->getMock('\Drupal\Core\Render\ElementInfoManagerInterface');
+    $element_info_manager = $this->getMock(ElementInfoManagerInterface::class);
     $request_stack = new RequestStack();
     $request_stack->push(new Request());
     $args = [
-      $this->getMock('\Drupal\Core\Controller\ControllerResolverInterface'),
-      $this->getMock('\Drupal\Core\Theme\ThemeManagerInterface'),
+      $this->getMock(ControllerResolverInterface::class),
+      $this->getMock(ThemeManagerInterface::class),
       $element_info_manager,
-      $this->getMock('\Drupal\Core\Render\PlaceholderGeneratorInterface'),
-      $this->getMock('\Drupal\Core\Render\RenderCacheInterface'),
+      $this->getMock(PlaceholderGeneratorInterface::class),
+      $this->getMock(RenderCacheInterface::class),
       $request_stack,
       [
         'required_cache_contexts' => [
@@ -104,7 +119,7 @@ protected function setUp() {
         ],
       ],
     ];
-    $this->renderer = $this->getMockBuilder('Drupal\Core\Render\Renderer')
+    $this->renderer = $this->getMockBuilder(Renderer::class)
       ->setConstructorArgs($args)
       ->setMethods(NULL)
       ->getMock();
@@ -147,7 +162,7 @@ public function testAccessDeniedView() {
     $request->request->set('view_name', 'test_view');
     $request->request->set('view_display_id', 'page_1');
 
-    $view = $this->getMockBuilder('Drupal\views\Entity\View')
+    $view = $this->getMockBuilder(View::class)
       ->disableOriginalConstructor()
       ->getMock();
 
@@ -156,7 +171,7 @@ public function testAccessDeniedView() {
       ->with('test_view')
       ->will($this->returnValue($view));
 
-    $executable = $this->getMockBuilder('Drupal\views\ViewExecutable')
+    $executable = $this->getMockBuilder(ViewExecutable::class)
       ->disableOriginalConstructor()
       ->getMock();
     $executable->expects($this->once())
@@ -186,14 +201,14 @@ public function testAjaxView() {
 
     list($view, $executable) = $this->setupValidMocks();
 
-    $display_handler = $this->getMockBuilder('Drupal\views\Plugin\views\display\DisplayPluginBase')
+    $display_handler = $this->getMockBuilder(DisplayPluginBase::class)
       ->disableOriginalConstructor()
       ->getMock();
     // Ensure that the pager element is not set.
     $display_handler->expects($this->never())
       ->method('setOption');
 
-    $display_collection = $this->getMockBuilder('Drupal\views\DisplayPluginCollection')
+    $display_collection = $this->getMockBuilder(DisplayPluginCollection::class)
       ->disableOriginalConstructor()
       ->getMock();
     $display_collection->expects($this->any())
@@ -269,14 +284,14 @@ public function testAjaxViewWithPager() {
 
     list($view, $executable) = $this->setupValidMocks();
 
-    $display_handler = $this->getMockBuilder('Drupal\views\Plugin\views\display\DisplayPluginBase')
+    $display_handler = $this->getMockBuilder(DisplayPluginBase::class)
       ->disableOriginalConstructor()
       ->getMock();
     $display_handler->expects($this->once())
       ->method('setOption', '0')
       ->with($this->equalTo('pager_element'));
 
-    $display_collection = $this->getMockBuilder('Drupal\views\DisplayPluginCollection')
+    $display_collection = $this->getMockBuilder(DisplayPluginCollection::class)
       ->disableOriginalConstructor()
       ->getMock();
     $display_collection->expects($this->any())
@@ -299,7 +314,7 @@ public function testAjaxViewWithPager() {
    * Sets up a bunch of valid mocks like the view entity and executable.
    */
   protected function setupValidMocks() {
-    $view = $this->getMockBuilder('Drupal\views\Entity\View')
+    $view = $this->getMockBuilder(View::class)
       ->disableOriginalConstructor()
       ->getMock();
 
@@ -308,7 +323,7 @@ protected function setupValidMocks() {
       ->with('test_view')
       ->will($this->returnValue($view));
 
-    $executable = $this->getMockBuilder('Drupal\views\ViewExecutable')
+    $executable = $this->getMockBuilder(ViewExecutable::class)
       ->disableOriginalConstructor()
       ->getMock();
     $executable->expects($this->once())
diff --git a/core/modules/views/tests/src/Unit/EntityViewsDataTest.php b/core/modules/views/tests/src/Unit/EntityViewsDataTest.php
index 74bcc08..b77e6ef 100644
--- a/core/modules/views/tests/src/Unit/EntityViewsDataTest.php
+++ b/core/modules/views/tests/src/Unit/EntityViewsDataTest.php
@@ -9,15 +9,21 @@
 
 use Drupal\Core\Config\Entity\ConfigEntityType;
 use Drupal\Core\Entity\ContentEntityType;
+use Drupal\Core\Entity\EntityManagerInterface;
 use Drupal\Core\Entity\EntityTypeInterface;
 use Drupal\Core\Entity\Sql\DefaultTableMapping;
+use Drupal\Core\Entity\Sql\SqlContentEntityStorage;
+use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Field\BaseFieldDefinition;
+use Drupal\Core\Field\FieldStorageDefinitionInterface;
+use Drupal\Core\Field\FieldTypePluginManager;
 use Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem;
 use Drupal\Core\Field\Plugin\Field\FieldType\IntegerItem;
 use Drupal\Core\Field\Plugin\Field\FieldType\LanguageItem;
 use Drupal\Core\Field\Plugin\Field\FieldType\StringItem;
 use Drupal\Core\Field\Plugin\Field\FieldType\UriItem;
 use Drupal\Core\Field\Plugin\Field\FieldType\UuidItem;
+use Drupal\Core\TypedData\DataDefinitionInterface;
 use Drupal\Core\TypedData\TypedDataManagerInterface;
 use Drupal\text\Plugin\Field\FieldType\TextLongItem;
 use Drupal\entity_test\Entity\EntityTest;
@@ -79,15 +85,15 @@ class EntityViewsDataTest extends UnitTestCase {
    * {@inheritdoc}
    */
   protected function setUp() {
-    $this->entityStorage = $this->getMockBuilder('Drupal\Core\Entity\Sql\SqlContentEntityStorage')
+    $this->entityStorage = $this->getMockBuilder(SqlContentEntityStorage::class)
       ->disableOriginalConstructor()
       ->getMock();
-    $this->entityManager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
+    $this->entityManager = $this->getMock(EntityManagerInterface::class);
 
     $typed_data_manager = $this->getMock(TypedDataManagerInterface::class);
     $typed_data_manager->expects($this->any())
       ->method('createDataDefinition')
-      ->willReturn($this->getMock('Drupal\Core\TypedData\DataDefinitionInterface'));
+      ->willReturn($this->getMock(DataDefinitionInterface::class));
 
     $typed_data_manager->expects($this->any())
       ->method('getDefinition')
@@ -110,11 +116,11 @@ protected function setUp() {
     ]);
 
     $this->translationManager = $this->getStringTranslationStub();
-    $this->moduleHandler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface');
+    $this->moduleHandler = $this->getMock(ModuleHandlerInterface::class);
 
     $this->viewsData = new TestEntityViewsData($this->baseEntityType, $this->entityStorage, $this->entityManager, $this->moduleHandler, $this->translationManager);
 
-    $field_type_manager = $this->getMockBuilder('Drupal\Core\Field\FieldTypePluginManager')
+    $field_type_manager = $this->getMockBuilder(FieldTypePluginManager::class)
       ->disableOriginalConstructor()
       ->getMock();
     $field_type_manager->expects($this->any())
@@ -360,35 +366,35 @@ public function testRevisionTableWithRevisionDataTable() {
    * Helper method to mock all store definitions.
    */
   protected function setupFieldStorageDefinition() {
-    $id_field_storage_definition = $this->getMock('Drupal\Core\Field\FieldStorageDefinitionInterface');
+    $id_field_storage_definition = $this->getMock(FieldStorageDefinitionInterface::class);
     $id_field_storage_definition->expects($this->any())
       ->method('getSchema')
       ->willReturn(IntegerItem::schema($id_field_storage_definition));
-    $uuid_field_storage_definition = $this->getMock('Drupal\Core\Field\FieldStorageDefinitionInterface');
+    $uuid_field_storage_definition = $this->getMock(FieldStorageDefinitionInterface::class);
     $uuid_field_storage_definition->expects($this->any())
       ->method('getSchema')
       ->willReturn(UuidItem::schema($uuid_field_storage_definition));
-    $type_field_storage_definition = $this->getMock('Drupal\Core\Field\FieldStorageDefinitionInterface');
+    $type_field_storage_definition = $this->getMock(FieldStorageDefinitionInterface::class);
     $type_field_storage_definition->expects($this->any())
       ->method('getSchema')
       ->willReturn(StringItem::schema($type_field_storage_definition));
-    $langcode_field_storage_definition = $this->getMock('Drupal\Core\Field\FieldStorageDefinitionInterface');
+    $langcode_field_storage_definition = $this->getMock(FieldStorageDefinitionInterface::class);
     $langcode_field_storage_definition->expects($this->any())
       ->method('getSchema')
       ->willReturn(LanguageItem::schema($langcode_field_storage_definition));
-    $name_field_storage_definition = $this->getMock('Drupal\Core\Field\FieldStorageDefinitionInterface');
+    $name_field_storage_definition = $this->getMock(FieldStorageDefinitionInterface::class);
     $name_field_storage_definition->expects($this->any())
       ->method('getSchema')
       ->willReturn(StringItem::schema($name_field_storage_definition));
-    $description_field_storage_definition = $this->getMock('Drupal\Core\Field\FieldStorageDefinitionInterface');
+    $description_field_storage_definition = $this->getMock(FieldStorageDefinitionInterface::class);
     $description_field_storage_definition->expects($this->any())
       ->method('getSchema')
       ->willReturn(TextLongItem::schema($description_field_storage_definition));
-    $homepage_field_storage_definition = $this->getMock('Drupal\Core\Field\FieldStorageDefinitionInterface');
+    $homepage_field_storage_definition = $this->getMock(FieldStorageDefinitionInterface::class);
     $homepage_field_storage_definition->expects($this->any())
       ->method('getSchema')
       ->willReturn(UriItem::schema($homepage_field_storage_definition));
-    $string_field_storage_definition = $this->getMock('Drupal\Core\Field\FieldStorageDefinitionInterface');
+    $string_field_storage_definition = $this->getMock(FieldStorageDefinitionInterface::class);
     $string_field_storage_definition->expects($this->any())
       ->method('getSchema')
       ->willReturn(StringItem::schema($string_field_storage_definition));
@@ -400,7 +406,7 @@ protected function setupFieldStorageDefinition() {
           ['user', TRUE, static::userEntityInfo()],
         ]
       );
-    $user_id_field_storage_definition = $this->getMock('Drupal\Core\Field\FieldStorageDefinitionInterface');
+    $user_id_field_storage_definition = $this->getMock(FieldStorageDefinitionInterface::class);
     $user_id_field_storage_definition->expects($this->any())
       ->method('getSetting')
       ->with('target_type')
@@ -412,7 +418,7 @@ protected function setupFieldStorageDefinition() {
       ->method('getSchema')
       ->willReturn(EntityReferenceItem::schema($user_id_field_storage_definition));
 
-    $revision_id_field_storage_definition = $this->getMock('Drupal\Core\Field\FieldStorageDefinitionInterface');
+    $revision_id_field_storage_definition = $this->getMock(FieldStorageDefinitionInterface::class);
     $revision_id_field_storage_definition->expects($this->any())
       ->method('getSchema')
       ->willReturn(IntegerItem::schema($revision_id_field_storage_definition));
diff --git a/core/modules/views/tests/src/Unit/EventSubscriber/RouteSubscriberTest.php b/core/modules/views/tests/src/Unit/EventSubscriber/RouteSubscriberTest.php
index c89554a..4d5e247 100644
--- a/core/modules/views/tests/src/Unit/EventSubscriber/RouteSubscriberTest.php
+++ b/core/modules/views/tests/src/Unit/EventSubscriber/RouteSubscriberTest.php
@@ -7,9 +7,16 @@
 
 namespace Drupal\Tests\views\Unit\EventSubscriber;
 
+use Drupal\Core\Config\Entity\ConfigEntityStorage;
+use Drupal\Core\Entity\EntityManagerInterface;
 use Drupal\Core\Routing\RouteBuildEvent;
+use Drupal\Core\State\StateInterface;
 use Drupal\Tests\UnitTestCase;
+use Drupal\views\DisplayPluginCollection;
+use Drupal\views\Entity\View;
+use Drupal\views\ViewExecutable;
 use Drupal\views\EventSubscriber\RouteSubscriber;
+use Drupal\views\Plugin\views\display\DisplayRouterInterface;
 use Symfony\Component\Routing\Route;
 use Symfony\Component\Routing\RouteCollection;
 
@@ -48,15 +55,15 @@ class RouteSubscriberTest extends UnitTestCase {
   protected $state;
 
   protected function setUp() {
-    $this->entityManager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
-    $this->viewStorage = $this->getMockBuilder('Drupal\Core\Config\Entity\ConfigEntityStorage')
+    $this->entityManager = $this->getMock(EntityManagerInterface::class);
+    $this->viewStorage = $this->getMockBuilder(ConfigEntityStorage::class)
       ->disableOriginalConstructor()
       ->getMock();
     $this->entityManager->expects($this->any())
       ->method('getStorage')
       ->with('view')
       ->will($this->returnValue($this->viewStorage));
-    $this->state = $this->getMock('\Drupal\Core\State\StateInterface');
+    $this->state = $this->getMock(StateInterface::class);
     $this->routeSubscriber = new TestRouteSubscriber($this->entityManager, $this->state);
   }
 
@@ -143,10 +150,10 @@ public function testOnAlterRoutes() {
    *   An array of two mocked view displays
    */
   protected function setupMocks() {
-    $executable = $this->getMockBuilder('Drupal\views\ViewExecutable')
+    $executable = $this->getMockBuilder(ViewExecutable::class)
       ->disableOriginalConstructor()
       ->getMock();
-    $view = $this->getMockBuilder('Drupal\views\Entity\View')
+    $view = $this->getMockBuilder(View::class)
       ->disableOriginalConstructor()
       ->getMock();
     $this->viewStorage->expects($this->any())
@@ -170,10 +177,10 @@ protected function setupMocks() {
       ]));
 
     // Ensure that only the first two displays are actually called.
-    $display_1 = $this->getMock('Drupal\views\Plugin\views\display\DisplayRouterInterface');
-    $display_2 = $this->getMock('Drupal\views\Plugin\views\display\DisplayRouterInterface');
+    $display_1 = $this->getMock(DisplayRouterInterface::class);
+    $display_2 = $this->getMock(DisplayRouterInterface::class);
 
-    $display_collection = $this->getMockBuilder('Drupal\views\DisplayPluginCollection')
+    $display_collection = $this->getMockBuilder(DisplayPluginCollection::class)
       ->disableOriginalConstructor()
       ->getMock();
     $display_collection->expects($this->any())
diff --git a/core/modules/views/tests/src/Unit/Plugin/Block/ViewsBlockTest.php b/core/modules/views/tests/src/Unit/Plugin/Block/ViewsBlockTest.php
index cbe6ade..d9ff9d9 100644
--- a/core/modules/views/tests/src/Unit/Plugin/Block/ViewsBlockTest.php
+++ b/core/modules/views/tests/src/Unit/Plugin/Block/ViewsBlockTest.php
@@ -2,9 +2,16 @@
 
 namespace Drupal\Tests\views\Unit\Plugin\Block;
 
+use Drupal\Core\Config\Entity\ConfigEntityStorage;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
+use Drupal\Core\Executable\ExecutableManagerInterface;
+use Drupal\Core\Session\AccountInterface;
 use Drupal\Tests\UnitTestCase;
+use Drupal\views\Entity\View;
+use Drupal\views\ViewExecutable;
+use Drupal\views\ViewExecutableFactory;
 use Drupal\views\Plugin\Block\ViewsBlock;
+use Drupal\views\Plugin\views\display\Block;
 
 /**
  * @coversDefaultClass \Drupal\views\Plugin\block\ViewsBlock
@@ -59,7 +66,7 @@ class ViewsBlockTest extends UnitTestCase {
    */
   protected function setUp() {
     parent::setUp(); // TODO: Change the autogenerated stub
-    $condition_plugin_manager = $this->getMock('Drupal\Core\Executable\ExecutableManagerInterface');
+    $condition_plugin_manager = $this->getMock(ExecutableManagerInterface::class);
     $condition_plugin_manager->expects($this->any())
       ->method('getDefinitions')
       ->will($this->returnValue([]));
@@ -67,7 +74,7 @@ protected function setUp() {
     $container->set('plugin.manager.condition', $condition_plugin_manager);
     \Drupal::setContainer($container);
 
-    $this->executable = $this->getMockBuilder('Drupal\views\ViewExecutable')
+    $this->executable = $this->getMockBuilder(ViewExecutable::class)
       ->disableOriginalConstructor()
       ->setMethods(['buildRenderable', 'setDisplay', 'setItemsPerPage'])
       ->getMock();
@@ -79,12 +86,12 @@ protected function setUp() {
       ->method('getShowAdminLinks')
       ->willReturn(FALSE);
 
-    $this->executable->display_handler = $this->getMockBuilder('Drupal\views\Plugin\views\display\Block')
+    $this->executable->display_handler = $this->getMockBuilder(Block::class)
       ->disableOriginalConstructor()
       ->setMethods(NULL)
       ->getMock();
 
-    $this->view = $this->getMockBuilder('Drupal\views\Entity\View')
+    $this->view = $this->getMockBuilder(View::class)
       ->disableOriginalConstructor()
       ->getMock();
     $this->view->expects($this->any())
@@ -92,7 +99,7 @@ protected function setUp() {
       ->willReturn('test_view');
     $this->executable->storage = $this->view;
 
-    $this->executableFactory = $this->getMockBuilder('Drupal\views\ViewExecutableFactory')
+    $this->executableFactory = $this->getMockBuilder(ViewExecutableFactory::class)
       ->disableOriginalConstructor()
       ->getMock();
     $this->executableFactory->expects($this->any())
@@ -100,7 +107,7 @@ protected function setUp() {
       ->with($this->view)
       ->will($this->returnValue($this->executable));
 
-    $this->displayHandler = $this->getMockBuilder('Drupal\views\Plugin\views\display\Block')
+    $this->displayHandler = $this->getMockBuilder(Block::class)
       ->disableOriginalConstructor()
       ->getMock();
 
@@ -118,7 +125,7 @@ protected function setUp() {
 
     $this->executable->display_handler = $this->displayHandler;
 
-    $this->storage = $this->getMockBuilder('Drupal\Core\Config\Entity\ConfigEntityStorage')
+    $this->storage = $this->getMockBuilder(ConfigEntityStorage::class)
       ->disableOriginalConstructor()
       ->getMock();
 
@@ -126,7 +133,7 @@ protected function setUp() {
       ->method('load')
       ->with('test_view')
       ->will($this->returnValue($this->view));
-    $this->account = $this->getMock('Drupal\Core\Session\AccountInterface');
+    $this->account = $this->getMock(AccountInterface::class);
   }
 
   /**
diff --git a/core/modules/views/tests/src/Unit/Plugin/Derivative/ViewsLocalTaskTest.php b/core/modules/views/tests/src/Unit/Plugin/Derivative/ViewsLocalTaskTest.php
index 7ecf9ef..2c06905 100644
--- a/core/modules/views/tests/src/Unit/Plugin/Derivative/ViewsLocalTaskTest.php
+++ b/core/modules/views/tests/src/Unit/Plugin/Derivative/ViewsLocalTaskTest.php
@@ -7,8 +7,14 @@
 
 namespace Drupal\Tests\views\Unit\Plugin\Derivative;
 
+use Drupal\Core\Entity\EntityStorageInterface;
+use Drupal\Core\Routing\RouteProviderInterface;
+use Drupal\Core\State\StateInterface;
 use Drupal\Tests\UnitTestCase;
+use Drupal\views\Entity\View;
+use Drupal\views\ViewExecutable;
 use Drupal\views\Plugin\Derivative\ViewsLocalTask;
+use Drupal\views\Plugin\views\display\PathPluginBase;
 use Symfony\Component\Routing\Route;
 use Symfony\Component\Routing\RouteCollection;
 
@@ -50,9 +56,9 @@ class ViewsLocalTaskTest extends UnitTestCase {
   protected $localTaskDerivative;
 
   protected function setUp() {
-    $this->routeProvider = $this->getMock('Drupal\Core\Routing\RouteProviderInterface');
-    $this->state = $this->getMock('Drupal\Core\State\StateInterface');
-    $this->viewStorage = $this->getMock('Drupal\Core\Entity\EntityStorageInterface');
+    $this->routeProvider = $this->getMock(RouteProviderInterface::class);
+    $this->state = $this->getMock(StateInterface::class);
+    $this->viewStorage = $this->getMock(EntityStorageInterface::class);
 
     $this->localTaskDerivative = new TestViewsLocalTask($this->routeProvider, $this->state, $this->viewStorage);
   }
@@ -74,10 +80,10 @@ public function testGetDerivativeDefinitionsWithoutHookMenuViews() {
    * Tests fetching the derivatives on a view with without a local task.
    */
   public function testGetDerivativeDefinitionsWithoutLocalTask() {
-    $executable = $this->getMockBuilder('Drupal\views\ViewExecutable')
+    $executable = $this->getMockBuilder(ViewExecutable::class)
       ->disableOriginalConstructor()
       ->getMock();
-    $display_plugin = $this->getMockBuilder('Drupal\views\Plugin\views\display\PathPluginBase')
+    $display_plugin = $this->getMockBuilder(PathPluginBase::class)
       ->setMethods(['getOption'])
       ->disableOriginalConstructor()
       ->getMockForAbstractClass();
@@ -87,7 +93,7 @@ public function testGetDerivativeDefinitionsWithoutLocalTask() {
       ->will($this->returnValue(['type' => 'normal']));
     $executable->display_handler = $display_plugin;
 
-    $storage = $this->getMockBuilder('Drupal\views\Entity\View')
+    $storage = $this->getMockBuilder(View::class)
       ->disableOriginalConstructor()
       ->getMock();
     $storage->expects($this->any())
@@ -113,10 +119,10 @@ public function testGetDerivativeDefinitionsWithoutLocalTask() {
    * Tests fetching the derivatives on a view with a default local task.
    */
   public function testGetDerivativeDefinitionsWithLocalTask() {
-    $executable = $this->getMockBuilder('Drupal\views\ViewExecutable')
+    $executable = $this->getMockBuilder(ViewExecutable::class)
       ->disableOriginalConstructor()
       ->getMock();
-    $storage = $this->getMockBuilder('Drupal\views\Entity\View')
+    $storage = $this->getMockBuilder(View::class)
       ->disableOriginalConstructor()
       ->getMock();
     $storage->expects($this->any())
@@ -132,7 +138,7 @@ public function testGetDerivativeDefinitionsWithLocalTask() {
       ->with('example_view')
       ->willReturn($storage);
 
-    $display_plugin = $this->getMockBuilder('Drupal\views\Plugin\views\display\PathPluginBase')
+    $display_plugin = $this->getMockBuilder(PathPluginBase::class)
       ->setMethods(['getOption'])
       ->disableOriginalConstructor()
       ->getMockForAbstractClass();
@@ -166,10 +172,10 @@ public function testGetDerivativeDefinitionsWithLocalTask() {
    * Tests fetching the derivatives on a view which overrides an existing route.
    */
   public function testGetDerivativeDefinitionsWithOverrideRoute() {
-    $executable = $this->getMockBuilder('Drupal\views\ViewExecutable')
+    $executable = $this->getMockBuilder(ViewExecutable::class)
       ->disableOriginalConstructor()
       ->getMock();
-    $storage = $this->getMockBuilder('Drupal\views\Entity\View')
+    $storage = $this->getMockBuilder(View::class)
       ->disableOriginalConstructor()
       ->getMock();
     $storage->expects($this->any())
@@ -185,7 +191,7 @@ public function testGetDerivativeDefinitionsWithOverrideRoute() {
       ->with('example_view')
       ->willReturn($storage);
 
-    $display_plugin = $this->getMockBuilder('Drupal\views\Plugin\views\display\PathPluginBase')
+    $display_plugin = $this->getMockBuilder(PathPluginBase::class)
       ->setMethods(['getOption'])
       ->disableOriginalConstructor()
       ->getMockForAbstractClass();
@@ -215,10 +221,10 @@ public function testGetDerivativeDefinitionsWithOverrideRoute() {
    * Tests fetching the derivatives on a view with a default local task.
    */
   public function testGetDerivativeDefinitionsWithDefaultLocalTask() {
-    $executable = $this->getMockBuilder('Drupal\views\ViewExecutable')
+    $executable = $this->getMockBuilder(ViewExecutable::class)
       ->disableOriginalConstructor()
       ->getMock();
-    $storage = $this->getMockBuilder('Drupal\views\Entity\View')
+    $storage = $this->getMockBuilder(View::class)
       ->disableOriginalConstructor()
       ->getMock();
     $storage->expects($this->any())
@@ -234,7 +240,7 @@ public function testGetDerivativeDefinitionsWithDefaultLocalTask() {
       ->with('example_view')
       ->willReturn($storage);
 
-    $display_plugin = $this->getMockBuilder('Drupal\views\Plugin\views\display\PathPluginBase')
+    $display_plugin = $this->getMockBuilder(PathPluginBase::class)
       ->setMethods(['getOption'])
       ->disableOriginalConstructor()
       ->getMockForAbstractClass();
@@ -284,10 +290,10 @@ public function testGetDerivativeDefinitionsWithDefaultLocalTask() {
    * The parent is defined by another module, not views.
    */
   public function testGetDerivativeDefinitionsWithExistingLocalTask() {
-    $executable = $this->getMockBuilder('Drupal\views\ViewExecutable')
+    $executable = $this->getMockBuilder(ViewExecutable::class)
       ->disableOriginalConstructor()
       ->getMock();
-    $storage = $this->getMockBuilder('Drupal\views\Entity\View')
+    $storage = $this->getMockBuilder(View::class)
       ->disableOriginalConstructor()
       ->getMock();
     $storage->expects($this->any())
@@ -303,7 +309,7 @@ public function testGetDerivativeDefinitionsWithExistingLocalTask() {
       ->with('example_view')
       ->willReturn($storage);
 
-    $display_plugin = $this->getMockBuilder('Drupal\views\Plugin\views\display\PathPluginBase')
+    $display_plugin = $this->getMockBuilder(PathPluginBase::class)
       ->setMethods(['getOption', 'getPath'])
       ->disableOriginalConstructor()
       ->getMockForAbstractClass();
diff --git a/core/modules/views/tests/src/Unit/Plugin/area/EntityTest.php b/core/modules/views/tests/src/Unit/Plugin/area/EntityTest.php
index 556aef9..d339146 100644
--- a/core/modules/views/tests/src/Unit/Plugin/area/EntityTest.php
+++ b/core/modules/views/tests/src/Unit/Plugin/area/EntityTest.php
@@ -2,8 +2,17 @@
 
 namespace Drupal\Tests\views\Unit\Plugin\area;
 
+use Drupal\Core\Entity\EntityInterface;
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Entity\EntityStorageInterface;
+use Drupal\Core\Entity\EntityTypeInterface;
+use Drupal\Core\Entity\EntityViewBuilderInterface;
+use Drupal\Core\Utility\Token;
 use Drupal\Tests\UnitTestCase;
+use Drupal\views\ViewExecutable;
 use Drupal\views\Plugin\views\area\Entity;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
+use Drupal\views\Plugin\views\style\StylePluginBase;
 use Symfony\Component\DependencyInjection\ContainerBuilder;
 
 /**
@@ -67,17 +76,17 @@ class EntityTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $this->entityManager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
-    $this->entityStorage = $this->getMock('Drupal\Core\Entity\EntityStorageInterface');
-    $this->entityViewBuilder = $this->getMock('Drupal\Core\Entity\EntityViewBuilderInterface');
+    $this->entityManager = $this->getMock(EntityManagerInterface::class);
+    $this->entityStorage = $this->getMock(EntityStorageInterface::class);
+    $this->entityViewBuilder = $this->getMock(EntityViewBuilderInterface::class);
 
-    $this->executable = $this->getMockBuilder('Drupal\views\ViewExecutable')
+    $this->executable = $this->getMockBuilder(ViewExecutable::class)
       ->disableOriginalConstructor()
       ->getMock();
-    $this->display = $this->getMockBuilder('Drupal\views\Plugin\views\display\DisplayPluginBase')
+    $this->display = $this->getMockBuilder(DisplayPluginBase::class)
       ->disableOriginalConstructor()
       ->getMock();
-    $this->stylePlugin = $this->getMockBuilder('Drupal\views\Plugin\views\style\StylePluginBase')
+    $this->stylePlugin = $this->getMockBuilder(StylePluginBase::class)
       ->disableOriginalConstructor()
       ->getMock();
     $this->executable->style_plugin = $this->stylePlugin;
@@ -93,7 +102,7 @@ protected function setUp() {
       ->willReturn($this->stylePlugin);
 
 
-    $token = $this->getMockBuilder('Drupal\Core\Utility\Token')
+    $token = $this->getMockBuilder(Token::class)
       ->disableOriginalConstructor()
       ->getMock();
     $token->expects($this->any())
@@ -145,7 +154,7 @@ public function testRenderWithId() {
     ];
 
     /** @var \Drupal\Core\Entity\EntityInterface $entity */
-    $entity = $this->getMock('Drupal\Core\Entity\EntityInterface');
+    $entity = $this->getMock(EntityInterface::class);
     $entity->expects($this->once())
       ->method('access')
       ->willReturn(TRUE);
@@ -180,7 +189,7 @@ public function testRenderWithIdAndToken($token, $id) {
       'tokenize' => TRUE,
     ];
 
-    $entity = $this->getMock('Drupal\Core\Entity\EntityInterface');
+    $entity = $this->getMock(EntityInterface::class);
     $entity->expects($this->once())
       ->method('access')
       ->willReturn(TRUE);
@@ -219,7 +228,7 @@ public function testRenderWithUuid() {
       'target' => $uuid,
       'tokenize' => FALSE,
     ];
-    $entity = $this->getMock('Drupal\Core\Entity\EntityInterface');
+    $entity = $this->getMock(EntityInterface::class);
     $entity->expects($this->once())
       ->method('access')
       ->willReturn(TRUE);
@@ -263,8 +272,8 @@ public function testCalculateDependenciesWithUuid() {
     $this->setupEntityManager();
 
     $uuid = '1d52762e-b9d8-4177-908f-572d1a5845a4';
-    $entity = $this->getMock('Drupal\Core\Entity\EntityInterface');
-    $entity_type = $this->getMock('Drupal\Core\Entity\EntityTypeInterface');
+    $entity = $this->getMock(EntityInterface::class);
+    $entity_type = $this->getMock(EntityTypeInterface::class);
     $entity->expects($this->once())
       ->method('getConfigDependencyName')
       ->willReturn('entity_test:test-bundle:1d52762e-b9d8-4177-908f-572d1a5845a4');
@@ -294,8 +303,8 @@ public function testCalculateDependenciesWithUuid() {
   public function testCalculateDependenciesWithEntityId() {
     $this->setupEntityManager();
 
-    $entity = $this->getMock('Drupal\Core\Entity\EntityInterface');
-    $entity_type = $this->getMock('Drupal\Core\Entity\EntityTypeInterface');
+    $entity = $this->getMock(EntityInterface::class);
+    $entity_type = $this->getMock(EntityTypeInterface::class);
     $entity->expects($this->once())
       ->method('getConfigDependencyName')
       ->willReturn('entity_test:test-bundle:1d52762e-b9d8-4177-908f-572d1a5845a4');
diff --git a/core/modules/views/tests/src/Unit/Plugin/area/ViewTest.php b/core/modules/views/tests/src/Unit/Plugin/area/ViewTest.php
index 91d5282..ff10fc3 100644
--- a/core/modules/views/tests/src/Unit/Plugin/area/ViewTest.php
+++ b/core/modules/views/tests/src/Unit/Plugin/area/ViewTest.php
@@ -2,7 +2,10 @@
 
 namespace Drupal\Tests\views\Unit\Plugin\area;
 
+use Drupal\Core\Entity\EntityStorageInterface;
 use Drupal\Tests\UnitTestCase;
+use Drupal\views\ViewEntityInterface;
+use Drupal\views\ViewExecutable;
 use Drupal\views\Plugin\views\area\View as ViewAreaPlugin;
 
 /**
@@ -30,9 +33,9 @@ class ViewTest extends UnitTestCase {
    */
   protected function setUp() {
     parent::setUp();
-    $this->entityStorage = $this->getMock('Drupal\Core\Entity\EntityStorageInterface');
+    $this->entityStorage = $this->getMock(EntityStorageInterface::class);
     $this->viewHandler = new ViewAreaPlugin([], 'view', [], $this->entityStorage);
-    $this->viewHandler->view = $this->getMockBuilder('Drupal\views\ViewExecutable')
+    $this->viewHandler->view = $this->getMockBuilder(ViewExecutable::class)
       ->disableOriginalConstructor()
       ->getMock();
   }
@@ -43,11 +46,11 @@ protected function setUp() {
   public function testCalculateDependencies() {
     /* @var $view_this \Drupal\views\Entity\View */
     /* @var $view_other \Drupal\views\Entity\View */
-    $view_this = $this->getMock('Drupal\views\ViewEntityInterface');
+    $view_this = $this->getMock(ViewEntityInterface::class);
     $view_this->expects($this->any())->method('getConfigDependencyKey')->willReturn('config');
     $view_this->expects($this->any())->method('getConfigDependencyName')->willReturn('view.this');
     $view_this->expects($this->any())->method('id')->willReturn('this');
-    $view_other = $this->getMock('Drupal\views\ViewEntityInterface');
+    $view_other = $this->getMock(ViewEntityInterface::class);
     $view_other->expects($this->any())->method('getConfigDependencyKey')->willReturn('config');
     $view_other->expects($this->any())->method('getConfigDependencyName')->willReturn('view.other');
     $this->entityStorage->expects($this->any())
diff --git a/core/modules/views/tests/src/Unit/Plugin/argument_default/QueryParameterTest.php b/core/modules/views/tests/src/Unit/Plugin/argument_default/QueryParameterTest.php
index 8bacd3d..45b3279 100644
--- a/core/modules/views/tests/src/Unit/Plugin/argument_default/QueryParameterTest.php
+++ b/core/modules/views/tests/src/Unit/Plugin/argument_default/QueryParameterTest.php
@@ -3,7 +3,9 @@
 namespace Drupal\Tests\views\Unit\Plugin\argument_default;
 
 use Drupal\Tests\UnitTestCase;
+use Drupal\views\ViewExecutable;
 use Drupal\views\Plugin\views\argument_default\QueryParameter;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
 use Symfony\Component\HttpFoundation\Request;
 
 /**
@@ -19,12 +21,12 @@ class QueryParameterTest extends UnitTestCase {
    * @dataProvider providerGetArgument
    */
   public function testGetArgument($options, Request $request, $expected) {
-    $view = $this->getMockBuilder('Drupal\views\ViewExecutable')
+    $view = $this->getMockBuilder(ViewExecutable::class)
       ->disableOriginalConstructor()
       ->setMethods(NULL)
       ->getMock();
     $view->setRequest($request);
-    $display_plugin = $this->getMockBuilder('Drupal\views\Plugin\views\display\DisplayPluginBase')
+    $display_plugin = $this->getMockBuilder(DisplayPluginBase::class)
       ->disableOriginalConstructor()
       ->getMock();
 
diff --git a/core/modules/views/tests/src/Unit/Plugin/argument_default/RawTest.php b/core/modules/views/tests/src/Unit/Plugin/argument_default/RawTest.php
index 62c89a9..49231fb 100644
--- a/core/modules/views/tests/src/Unit/Plugin/argument_default/RawTest.php
+++ b/core/modules/views/tests/src/Unit/Plugin/argument_default/RawTest.php
@@ -2,9 +2,12 @@
 
 namespace Drupal\Tests\views\Unit\Plugin\argument_default;
 
+use Drupal\Core\Path\AliasManagerInterface;
 use Drupal\Core\Path\CurrentPathStack;
 use Drupal\Tests\UnitTestCase;
+use Drupal\views\ViewExecutable;
 use Drupal\views\Plugin\views\argument_default\Raw;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpFoundation\RequestStack;
 
@@ -20,10 +23,10 @@ class RawTest extends UnitTestCase {
    * @see \Drupal\views\Plugin\views\argument_default\Raw::getArgument()
    */
   public function testGetArgument() {
-    $view = $this->getMockBuilder('Drupal\views\ViewExecutable')
+    $view = $this->getMockBuilder(ViewExecutable::class)
       ->disableOriginalConstructor()
       ->getMock();
-    $display_plugin = $this->getMockBuilder('Drupal\views\Plugin\views\display\DisplayPluginBase')
+    $display_plugin = $this->getMockBuilder(DisplayPluginBase::class)
       ->disableOriginalConstructor()
       ->getMock();
     $current_path = new CurrentPathStack(new RequestStack());
@@ -33,7 +36,7 @@ public function testGetArgument() {
     $view->expects($this->any())
       ->method('getRequest')
       ->will($this->returnValue($request));
-    $alias_manager = $this->getMock('Drupal\Core\Path\AliasManagerInterface');
+    $alias_manager = $this->getMock(AliasManagerInterface::class);
     $alias_manager->expects($this->never())
       ->method('getAliasByPath');
 
@@ -71,7 +74,7 @@ public function testGetArgument() {
     $this->assertEquals(NULL, $raw->getArgument());
 
     // Setup an alias manager with a path alias.
-    $alias_manager = $this->getMock('Drupal\Core\Path\AliasManagerInterface');
+    $alias_manager = $this->getMock(AliasManagerInterface::class);
     $alias_manager->expects($this->any())
       ->method('getAliasByPath')
       ->with($this->equalTo('/test/example'))
diff --git a/core/modules/views/tests/src/Unit/Plugin/argument_validator/EntityTest.php b/core/modules/views/tests/src/Unit/Plugin/argument_validator/EntityTest.php
index 13a7bc9..c0dda14 100644
--- a/core/modules/views/tests/src/Unit/Plugin/argument_validator/EntityTest.php
+++ b/core/modules/views/tests/src/Unit/Plugin/argument_validator/EntityTest.php
@@ -2,8 +2,15 @@
 
 namespace Drupal\Tests\views\Unit\Plugin\argument_validator;
 
+use Drupal\Core\Entity\Entity;
+use Drupal\Core\Entity\EntityInterface;
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Entity\EntityStorageInterface;
+use Drupal\Core\Entity\EntityTypeInterface;
 use Drupal\Tests\UnitTestCase;
+use Drupal\views\ViewExecutable;
 use Drupal\views\Plugin\views\argument_validator\Entity;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
 
 /**
  * @coversDefaultClass \Drupal\views\Plugin\views\argument_validator\Entity
@@ -45,9 +52,9 @@ class EntityTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $this->entityManager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
+    $this->entityManager = $this->getMock(EntityManagerInterface::class);
 
-    $mock_entity = $this->getMockForAbstractClass('Drupal\Core\Entity\Entity', [], '', FALSE, TRUE, TRUE, ['bundle', 'access']);
+    $mock_entity = $this->getMockForAbstractClass(Entity::class, [], '', FALSE, TRUE, TRUE, ['bundle', 'access']);
     $mock_entity->expects($this->any())
       ->method('bundle')
       ->will($this->returnValue('test_bundle'));
@@ -59,7 +66,7 @@ protected function setUp() {
         ['test_op_3', NULL, FALSE, TRUE],
       ]));
 
-    $mock_entity_bundle_2 = $this->getMockForAbstractClass('Drupal\Core\Entity\Entity', [], '', FALSE, TRUE, TRUE, ['bundle', 'access']);
+    $mock_entity_bundle_2 = $this->getMockForAbstractClass(Entity::class, [], '', FALSE, TRUE, TRUE, ['bundle', 'access']);
     $mock_entity_bundle_2->expects($this->any())
       ->method('bundle')
       ->will($this->returnValue('test_bundle_2'));
@@ -72,7 +79,7 @@ protected function setUp() {
       ]));
 
 
-    $storage = $this->getMock('Drupal\Core\Entity\EntityStorageInterface');
+    $storage = $this->getMock(EntityStorageInterface::class);
 
     // Setup values for IDs passed as strings or numbers.
     $value_map = [
@@ -93,10 +100,10 @@ protected function setUp() {
       ->with('entity_test')
       ->will($this->returnValue($storage));
 
-    $this->executable = $this->getMockBuilder('Drupal\views\ViewExecutable')
+    $this->executable = $this->getMockBuilder(ViewExecutable::class)
       ->disableOriginalConstructor()
       ->getMock();
-    $this->display = $this->getMockBuilder('Drupal\views\Plugin\views\display\DisplayPluginBase')
+    $this->display = $this->getMockBuilder(DisplayPluginBase::class)
       ->disableOriginalConstructor()
       ->getMock();
 
@@ -175,10 +182,10 @@ public function testValidateArgumentBundle() {
   public function testCalculateDependencies() {
     // Create an entity manager, storage, entity type, and entity to mock the
     // loading of entities providing bundles.
-    $entityManager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
-    $storage = $this->getMock('Drupal\Core\Entity\EntityStorageInterface');
-    $entity_type = $this->getMock('Drupal\Core\Entity\EntityTypeInterface');
-    $mock_entity = $this->getMock('Drupal\Core\Entity\EntityInterface');
+    $entityManager = $this->getMock(EntityManagerInterface::class);
+    $storage = $this->getMock(EntityStorageInterface::class);
+    $entity_type = $this->getMock(EntityTypeInterface::class);
+    $mock_entity = $this->getMock(EntityInterface::class);
 
     $mock_entity->expects($this->any())
       ->method('getConfigDependencyKey')
diff --git a/core/modules/views/tests/src/Unit/Plugin/display/PathPluginBaseTest.php b/core/modules/views/tests/src/Unit/Plugin/display/PathPluginBaseTest.php
index 08ec780..4d78a48 100644
--- a/core/modules/views/tests/src/Unit/Plugin/display/PathPluginBaseTest.php
+++ b/core/modules/views/tests/src/Unit/Plugin/display/PathPluginBaseTest.php
@@ -8,7 +8,15 @@
 namespace Drupal\Tests\views\Unit\Plugin\display;
 
 use Drupal\Core\DependencyInjection\ContainerBuilder;
+use Drupal\Core\Routing\RouteProviderInterface;
+use Drupal\Core\State\StateInterface;
 use Drupal\Tests\UnitTestCase;
+use Drupal\views\ViewExecutable;
+use Drupal\views\Entity\View;
+use Drupal\views\Plugin\views\access\AccessPluginBase;
+use Drupal\views\Plugin\views\argument\ArgumentPluginBase;
+use Drupal\views\Plugin\ViewsPluginManager;
+use Drupal\views\Plugin\views\display\PathPluginBase;
 use Symfony\Component\Routing\Route;
 use Symfony\Component\Routing\RouteCollection;
 
@@ -52,9 +60,9 @@ class PathPluginBaseTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $this->routeProvider = $this->getMock('Drupal\Core\Routing\RouteProviderInterface');
-    $this->state = $this->getMock('\Drupal\Core\State\StateInterface');
-    $this->pathPlugin = $this->getMockBuilder('Drupal\views\Plugin\views\display\PathPluginBase')
+    $this->routeProvider = $this->getMock(RouteProviderInterface::class);
+    $this->state = $this->getMock(StateInterface::class);
+    $this->pathPlugin = $this->getMockBuilder(PathPluginBase::class)
       ->setConstructorArgs([[], 'path_base', [], $this->routeProvider, $this->state])
       ->setMethods(NULL)
       ->getMock();
@@ -65,7 +73,7 @@ protected function setUp() {
    * Setup access plugin manager and config factory in the Drupal class.
    */
   public function setupContainer() {
-    $this->accessPluginManager = $this->getMockBuilder('\Drupal\views\Plugin\ViewsPluginManager')
+    $this->accessPluginManager = $this->getMockBuilder(ViewsPluginManager::class)
       ->disableOriginalConstructor()
       ->getMock();
     $container = new ContainerBuilder();
@@ -125,7 +133,7 @@ public function testCollectRoutesWithDisplayReturnResponse() {
     $display['display_options'] = [
       'path' => 'test_route',
     ];
-    $this->pathPlugin = $this->getMockBuilder('Drupal\views\Plugin\views\display\PathPluginBase')
+    $this->pathPlugin = $this->getMockBuilder(PathPluginBase::class)
       ->setConstructorArgs([[], 'path_base', ['returns_response' => TRUE], $this->routeProvider, $this->state])
       ->setMethods(NULL)
       ->getMock();
@@ -385,7 +393,7 @@ public function testCollectRoutesWithNamedParameters() {
     list($view) = $this->setupViewExecutableAccessPlugin();
 
     $view->argument = [];
-    $view->argument['nid'] = $this->getMockBuilder('Drupal\views\Plugin\views\argument\ArgumentPluginBase')
+    $view->argument['nid'] = $this->getMockBuilder(ArgumentPluginBase::class)
       ->disableOriginalConstructor()
       ->getMock();
 
@@ -420,7 +428,7 @@ public function testAlterRoutesWithParameters() {
     list($view) = $this->setupViewExecutableAccessPlugin();
 
     // Manually set up an argument handler.
-    $argument = $this->getMockBuilder('Drupal\views\Plugin\views\argument\ArgumentPluginBase')
+    $argument = $this->getMockBuilder(ArgumentPluginBase::class)
       ->disableOriginalConstructor()
       ->getMock();
     $view->argument['test_id'] = $argument;
@@ -457,7 +465,7 @@ public function testAlterRoutesWithParametersAndUpcasting() {
     list($view) = $this->setupViewExecutableAccessPlugin();
 
     // Manually set up an argument handler.
-    $argument = $this->getMockBuilder('Drupal\views\Plugin\views\argument\ArgumentPluginBase')
+    $argument = $this->getMockBuilder(ArgumentPluginBase::class)
       ->disableOriginalConstructor()
       ->getMock();
     $view->argument['test_id'] = $argument;
@@ -542,14 +550,14 @@ public function testGetRouteName() {
    * Returns some mocked view entity, view executable, and access plugin.
    */
   protected function setupViewExecutableAccessPlugin() {
-    $view_entity = $this->getMockBuilder('Drupal\views\Entity\View')
+    $view_entity = $this->getMockBuilder(View::class)
       ->disableOriginalConstructor()
       ->getMock();
     $view_entity->expects($this->any())
       ->method('id')
       ->will($this->returnValue('test_id'));
 
-    $view = $this->getMockBuilder('Drupal\views\ViewExecutable')
+    $view = $this->getMockBuilder(ViewExecutable::class)
       ->disableOriginalConstructor()
       ->getMock();
     $view->expects($this->any())
@@ -561,7 +569,7 @@ protected function setupViewExecutableAccessPlugin() {
     // Skip views options caching.
     $view->editing = TRUE;
 
-    $access_plugin = $this->getMockBuilder('Drupal\views\Plugin\views\access\AccessPluginBase')
+    $access_plugin = $this->getMockBuilder(AccessPluginBase::class)
       ->disableOriginalConstructor()
       ->getMockForAbstractClass();
     $this->accessPluginManager->expects($this->any())
diff --git a/core/modules/views/tests/src/Unit/Plugin/field/CounterTest.php b/core/modules/views/tests/src/Unit/Plugin/field/CounterTest.php
index 4d67c00..6952470 100644
--- a/core/modules/views/tests/src/Unit/Plugin/field/CounterTest.php
+++ b/core/modules/views/tests/src/Unit/Plugin/field/CounterTest.php
@@ -2,10 +2,16 @@
 
 namespace Drupal\Tests\views\Unit\Plugin\field;
 
+use Drupal\Core\Routing\RouteProviderInterface;
+use Drupal\Core\Session\AccountInterface;
 use Drupal\Tests\UnitTestCase;
 use Drupal\views\Entity\View;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
 use Drupal\views\Plugin\views\field\Counter;
+use Drupal\views\Plugin\views\pager\Full;
 use Drupal\views\ResultRow;
+use Drupal\views\ViewExecutable;
+use Drupal\views\ViewsData;
 use Drupal\views\Tests\ViewTestData;
 
 /**
@@ -65,18 +71,18 @@ protected function setUp() {
     ];
 
     $storage = new View($config, 'view');
-    $user = $this->getMock('Drupal\Core\Session\AccountInterface');
-    $views_data = $this->getMockBuilder('Drupal\views\ViewsData')
+    $user = $this->getMock(AccountInterface::class);
+    $views_data = $this->getMockBuilder(ViewsData::class)
       ->disableOriginalConstructor()
       ->getMock();
-    $route_provider = $this->getMock('Drupal\Core\Routing\RouteProviderInterface');
-    $this->view = $this->getMock('Drupal\views\ViewExecutable', NULL, [$storage, $user, $views_data, $route_provider]);
+    $route_provider = $this->getMock(RouteProviderInterface::class);
+    $this->view = $this->getMock(ViewExecutable::class, NULL, [$storage, $user, $views_data, $route_provider]);
 
-    $this->display = $this->getMockBuilder('Drupal\views\Plugin\views\display\DisplayPluginBase')
+    $this->display = $this->getMockBuilder(DisplayPluginBase::class)
       ->disableOriginalConstructor()
       ->getMock();
 
-    $this->pager = $this->getMockBuilder('Drupal\views\Plugin\views\pager\Full')
+    $this->pager = $this->getMockBuilder(Full::class)
       ->disableOriginalConstructor()
       ->setMethods(NULL)
       ->getMock();
diff --git a/core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php b/core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php
index 0b33a58..db3f44e 100644
--- a/core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php
+++ b/core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php
@@ -7,16 +7,28 @@
 
 namespace Drupal\Tests\views\Unit\Plugin\field;
 
+use Drupal\Core\Entity\EntityInterface;
+use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\GeneratedUrl;
 use Drupal\Core\Language\Language;
+use Drupal\Core\Path\PathValidatorInterface;
+use Drupal\Core\PathProcessor\OutboundPathProcessorInterface;
 use Drupal\Core\Render\Markup;
+use Drupal\Core\Render\RendererInterface;
+use Drupal\Core\Routing\RouteProviderInterface;
+use Drupal\Core\Routing\UrlGeneratorInterface;
 use Drupal\Core\Url;
 use Drupal\Core\Utility\LinkGenerator;
 use Drupal\Core\Utility\LinkGeneratorInterface;
 use Drupal\Core\Utility\UnroutedUrlAssembler;
+use Drupal\Core\Utility\UnroutedUrlAssemblerInterface;
 use Drupal\Tests\UnitTestCase;
+use Drupal\Tests\views\Unit\Plugin\field\FieldPluginBaseTestField;
+use Drupal\views\Plugin\views\argument\ArgumentPluginBase;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
 use Drupal\views\Plugin\views\field\FieldPluginBase;
 use Drupal\views\ResultRow;
+use Drupal\views\ViewExecutable;
 use Symfony\Component\DependencyInjection\ContainerBuilder;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpFoundation\RequestStack;
@@ -133,29 +145,29 @@ class FieldPluginBaseTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $this->executable = $this->getMockBuilder('Drupal\views\ViewExecutable')
+    $this->executable = $this->getMockBuilder(ViewExecutable::class)
       ->disableOriginalConstructor()
       ->getMock();
-    $this->display = $this->getMockBuilder('Drupal\views\Plugin\views\display\DisplayPluginBase')
+    $this->display = $this->getMockBuilder(DisplayPluginBase::class)
       ->disableOriginalConstructor()
       ->getMock();
 
-    $route_provider = $this->getMock('Drupal\Core\Routing\RouteProviderInterface');
+    $route_provider = $this->getMock(RouteProviderInterface::class);
     $route_provider->expects($this->any())
       ->method('getRouteByName')
       ->with('test_route')
       ->willReturn(new Route('/test-path'));
 
-    $this->urlGenerator = $this->getMock('Drupal\Core\Routing\UrlGeneratorInterface');
-    $this->pathValidator = $this->getMock('Drupal\Core\Path\PathValidatorInterface');
+    $this->urlGenerator = $this->getMock(UrlGeneratorInterface::class);
+    $this->pathValidator = $this->getMock(PathValidatorInterface::class);
 
     $this->requestStack = new RequestStack();
     $this->requestStack->push(new Request());
 
-    $this->unroutedUrlAssembler = $this->getMock('Drupal\Core\Utility\UnroutedUrlAssemblerInterface');
-    $this->linkGenerator = $this->getMock('Drupal\Core\Utility\LinkGeneratorInterface');
+    $this->unroutedUrlAssembler = $this->getMock(UnroutedUrlAssemblerInterface::class);
+    $this->linkGenerator = $this->getMock(LinkGeneratorInterface::class);
 
-    $this->renderer = $this->getMock('Drupal\Core\Render\RendererInterface');
+    $this->renderer = $this->getMock(RendererInterface::class);
 
     $container_builder = new ContainerBuilder();
     $container_builder->set('url_generator', $this->urlGenerator);
@@ -170,12 +182,12 @@ protected function setUp() {
    * Sets up the unrouted url assembler and the link generator.
    */
   protected function setUpUrlIntegrationServices() {
-    $this->pathProcessor = $this->getMock('Drupal\Core\PathProcessor\OutboundPathProcessorInterface');
+    $this->pathProcessor = $this->getMock(OutboundPathProcessorInterface::class);
     $this->unroutedUrlAssembler = new UnroutedUrlAssembler($this->requestStack, $this->pathProcessor);
 
     \Drupal::getContainer()->set('unrouted_url_assembler', $this->unroutedUrlAssembler);
 
-    $this->linkGenerator = new LinkGenerator($this->urlGenerator, $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface'), $this->renderer);
+    $this->linkGenerator = new LinkGenerator($this->urlGenerator, $this->getMock(ModuleHandlerInterface::class), $this->renderer);
     $this->renderer
       ->method('render')
       ->willReturnCallback(
@@ -365,7 +377,7 @@ public function providerTestRenderAsLinkWithPathAndOptions() {
     // executed for paths which aren't routed.
 
     // Entity flag.
-    $entity = $this->getMock('Drupal\Core\Entity\EntityInterface');
+    $entity = $this->getMock(EntityInterface::class);
     $data[] = ['test-path', ['entity' => $entity], '<a href="/test-path">value</a>'];
     // entity_type flag.
     $entity_type_id = 'node';
@@ -499,7 +511,7 @@ public function providerTestRenderAsLinkWithUrlAndOptions() {
     $data[] = [$url, ['language' => $language], $url_with_language, '/fr/test-path', clone $url_with_language, '<a href="/fr/test-path" hreflang="fr">value</a>'];
 
     // Entity flag.
-    $entity = $this->getMock('Drupal\Core\Entity\EntityInterface');
+    $entity = $this->getMock(EntityInterface::class);
     $url = Url::fromRoute('test_route');
     $url_with_entity = Url::fromRoute('test_route');
     $options = ['entity' => $entity] + $this->defaultUrlOptions;
@@ -649,7 +661,7 @@ public function providerTestRenderAsExternalLinkWithPathAndTokens() {
    */
   protected function setupTestField(array $options = []) {
     /** @var \Drupal\Tests\views\Unit\Plugin\field\FieldPluginBaseTestField $field */
-    $field = $this->getMock('Drupal\Tests\views\Unit\Plugin\field\FieldPluginBaseTestField', ['l'], [$this->configuration, $this->pluginId, $this->pluginDefinition]);
+    $field = $this->getMock(FieldPluginBaseTestField::class, ['l'], [$this->configuration, $this->pluginId, $this->pluginDefinition]);
     $field->init($this->executable, $this->display, $options);
     $field->setLinkGenerator($this->linkGenerator);
 
@@ -697,7 +709,7 @@ public function testGetRenderTokensWithArguments() {
     $field->view->args = ['argument value'];
     $field->view->build_info['substitutions']['{{ arguments.name }}'] = 'argument value';
 
-    $argument = $this->getMockBuilder('\Drupal\views\Plugin\views\argument\ArgumentPluginBase')
+    $argument = $this->getMockBuilder(ArgumentPluginBase::class)
       ->disableOriginalConstructor()
       ->getMock();
 
diff --git a/core/modules/views/tests/src/Unit/Plugin/field/FieldTest.php b/core/modules/views/tests/src/Unit/Plugin/field/FieldTest.php
index 2b929f3..c58cf8f 100644
--- a/core/modules/views/tests/src/Unit/Plugin/field/FieldTest.php
+++ b/core/modules/views/tests/src/Unit/Plugin/field/FieldTest.php
@@ -7,11 +7,25 @@
 
 namespace Drupal\Tests\views\Unit\Plugin\field;
 
+use Drupal\Core\Entity\EntityAccessControlHandlerInterface;
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Entity\EntityTypeInterface;
+use Drupal\Core\Entity\Sql\SqlEntityStorageInterface;
+use Drupal\Core\Entity\Sql\TableMappingInterface;
 use Drupal\Core\Field\FieldStorageDefinitionInterface;
+use Drupal\Core\Field\FieldTypePluginManagerInterface;
+use Drupal\Core\Field\FormatterPluginManager;
+use Drupal\Core\Language\LanguageManagerInterface;
+use Drupal\Core\Render\RendererInterface;
+use Drupal\Core\Session\AccountInterface;
+use Drupal\field\FieldStorageConfigInterface;
 use Drupal\Tests\UnitTestCase;
 use Drupal\Tests\views\Unit\Plugin\HandlerTestTrait;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
 use Drupal\views\Plugin\views\field\EntityField;
+use Drupal\views\Plugin\views\query\Sql;
 use Drupal\views\ResultRow;
+use Drupal\views\ViewsData;
 use Symfony\Component\DependencyInjection\ContainerBuilder;
 
 /**
@@ -70,12 +84,12 @@ class FieldTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $this->entityManager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
-    $this->formatterPluginManager = $this->getMockBuilder('Drupal\Core\Field\FormatterPluginManager')
+    $this->entityManager = $this->getMock(EntityManagerInterface::class);
+    $this->formatterPluginManager = $this->getMockBuilder(FormatterPluginManager::class)
       ->disableOriginalConstructor()
       ->getMock();
 
-    $this->fieldTypePluginManager = $this->getMock('Drupal\Core\Field\FieldTypePluginManagerInterface');
+    $this->fieldTypePluginManager = $this->getMock(FieldTypePluginManagerInterface::class);
     $this->fieldTypePluginManager->expects($this->any())
       ->method('getDefaultStorageSettings')
       ->willReturn([]);
@@ -83,12 +97,12 @@ protected function setUp() {
       ->method('getDefaultFieldSettings')
       ->willReturn([]);
 
-    $this->languageManager = $this->getMock('Drupal\Core\Language\LanguageManagerInterface');
-    $this->renderer = $this->getMock('Drupal\Core\Render\RendererInterface');
+    $this->languageManager = $this->getMock(LanguageManagerInterface::class);
+    $this->renderer = $this->getMock(RendererInterface::class);
 
     $this->setupExecutableAndView();
     $this->setupViewsData();
-    $this->display = $this->getMockBuilder('Drupal\views\Plugin\views\display\DisplayPluginBase')
+    $this->display = $this->getMockBuilder(DisplayPluginBase::class)
       ->disableOriginalConstructor()
       ->getMock();
 
@@ -266,7 +280,7 @@ public function testAccess() {
         'table' => ['entity type' => 'test_entity']
       ]);
 
-    $access_control_handler = $this->getMock('Drupal\Core\Entity\EntityAccessControlHandlerInterface');
+    $access_control_handler = $this->getMock(EntityAccessControlHandlerInterface::class);
     $this->entityManager->expects($this->atLeastOnce())
       ->method('getAccessControlHandler')
       ->with('test_entity')
@@ -280,7 +294,7 @@ public function testAccess() {
         'title' => $title_storage,
       ]);
 
-    $account = $this->getMock('Drupal\Core\Session\AccountInterface');
+    $account = $this->getMock(AccountInterface::class);
 
     $access_control_handler->expects($this->atLeastOnce())
       ->method('fieldAccess')
@@ -334,13 +348,13 @@ public function testClickSortWithBaseField($order) {
         'title' => $field_storage,
       ]);
 
-    $table_mapping = $this->getMock('Drupal\Core\Entity\Sql\TableMappingInterface');
+    $table_mapping = $this->getMock(TableMappingInterface::class);
     $table_mapping
       ->expects($this->atLeastOnce())
       ->method('getFieldColumnName')
       ->with($field_storage, 'value')
       ->willReturn('title');
-    $entity_storage = $this->getMock('Drupal\Core\Entity\Sql\SqlEntityStorageInterface');
+    $entity_storage = $this->getMock(SqlEntityStorageInterface::class);
     $entity_storage->expects($this->atLeastOnce())
       ->method('getTableMapping')
       ->willReturn($table_mapping);
@@ -356,7 +370,7 @@ public function testClickSortWithBaseField($order) {
     ];
     $handler->init($this->executable, $this->display, $options);
 
-    $handler->query = $this->getMockBuilder('Drupal\views\Plugin\views\query\Sql')
+    $handler->query = $this->getMockBuilder(Sql::class)
       ->disableOriginalConstructor()
       ->getMock();
     $handler->query->expects($this->atLeastOnce())
@@ -394,13 +408,13 @@ public function testClickSortWithConfiguredField($order) {
         'body' => $field_storage,
       ]);
 
-    $table_mapping = $this->getMock('Drupal\Core\Entity\Sql\TableMappingInterface');
+    $table_mapping = $this->getMock(TableMappingInterface::class);
     $table_mapping
       ->expects($this->atLeastOnce())
       ->method('getFieldColumnName')
       ->with($field_storage, 'value')
       ->willReturn('body_value');
-    $entity_storage = $this->getMock('Drupal\Core\Entity\Sql\SqlEntityStorageInterface');
+    $entity_storage = $this->getMock(SqlEntityStorageInterface::class);
     $entity_storage->expects($this->atLeastOnce())
       ->method('getTableMapping')
       ->willReturn($table_mapping);
@@ -416,7 +430,7 @@ public function testClickSortWithConfiguredField($order) {
     ];
     $handler->init($this->executable, $this->display, $options);
 
-    $handler->query = $this->getMockBuilder('Drupal\views\Plugin\views\query\Sql')
+    $handler->query = $this->getMockBuilder(Sql::class)
       ->disableOriginalConstructor()
       ->getMock();
     $handler->query->expects($this->atLeastOnce())
@@ -452,13 +466,13 @@ public function testQueryWithGroupByForBaseField() {
         'title' => $field_storage,
       ]);
 
-    $table_mapping = $this->getMock('Drupal\Core\Entity\Sql\TableMappingInterface');
+    $table_mapping = $this->getMock(TableMappingInterface::class);
     $table_mapping
       ->expects($this->any())
       ->method('getFieldColumnName')
       ->with($field_storage, 'value')
       ->willReturn('title');
-    $entity_storage = $this->getMock('Drupal\Core\Entity\Sql\SqlEntityStorageInterface');
+    $entity_storage = $this->getMock(SqlEntityStorageInterface::class);
     $entity_storage->expects($this->any())
       ->method('getTableMapping')
       ->willReturn($table_mapping);
@@ -474,7 +488,7 @@ public function testQueryWithGroupByForBaseField() {
     ];
     $handler->init($this->executable, $this->display, $options);
 
-    $query = $this->getMockBuilder('Drupal\views\Plugin\views\query\Sql')
+    $query = $this->getMockBuilder(Sql::class)
       ->disableOriginalConstructor()
       ->getMock();
     $query->expects($this->once())
@@ -514,13 +528,13 @@ public function testQueryWithGroupByForConfigField() {
         'body' => $field_storage,
       ]);
 
-    $table_mapping = $this->getMock('Drupal\Core\Entity\Sql\TableMappingInterface');
+    $table_mapping = $this->getMock(TableMappingInterface::class);
     $table_mapping
       ->expects($this->any())
       ->method('getFieldColumnName')
       ->with($field_storage, 'value')
       ->willReturn('body_value');
-    $entity_storage = $this->getMock('Drupal\Core\Entity\Sql\SqlEntityStorageInterface');
+    $entity_storage = $this->getMock(SqlEntityStorageInterface::class);
     $entity_storage->expects($this->any())
       ->method('getTableMapping')
       ->willReturn($table_mapping);
@@ -536,7 +550,7 @@ public function testQueryWithGroupByForConfigField() {
     ];
     $handler->init($this->executable, $this->display, $options);
 
-    $query = $this->getMockBuilder('Drupal\views\Plugin\views\query\Sql')
+    $query = $this->getMockBuilder(Sql::class)
       ->disableOriginalConstructor()
       ->getMock();
     $query->expects($this->once())
@@ -582,13 +596,13 @@ public function testPrepareItemsByDelta(array $options, array $expected_values)
         'integer' => $field_storage,
       ]);
 
-    $table_mapping = $this->getMock('Drupal\Core\Entity\Sql\TableMappingInterface');
+    $table_mapping = $this->getMock(TableMappingInterface::class);
     $table_mapping
       ->expects($this->any())
       ->method('getFieldColumnName')
       ->with($field_storage, 'value')
       ->willReturn('integer_value');
-    $entity_storage = $this->getMock('Drupal\Core\Entity\Sql\SqlEntityStorageInterface');
+    $entity_storage = $this->getMock(SqlEntityStorageInterface::class);
     $entity_storage->expects($this->any())
       ->method('getTableMapping')
       ->willReturn($table_mapping);
@@ -639,7 +653,7 @@ public function providerTestPrepareItemsByDelta() {
    * @return \Drupal\Core\Field\FieldStorageDefinitionInterface|\PHPUnit_Framework_MockObject_MockObject
    */
   protected function getBaseFieldStorage() {
-    $title_storage = $this->getMock('Drupal\Core\Field\FieldStorageDefinitionInterface');
+    $title_storage = $this->getMock(FieldStorageDefinitionInterface::class);
     $title_storage->expects($this->any())
       ->method('getColumns')
       ->willReturn(['value' => ['type' => 'varchar']]);
@@ -658,7 +672,7 @@ protected function getBaseFieldStorage() {
    * @return \Drupal\field\FieldStorageConfigInterface|\PHPUnit_Framework_MockObject_MockObject
    */
   protected function getConfigFieldStorage() {
-    $title_storage = $this->getMock('Drupal\field\FieldStorageConfigInterface');
+    $title_storage = $this->getMock(FieldStorageConfigInterface::class);
     $title_storage->expects($this->any())
       ->method('getColumns')
       ->willReturn(['value' => ['type' => 'varchar']]);
@@ -694,7 +708,7 @@ public function providerSortOrders() {
    *   An array with entity type definition data.
    */
   protected function setupLanguageRenderer(EntityField $handler, $definition) {
-    $display_handler = $this->getMockBuilder('\Drupal\views\Plugin\views\display\DisplayPluginBase')
+    $display_handler = $this->getMockBuilder(DisplayPluginBase::class)
       ->disableOriginalConstructor()
       ->getMock();
     $display_handler->expects($this->any())
@@ -704,7 +718,7 @@ protected function setupLanguageRenderer(EntityField $handler, $definition) {
     $handler->view->display_handler = $display_handler;
 
     $data['table']['entity type'] = $definition['entity_type'];
-    $views_data = $this->getMockBuilder('\Drupal\views\ViewsData')
+    $views_data = $this->getMockBuilder(ViewsData::class)
       ->disableOriginalConstructor()
       ->getMock();
     $views_data->expects($this->any())
@@ -712,7 +726,7 @@ protected function setupLanguageRenderer(EntityField $handler, $definition) {
       ->willReturn($data);
     $this->container->set('views.views_data', $views_data);
 
-    $entity_type = $this->getMock('\Drupal\Core\Entity\EntityTypeInterface');
+    $entity_type = $this->getMock(EntityTypeInterface::class);
     $entity_type->expects($this->any())
       ->method('id')
       ->willReturn($definition['entity_type']);
diff --git a/core/modules/views/tests/src/Unit/Plugin/pager/PagerPluginBaseTest.php b/core/modules/views/tests/src/Unit/Plugin/pager/PagerPluginBaseTest.php
index 555c8a4..7152ea0 100644
--- a/core/modules/views/tests/src/Unit/Plugin/pager/PagerPluginBaseTest.php
+++ b/core/modules/views/tests/src/Unit/Plugin/pager/PagerPluginBaseTest.php
@@ -7,8 +7,13 @@
 
 namespace Drupal\Tests\views\Unit\Plugin\pager;
 
+use Drupal\Core\Database\Query\Select;
 use Drupal\Tests\UnitTestCase;
+use Drupal\Tests\views\Unit\Plugin\pager\TestStatementInterface;
 use Drupal\Core\Database\StatementInterface;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
+use Drupal\views\ViewExecutable;
+use Drupal\views\Plugin\views\pager\PagerPluginBase;
 
 /**
  * @coversDefaultClass \Drupal\views\Plugin\views\pager\PagerPluginBase
@@ -24,14 +29,14 @@ class PagerPluginBaseTest extends UnitTestCase {
   protected $pager;
 
   protected function setUp() {
-    $this->pager = $this->getMockBuilder('Drupal\views\Plugin\views\pager\PagerPluginBase')
+    $this->pager = $this->getMockBuilder(PagerPluginBase::class)
       ->disableOriginalConstructor()
       ->getMockForAbstractClass();
 
-    $view = $this->getMockBuilder('Drupal\views\ViewExecutable')
+    $view = $this->getMockBuilder(ViewExecutable::class)
       ->disableOriginalConstructor()
       ->getMock();
-    $display = $this->getMockBuilder('Drupal\views\Plugin\views\display\DisplayPluginBase')
+    $display = $this->getMockBuilder(DisplayPluginBase::class)
       ->disableOriginalConstructor()
       ->getMock();
 
@@ -205,13 +210,13 @@ public function providerTestHasMoreRecords() {
    * @see \Drupal\views\Plugin\views\pager\PagerPluginBase::executeCountQuery()
    */
   public function testExecuteCountQueryWithoutOffset() {
-    $statement = $this->getMock('\Drupal\Tests\views\Unit\Plugin\pager\TestStatementInterface');
+    $statement = $this->getMock(TestStatementInterface::class);
 
     $statement->expects($this->once())
       ->method('fetchField')
       ->will($this->returnValue(3));
 
-    $query = $this->getMockBuilder('\Drupal\Core\Database\Query\Select')
+    $query = $this->getMockBuilder(Select::class)
       ->disableOriginalConstructor()
       ->getMock();
 
@@ -229,13 +234,13 @@ public function testExecuteCountQueryWithoutOffset() {
    * @see \Drupal\views\Plugin\views\pager\PagerPluginBase::executeCountQuery()
    */
   public function testExecuteCountQueryWithOffset() {
-    $statement = $this->getMock('\Drupal\Tests\views\Unit\Plugin\pager\TestStatementInterface');
+    $statement = $this->getMock(TestStatementInterface::class);
 
     $statement->expects($this->once())
       ->method('fetchField')
       ->will($this->returnValue(3));
 
-    $query = $this->getMockBuilder('\Drupal\Core\Database\Query\Select')
+    $query = $this->getMockBuilder(Select::class)
       ->disableOriginalConstructor()
       ->getMock();
 
diff --git a/core/modules/views/tests/src/Unit/Plugin/query/SqlTest.php b/core/modules/views/tests/src/Unit/Plugin/query/SqlTest.php
index 02a5ce6..d701828 100644
--- a/core/modules/views/tests/src/Unit/Plugin/query/SqlTest.php
+++ b/core/modules/views/tests/src/Unit/Plugin/query/SqlTest.php
@@ -27,7 +27,7 @@ class SqlTest extends UnitTestCase {
    * @covers ::getAllEntities
    */
   public function testGetCacheTags() {
-    $view = $this->prophesize('Drupal\views\ViewExecutable')->reveal();
+    $view = $this->prophesize(ViewExecutable::class)->reveal();
     $entity_type_manager = $this->prophesize(EntityTypeManagerInterface::class);
 
     $query = new Sql([], 'sql', [], $entity_type_manager->reveal());
@@ -38,7 +38,7 @@ public function testGetCacheTags() {
 
     // Add a row with an entity.
     $row = new ResultRow();
-    $prophecy = $this->prophesize('Drupal\Core\Entity\EntityInterface');
+    $prophecy = $this->prophesize(EntityInterface::class);
     $prophecy->getCacheTags()->willReturn(['entity_test:123']);
     $entity = $prophecy->reveal();
     $row->_entity = $entity;
@@ -48,16 +48,16 @@ public function testGetCacheTags() {
 
     // Add a row with an entity and a relationship entity.
     $row = new ResultRow();
-    $prophecy = $this->prophesize('Drupal\Core\Entity\EntityInterface');
+    $prophecy = $this->prophesize(EntityInterface::class);
     $prophecy->getCacheTags()->willReturn(['entity_test:124']);
     $entity = $prophecy->reveal();
     $row->_entity = $entity;
 
-    $prophecy = $this->prophesize('Drupal\Core\Entity\EntityInterface');
+    $prophecy = $this->prophesize(EntityInterface::class);
     $prophecy->getCacheTags()->willReturn(['entity_test:125']);
     $entity = $prophecy->reveal();
     $row->_relationship_entities[] = $entity;
-    $prophecy = $this->prophesize('Drupal\Core\Entity\EntityInterface');
+    $prophecy = $this->prophesize(EntityInterface::class);
     $prophecy->getCacheTags()->willReturn(['entity_test:126']);
     $entity = $prophecy->reveal();
     $row->_relationship_entities[] = $entity;
@@ -73,7 +73,7 @@ public function testGetCacheTags() {
    * @covers ::getAllEntities
    */
   public function testGetCacheMaxAge() {
-    $view = $this->prophesize('Drupal\views\ViewExecutable')->reveal();
+    $view = $this->prophesize(ViewExecutable::class)->reveal();
     $entity_type_manager = $this->prophesize(EntityTypeManagerInterface::class);
 
     $query = new Sql([], 'sql', [], $entity_type_manager->reveal());
@@ -83,7 +83,7 @@ public function testGetCacheMaxAge() {
 
     // Add a row with an entity.
     $row = new ResultRow();
-    $prophecy = $this->prophesize('Drupal\Core\Entity\EntityInterface');
+    $prophecy = $this->prophesize(EntityInterface::class);
     $prophecy->getCacheMaxAge()->willReturn(10);
     $entity = $prophecy->reveal();
 
@@ -92,16 +92,16 @@ public function testGetCacheMaxAge() {
 
     // Add a row with an entity and a relationship entity.
     $row = new ResultRow();
-    $prophecy = $this->prophesize('Drupal\Core\Entity\EntityInterface');
+    $prophecy = $this->prophesize(EntityInterface::class);
     $prophecy->getCacheMaxAge()->willReturn(20);
     $entity = $prophecy->reveal();
     $row->_entity = $entity;
 
-    $prophecy = $this->prophesize('Drupal\Core\Entity\EntityInterface');
+    $prophecy = $this->prophesize(EntityInterface::class);
     $prophecy->getCacheMaxAge()->willReturn(30);
     $entity = $prophecy->reveal();
     $row->_relationship_entities[] = $entity;
-    $prophecy = $this->prophesize('Drupal\Core\Entity\EntityInterface');
+    $prophecy = $this->prophesize(EntityInterface::class);
     $prophecy->getCacheMaxAge()->willReturn(40);
     $entity = $prophecy->reveal();
     $row->_relationship_entities[] = $entity;
@@ -242,7 +242,7 @@ protected function setupEntityTypes($entities_by_type = [], $entity_revisions_by
    * @covers ::assignEntitiesToResult
    */
   public function testLoadEntitiesWithEmptyResult() {
-    $view = $this->prophesize('Drupal\views\ViewExecutable')->reveal();
+    $view = $this->prophesize(ViewExecutable::class)->reveal();
     $view_entity = $this->prophesize(ViewEntityInterface::class);
     $view_entity->get('base_table')->willReturn('entity_first');
     $view_entity->get('base_field')->willReturn('id');
@@ -264,7 +264,7 @@ public function testLoadEntitiesWithEmptyResult() {
    * @covers ::assignEntitiesToResult
    */
   public function testLoadEntitiesWithNoRelationshipAndNoRevision() {
-    $view = $this->prophesize('Drupal\views\ViewExecutable')->reveal();
+    $view = $this->prophesize(ViewExecutable::class)->reveal();
     $view_entity = $this->prophesize(ViewEntityInterface::class);
     $view_entity->get('base_table')->willReturn('entity_first');
     $view_entity->get('base_field')->willReturn('id');
diff --git a/core/modules/views/tests/src/Unit/Plugin/views/display/BlockTest.php b/core/modules/views/tests/src/Unit/Plugin/views/display/BlockTest.php
index 21af7bf..940fb4f 100644
--- a/core/modules/views/tests/src/Unit/Plugin/views/display/BlockTest.php
+++ b/core/modules/views/tests/src/Unit/Plugin/views/display/BlockTest.php
@@ -3,6 +3,9 @@
 namespace Drupal\Tests\views\Unit\Plugin\views\display;
 
 use Drupal\Tests\UnitTestCase;
+use Drupal\views\Plugin\Block\ViewsBlock;
+use Drupal\views\Plugin\views\display\Block;
+use Drupal\views\ViewExecutable;
 
 /**
  * @coversDefaultClass \Drupal\views\Plugin\views\display\Block
@@ -37,7 +40,7 @@ class BlockTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $this->executable = $this->getMockBuilder('Drupal\views\ViewExecutable')
+    $this->executable = $this->getMockBuilder(ViewExecutable::class)
       ->disableOriginalConstructor()
       ->setMethods(['executeDisplay', 'setDisplay', 'setItemsPerPage'])
       ->getMock();
@@ -46,14 +49,14 @@ protected function setUp() {
       ->with('block_1')
       ->will($this->returnValue(TRUE));
 
-    $this->blockDisplay = $this->executable->display_handler = $this->getMockBuilder('Drupal\views\Plugin\views\display\Block')
+    $this->blockDisplay = $this->executable->display_handler = $this->getMockBuilder(Block::class)
       ->disableOriginalConstructor()
       ->setMethods(NULL)
       ->getMock();
 
     $this->blockDisplay->view = $this->executable;
 
-    $this->blockPlugin = $this->getMockBuilder('Drupal\views\Plugin\Block\ViewsBlock')
+    $this->blockPlugin = $this->getMockBuilder(ViewsBlock::class)
       ->disableOriginalConstructor()
       ->getMock();
   }
diff --git a/core/modules/views/tests/src/Unit/Plugin/views/field/EntityOperationsUnitTest.php b/core/modules/views/tests/src/Unit/Plugin/views/field/EntityOperationsUnitTest.php
index 0900df6..7f91d02 100644
--- a/core/modules/views/tests/src/Unit/Plugin/views/field/EntityOperationsUnitTest.php
+++ b/core/modules/views/tests/src/Unit/Plugin/views/field/EntityOperationsUnitTest.php
@@ -2,9 +2,16 @@
 
 namespace Drupal\Tests\views\Unit\Plugin\views\field;
 
+use Drupal\Core\Entity\EntityListBuilderInterface;
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Language\LanguageManagerInterface;
+use Drupal\Core\Routing\RedirectDestinationInterface;
 use Drupal\Tests\UnitTestCase;
+use Drupal\user\Entity\Role;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
 use Drupal\views\Plugin\views\field\EntityOperations;
 use Drupal\views\ResultRow;
+use Drupal\views\ViewExecutable;
 
 /**
  * @coversDefaultClass \Drupal\views\Plugin\views\field\EntityOperations
@@ -39,8 +46,8 @@ class EntityOperationsUnitTest extends UnitTestCase {
    * @covers ::__construct
    */
   protected function setUp() {
-    $this->entityManager = $this->getMock('\Drupal\Core\Entity\EntityManagerInterface');
-    $this->languageManager = $this->getMock('\Drupal\Core\Language\LanguageManagerInterface');
+    $this->entityManager = $this->getMock(EntityManagerInterface::class);
+    $this->languageManager = $this->getMock(LanguageManagerInterface::class);
 
     $configuration = [];
     $plugin_id = $this->randomMachineName();
@@ -49,16 +56,16 @@ protected function setUp() {
     ];
     $this->plugin = new EntityOperations($configuration, $plugin_id, $plugin_definition, $this->entityManager, $this->languageManager);
 
-    $redirect_service = $this->getMock('Drupal\Core\Routing\RedirectDestinationInterface');
+    $redirect_service = $this->getMock(RedirectDestinationInterface::class);
     $redirect_service->expects($this->any())
       ->method('getAsArray')
       ->willReturn(['destination' => 'foobar']);
     $this->plugin->setRedirectDestination($redirect_service);
 
-    $view = $this->getMockBuilder('\Drupal\views\ViewExecutable')
+    $view = $this->getMockBuilder(ViewExecutable::class)
       ->disableOriginalConstructor()
       ->getMock();
-    $display = $this->getMockBuilder('\Drupal\views\Plugin\views\display\DisplayPluginBase')
+    $display = $this->getMockBuilder(DisplayPluginBase::class)
       ->disableOriginalConstructor()
       ->getMockForAbstractClass();
     $view->display_handler = $display;
@@ -86,7 +93,7 @@ public function testDefineOptions() {
    */
   public function testRenderWithDestination() {
     $entity_type_id = $this->randomMachineName();
-    $entity = $this->getMockBuilder('\Drupal\user\Entity\Role')
+    $entity = $this->getMockBuilder(Role::class)
       ->disableOriginalConstructor()
       ->getMock();
     $entity->expects($this->any())
@@ -98,7 +105,7 @@ public function testRenderWithDestination() {
         'title' => $this->randomMachineName(),
       ],
     ];
-    $list_builder = $this->getMock('\Drupal\Core\Entity\EntityListBuilderInterface');
+    $list_builder = $this->getMock(EntityListBuilderInterface::class);
     $list_builder->expects($this->once())
       ->method('getOperations')
       ->with($entity)
@@ -128,7 +135,7 @@ public function testRenderWithDestination() {
    */
   public function testRenderWithoutDestination() {
     $entity_type_id = $this->randomMachineName();
-    $entity = $this->getMockBuilder('\Drupal\user\Entity\Role')
+    $entity = $this->getMockBuilder(Role::class)
       ->disableOriginalConstructor()
       ->getMock();
     $entity->expects($this->any())
@@ -140,7 +147,7 @@ public function testRenderWithoutDestination() {
         'title' => $this->randomMachineName(),
       ],
     ];
-    $list_builder = $this->getMock('\Drupal\Core\Entity\EntityListBuilderInterface');
+    $list_builder = $this->getMock(EntityListBuilderInterface::class);
     $list_builder->expects($this->once())
       ->method('getOperations')
       ->with($entity)
diff --git a/core/modules/views/tests/src/Unit/Routing/ViewPageControllerTest.php b/core/modules/views/tests/src/Unit/Routing/ViewPageControllerTest.php
index 9242545..8a0602a 100644
--- a/core/modules/views/tests/src/Unit/Routing/ViewPageControllerTest.php
+++ b/core/modules/views/tests/src/Unit/Routing/ViewPageControllerTest.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\Tests\views\Unit\Routing;
 
+use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Routing\RouteMatch;
 use Drupal\Tests\UnitTestCase;
 use Drupal\views\Routing\ViewPageController;
@@ -147,7 +148,7 @@ public function testHandleWithArgumentsOnOverriddenRouteWithUpcasting() {
     $request->attributes->set('view_id', 'test_page_view');
     $request->attributes->set('display_id', 'page_1');
     // Add the argument to the request.
-    $request->attributes->set('test_entity', $this->getMock('Drupal\Core\Entity\EntityInterface'));
+    $request->attributes->set('test_entity', $this->getMock(EntityInterface::class));
     $raw_variables = new ParameterBag(['test_entity' => 'example_id']);
     $request->attributes->set('_raw_variables', $raw_variables);
     $options = [
diff --git a/core/modules/views/tests/src/Unit/ViewExecutableFactoryTest.php b/core/modules/views/tests/src/Unit/ViewExecutableFactoryTest.php
index e7f52e7..ec0746d 100644
--- a/core/modules/views/tests/src/Unit/ViewExecutableFactoryTest.php
+++ b/core/modules/views/tests/src/Unit/ViewExecutableFactoryTest.php
@@ -2,8 +2,12 @@
 
 namespace Drupal\Tests\views\Unit;
 
+use Drupal\Core\Routing\RouteProviderInterface;
+use Drupal\Core\Session\AccountInterface;
 use Drupal\Tests\UnitTestCase;
+use Drupal\views\ViewEntityInterface;
 use Drupal\views\ViewExecutableFactory;
+use Drupal\views\ViewsData;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpFoundation\RequestStack;
 
@@ -61,13 +65,13 @@ class ViewExecutableFactoryTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $this->user = $this->getMock('Drupal\Core\Session\AccountInterface');
+    $this->user = $this->getMock(AccountInterface::class);
     $this->requestStack = new RequestStack();
-    $this->view = $this->getMock('Drupal\views\ViewEntityInterface');
-    $this->viewsData = $this->getMockBuilder('Drupal\views\ViewsData')
+    $this->view = $this->getMock(ViewEntityInterface::class);
+    $this->viewsData = $this->getMockBuilder(ViewsData::class)
       ->disableOriginalConstructor()
       ->getMock();
-    $this->routeProvider = $this->getMock('Drupal\Core\Routing\RouteProviderInterface');
+    $this->routeProvider = $this->getMock(RouteProviderInterface::class);
     $this->viewExecutableFactory = new ViewExecutableFactory($this->user, $this->requestStack, $this->viewsData, $this->routeProvider);
   }
 
diff --git a/core/modules/views/tests/src/Unit/ViewExecutableTest.php b/core/modules/views/tests/src/Unit/ViewExecutableTest.php
index f30a19d..a0da2b0 100644
--- a/core/modules/views/tests/src/Unit/ViewExecutableTest.php
+++ b/core/modules/views/tests/src/Unit/ViewExecutableTest.php
@@ -5,14 +5,24 @@
 use Drupal\Component\Plugin\PluginManagerInterface;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
 use Drupal\Core\Extension\ModuleHandlerInterface;
+use Drupal\Core\Routing\RouteProviderInterface;
+use Drupal\Core\Session\AccountInterface;
 use Drupal\Core\Url;
 use Drupal\Tests\UnitTestCase;
+use Drupal\views\DisplayPluginCollection;
+use Drupal\views\ViewEntityInterface;
 use Drupal\views\Entity\View;
+use Drupal\views\Plugin\views\argument\ArgumentPluginBase;
 use Drupal\views\Plugin\views\cache\CachePluginBase;
 use Drupal\views\Plugin\views\cache\None as NoneCache;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
+use Drupal\views\Plugin\views\display\DisplayPluginInterface;
+use Drupal\views\Plugin\views\display\DisplayRouterInterface;
 use Drupal\views\Plugin\views\pager\None as NonePager;
 use Drupal\views\Plugin\views\query\QueryPluginBase;
 use Drupal\views\ViewExecutable;
+use Drupal\views\ViewExecutableFactory;
+use Drupal\views\ViewsData;
 use Symfony\Component\Routing\Route;
 
 /**
@@ -107,16 +117,16 @@ class ViewExecutableTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $this->view = $this->getMock('Drupal\views\ViewEntityInterface');
-    $this->user = $this->getMock('Drupal\Core\Session\AccountInterface');
-    $this->viewsData = $this->getMockBuilder('Drupal\views\ViewsData')
+    $this->view = $this->getMock(ViewEntityInterface::class);
+    $this->user = $this->getMock(AccountInterface::class);
+    $this->viewsData = $this->getMockBuilder(ViewsData::class)
       ->disableOriginalConstructor()
       ->getMock();
-    $this->displayHandler = $this->getMockBuilder('Drupal\views\Plugin\views\display\DisplayRouterInterface')
+    $this->displayHandler = $this->getMockBuilder(DisplayRouterInterface::class)
       ->disableOriginalConstructor()
       ->getMock();
-    $this->routeProvider = $this->getMock('Drupal\Core\Routing\RouteProviderInterface');
-    $this->displayHandlers = $this->getMockBuilder('Drupal\views\DisplayPluginCollection')
+    $this->routeProvider = $this->getMock(RouteProviderInterface::class);
+    $this->displayHandlers = $this->getMockBuilder(DisplayPluginCollection::class)
       ->disableOriginalConstructor()
       ->getMock();
 
@@ -124,7 +134,7 @@ protected function setUp() {
     $this->executable->display_handler = $this->displayHandler;
     $this->executable->displayHandlers = $this->displayHandlers;
 
-    $this->viewExecutableFactory = $this->getMockBuilder('Drupal\views\ViewExecutableFactory')
+    $this->viewExecutableFactory = $this->getMockBuilder(ViewExecutableFactory::class)
       ->disableOriginalConstructor()
       ->getMock();
 
@@ -185,7 +195,7 @@ public function testGetUrlWithPathNoPlaceholders() {
    * @covers ::getUrl
    */
   public function testGetUrlWithoutRouterDisplay() {
-    $this->displayHandler = $this->getMock('Drupal\views\Plugin\views\display\DisplayPluginInterface');
+    $this->displayHandler = $this->getMock(DisplayPluginInterface::class);
     $this->displayHandlers->expects($this->any())
       ->method('get')
       ->willReturn($this->displayHandler);
@@ -270,12 +280,12 @@ public function testGetUrlWithPlaceholdersAndWithoutArgsAndExceptionValue() {
       ->with('views.test.page_1')
       ->willReturn($route);
 
-    $argument_handler = $this->getMockBuilder('Drupal\views\Plugin\views\argument\ArgumentPluginBase')
+    $argument_handler = $this->getMockBuilder(ArgumentPluginBase::class)
       ->disableOriginalConstructor()
       ->getMock();
     $argument_handler->options['exception']['value'] = 'exception_0';
     $this->executable->argument['key_1'] = $argument_handler;
-    $argument_handler = $this->getMockBuilder('Drupal\views\Plugin\views\argument\ArgumentPluginBase')
+    $argument_handler = $this->getMockBuilder(ArgumentPluginBase::class)
       ->disableOriginalConstructor()
       ->getMock();
     $argument_handler->options['exception']['value'] = 'exception_1';
@@ -435,14 +445,14 @@ public function testAttachDisplays() {
       ->method('getAttachedDisplays')
       ->willReturn(['page_1']);
 
-    $cloned_view = $this->getMockBuilder('Drupal\views\ViewExecutable')
+    $cloned_view = $this->getMockBuilder(ViewExecutable::class)
       ->disableOriginalConstructor()
       ->getMock();
     $this->viewExecutableFactory->expects($this->atLeastOnce())
       ->method('get')
       ->willReturn($cloned_view);
 
-    $page_display = $this->getMockBuilder('Drupal\views\Plugin\views\display\DisplayPluginBase')
+    $page_display = $this->getMockBuilder(DisplayPluginBase::class)
       ->disableOriginalConstructor()
       ->getMock();
 
@@ -450,7 +460,7 @@ public function testAttachDisplays() {
       ->method('isEnabled')
       ->willReturn(TRUE);
 
-    $display_collection = $this->getMockBuilder('Drupal\views\DisplayPluginCollection')
+    $display_collection = $this->getMockBuilder(DisplayPluginCollection::class)
       ->disableOriginalConstructor()
       ->getMock();
 
@@ -489,7 +499,7 @@ protected function setupBaseViewAndDisplay() {
 
     $storage = new View($config, 'view');
     $view = new ViewExecutable($storage, $this->user, $this->viewsData, $this->routeProvider);
-    $display = $this->getMockBuilder('Drupal\views\Plugin\views\display\DisplayPluginBase')
+    $display = $this->getMockBuilder(DisplayPluginBase::class)
       ->disableOriginalConstructor()
       ->getMock();
     $display->expects($this->any())
diff --git a/core/modules/views/tests/src/Unit/ViewsDataHelperTest.php b/core/modules/views/tests/src/Unit/ViewsDataHelperTest.php
index 2289f23..251aa8d 100644
--- a/core/modules/views/tests/src/Unit/ViewsDataHelperTest.php
+++ b/core/modules/views/tests/src/Unit/ViewsDataHelperTest.php
@@ -3,6 +3,7 @@
 namespace Drupal\Tests\views\Unit;
 
 use Drupal\Tests\UnitTestCase;
+use Drupal\views\ViewsData;
 use Drupal\views\ViewsDataHelper;
 use Drupal\views\Tests\ViewTestData;
 
@@ -39,7 +40,7 @@ protected function viewsData() {
    * Tests fetchFields.
    */
   public function testFetchFields() {
-    $views_data = $this->getMockBuilder('Drupal\views\ViewsData')
+    $views_data = $this->getMockBuilder(ViewsData::class)
       ->disableOriginalConstructor()
       ->getMock();
     $views_data->expects($this->once())
diff --git a/core/modules/views/tests/src/Unit/ViewsDataTest.php b/core/modules/views/tests/src/Unit/ViewsDataTest.php
index a145538..d6fb599 100644
--- a/core/modules/views/tests/src/Unit/ViewsDataTest.php
+++ b/core/modules/views/tests/src/Unit/ViewsDataTest.php
@@ -2,7 +2,11 @@
 
 namespace Drupal\Tests\views\Unit;
 
+use Drupal\Core\Cache\CacheBackendInterface;
+use Drupal\Core\Cache\CacheTagsInvalidatorInterface;
+use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Language\Language;
+use Drupal\Core\Language\LanguageManagerInterface;
 use Drupal\Tests\UnitTestCase;
 use Drupal\views\ViewsData;
 use Drupal\views\Tests\ViewTestData;
@@ -59,15 +63,15 @@ class ViewsDataTest extends UnitTestCase {
    * {@inheritdoc}
    */
   protected function setUp() {
-    $this->cacheTagsInvalidator = $this->getMock('Drupal\Core\Cache\CacheTagsInvalidatorInterface');
-    $this->cacheBackend = $this->getMock('Drupal\Core\Cache\CacheBackendInterface');
+    $this->cacheTagsInvalidator = $this->getMock(CacheTagsInvalidatorInterface::class);
+    $this->cacheBackend = $this->getMock(CacheBackendInterface::class);
     $this->getContainerWithCacheTagsInvalidator($this->cacheTagsInvalidator);
 
     $configs = [];
     $configs['views.settings']['skip_cache'] = FALSE;
     $this->configFactory = $this->getConfigFactoryStub($configs);
-    $this->moduleHandler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface');
-    $this->languageManager = $this->getMock('Drupal\Core\Language\LanguageManagerInterface');
+    $this->moduleHandler = $this->getMock(ModuleHandlerInterface::class);
+    $this->languageManager = $this->getMock(LanguageManagerInterface::class);
     $this->languageManager->expects($this->any())
       ->method('getCurrentLanguage')
       ->will($this->returnValue(new Language(['id' => 'en'])));
diff --git a/core/modules/views/tests/src/Unit/ViewsHandlerManagerTest.php b/core/modules/views/tests/src/Unit/ViewsHandlerManagerTest.php
index c181b94..a686a3d 100644
--- a/core/modules/views/tests/src/Unit/ViewsHandlerManagerTest.php
+++ b/core/modules/views/tests/src/Unit/ViewsHandlerManagerTest.php
@@ -2,7 +2,12 @@
 
 namespace Drupal\Tests\views\Unit;
 
+use Drupal\Component\Plugin\Factory\FactoryInterface;
+use Drupal\Core\Cache\CacheBackendInterface;
+use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Tests\UnitTestCase;
+use Drupal\views\Plugin\views\ViewsHandlerInterface;
+use Drupal\views\ViewsData;
 use Drupal\views\Plugin\ViewsHandlerManager;
 
 /**
@@ -43,11 +48,11 @@ class ViewsHandlerManagerTest extends UnitTestCase {
    */
   protected function setUp() {
     parent::setUp();
-    $this->viewsData = $this->getMockBuilder('Drupal\views\ViewsData')
+    $this->viewsData = $this->getMockBuilder(ViewsData::class)
       ->disableOriginalConstructor()
       ->getMock();
-    $cache_backend = $this->getMock('Drupal\Core\Cache\CacheBackendInterface');
-    $this->moduleHandler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface');
+    $cache_backend = $this->getMock(CacheBackendInterface::class);
+    $this->moduleHandler = $this->getMock(ModuleHandlerInterface::class);
     $this->handlerManager = new ViewsHandlerManager('test', new \ArrayObject([]), $this->viewsData, $cache_backend, $this->moduleHandler);
   }
 
@@ -55,7 +60,7 @@ protected function setUp() {
    * Setups of the plugin factory.
    */
   protected function setupMockedFactory() {
-    $this->factory = $this->getMock('Drupal\Component\Plugin\Factory\FactoryInterface');
+    $this->factory = $this->getMock(FactoryInterface::class);
 
     $reflection = new \ReflectionClass($this->handlerManager);
     $property = $reflection->getProperty('factory');
@@ -110,7 +115,7 @@ public function testGetHandlerBaseInformationPropagation() {
       'real table' => 'test real table',
       'entity field' => 'test entity field',
     ];
-    $plugin = $this->getMock('Drupal\views\Plugin\views\ViewsHandlerInterface');
+    $plugin = $this->getMock(ViewsHandlerInterface::class);
     $this->factory->expects($this->once())
       ->method('createInstance')
       ->with('test_id', $expected_definition)
@@ -138,7 +143,7 @@ public function testGetHandlerOverride() {
       ->with('test_table')
       ->willReturn($views_data);
 
-    $plugin = $this->getMock('Drupal\views\Plugin\views\ViewsHandlerInterface');
+    $plugin = $this->getMock(ViewsHandlerInterface::class);
     $this->factory->expects($this->once())
       ->method('createInstance')
       ->with('test_override')
@@ -166,7 +171,7 @@ public function testGetHandlerNoOverride() {
       ->with('test_table')
       ->willReturn($views_data);
 
-    $plugin = $this->getMock('Drupal\views\Plugin\views\ViewsHandlerInterface');
+    $plugin = $this->getMock(ViewsHandlerInterface::class);
     $this->factory->expects($this->once())
       ->method('createInstance')
       ->with('test_id')
diff --git a/core/modules/views/tests/src/Unit/ViewsTest.php b/core/modules/views/tests/src/Unit/ViewsTest.php
index 00476c5..24f616f 100644
--- a/core/modules/views/tests/src/Unit/ViewsTest.php
+++ b/core/modules/views/tests/src/Unit/ViewsTest.php
@@ -2,12 +2,19 @@
 
 namespace Drupal\Tests\views\Unit;
 
+use Drupal\Component\Plugin\PluginManagerInterface;
+use Drupal\Core\Config\Entity\ConfigEntityStorage;
+use Drupal\Core\Entity\EntityManagerInterface;
 use Drupal\Core\Entity\EntityTypeManagerInterface;
+use Drupal\Core\Entity\Query\QueryInterface;
 use Drupal\Tests\UnitTestCase;
 use Drupal\views\Views;
 use Drupal\views\Entity\View;
 use Drupal\views\ViewExecutableFactory;
+use Drupal\views\ViewsData;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
+use Drupal\Core\Routing\RouteProviderInterface;
+use Drupal\Core\Session\AccountInterface;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpFoundation\RequestStack;
 
@@ -31,13 +38,13 @@ protected function setUp() {
     parent::setUp();
 
     $this->container = new ContainerBuilder();
-    $user = $this->getMock('Drupal\Core\Session\AccountInterface');
+    $user = $this->getMock(AccountInterface::class);
     $request_stack = new RequestStack();
     $request_stack->push(new Request());
-    $views_data = $this->getMockBuilder('Drupal\views\ViewsData')
+    $views_data = $this->getMockBuilder(ViewsData::class)
       ->disableOriginalConstructor()
       ->getMock();
-    $route_provider = $this->getMock('Drupal\Core\Routing\RouteProviderInterface');
+    $route_provider = $this->getMock(RouteProviderInterface::class);
     $this->container->set('views.executable', new ViewExecutableFactory($user, $request_stack, $views_data, $route_provider));
 
     \Drupal::setContainer($this->container);
@@ -51,7 +58,7 @@ protected function setUp() {
   public function testGetView() {
     $view = new View(['id' => 'test_view'], 'view');
 
-    $view_storage = $this->getMockBuilder('Drupal\Core\Config\Entity\ConfigEntityStorage')
+    $view_storage = $this->getMockBuilder(ConfigEntityStorage::class)
       ->disableOriginalConstructor()
       ->getMock();
     $view_storage->expects($this->once())
@@ -59,7 +66,7 @@ public function testGetView() {
       ->with('test_view')
       ->will($this->returnValue($view));
 
-    $entity_manager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
+    $entity_manager = $this->getMock(EntityManagerInterface::class);
     $entity_manager->expects($this->once())
       ->method('getStorage')
       ->with('view')
@@ -134,7 +141,7 @@ public function testGetApplicableViews($applicable_type, $expected) {
       ],
     ], 'view');
 
-    $query = $this->getMock('Drupal\Core\Entity\Query\QueryInterface');
+    $query = $this->getMock(QueryInterface::class);
     $query->expects($this->exactly(2))
       ->method('condition')
       ->willReturnSelf();
@@ -142,7 +149,7 @@ public function testGetApplicableViews($applicable_type, $expected) {
       ->method('execute')
       ->willReturn(['test_view_1', 'test_view_2', 'test_view_3']);
 
-    $view_storage = $this->getMockBuilder('Drupal\Core\Config\Entity\ConfigEntityStorage')
+    $view_storage = $this->getMockBuilder(ConfigEntityStorage::class)
       ->disableOriginalConstructor()
       ->getMock();
     $view_storage->expects($this->once())
@@ -172,7 +179,7 @@ public function testGetApplicableViews($applicable_type, $expected) {
       ],
     ];
 
-    $display_manager = $this->getMock('Drupal\Component\Plugin\PluginManagerInterface');
+    $display_manager = $this->getMock(PluginManagerInterface::class);
     $display_manager->expects($this->once())
       ->method('getDefinitions')
       ->willReturn($definitions);
diff --git a/core/modules/views_ui/tests/src/Unit/ViewListBuilderTest.php b/core/modules/views_ui/tests/src/Unit/ViewListBuilderTest.php
index 23cc7a8..463ff27 100644
--- a/core/modules/views_ui/tests/src/Unit/ViewListBuilderTest.php
+++ b/core/modules/views_ui/tests/src/Unit/ViewListBuilderTest.php
@@ -7,11 +7,22 @@
 
 namespace Drupal\Tests\views_ui\Unit;
 
+use Drupal\Core\Config\Entity\ConfigEntityStorage;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
 use Drupal\Core\Entity\EntityInterface;
+use Drupal\Core\Entity\EntityStorageInterface;
+use Drupal\Core\Entity\EntityTypeInterface;
+use Drupal\Core\Routing\RouteProviderInterface;
+use Drupal\Core\Session\AccountInterface;
+use Drupal\Core\State\StateInterface;
 use Drupal\Tests\UnitTestCase;
 use Drupal\views\Entity\View;
+use Drupal\views\Plugin\views\display\DefaultDisplay;
+use Drupal\views\Plugin\views\display\Embed;
+use Drupal\views\Plugin\views\display\Page;
+use Drupal\views\Plugin\ViewsPluginManager;
 use Drupal\views\ViewExecutableFactory;
+use Drupal\views\ViewsData;
 use Drupal\views_ui\ViewListBuilder;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpFoundation\RequestStack;
@@ -29,10 +40,10 @@ class ViewListBuilderTest extends UnitTestCase {
    * @covers ::buildRow
    */
   public function testBuildRowEntityList() {
-    $storage = $this->getMockBuilder('Drupal\Core\Config\Entity\ConfigEntityStorage')
+    $storage = $this->getMockBuilder(ConfigEntityStorage::class)
       ->disableOriginalConstructor()
       ->getMock();
-    $display_manager = $this->getMockBuilder('\Drupal\views\Plugin\ViewsPluginManager')
+    $display_manager = $this->getMockBuilder(ViewsPluginManager::class)
       ->disableOriginalConstructor()
       ->getMock();
 
@@ -76,14 +87,14 @@ public function testBuildRowEntityList() {
       ]));
 
 
-    $default_display = $this->getMock('Drupal\views\Plugin\views\display\DefaultDisplay',
+    $default_display = $this->getMock(DefaultDisplay::class,
       ['initDisplay'],
       [[], 'default', $display_manager->getDefinition('default')]
     );
-    $route_provider = $this->getMock('Drupal\Core\Routing\RouteProviderInterface');
-    $state = $this->getMock('\Drupal\Core\State\StateInterface');
-    $menu_storage = $this->getMock('\Drupal\Core\Entity\EntityStorageInterface');
-    $page_display = $this->getMock('Drupal\views\Plugin\views\display\Page',
+    $route_provider = $this->getMock(RouteProviderInterface::class);
+    $state = $this->getMock(StateInterface::class);
+    $menu_storage = $this->getMock(EntityStorageInterface::class);
+    $page_display = $this->getMock(Page::class,
       ['initDisplay', 'getPath'],
       [[], 'default', $display_manager->getDefinition('page'), $route_provider, $state, $menu_storage]
     );
@@ -94,7 +105,7 @@ public function testBuildRowEntityList() {
         $this->returnValue('<object>malformed_path</object>'),
         $this->returnValue('<script>alert("placeholder_page/%")</script>')));
 
-    $embed_display = $this->getMock('Drupal\views\Plugin\views\display\Embed', ['initDisplay'],
+    $embed_display = $this->getMock(Embed::class, ['initDisplay'],
       [[], 'default', $display_manager->getDefinition('embed')]
     );
 
@@ -134,13 +145,13 @@ public function testBuildRowEntityList() {
       ]));
 
     $container = new ContainerBuilder();
-    $user = $this->getMock('Drupal\Core\Session\AccountInterface');
+    $user = $this->getMock(AccountInterface::class);
     $request_stack = new RequestStack();
     $request_stack->push(new Request());
-    $views_data = $this->getMockBuilder('Drupal\views\ViewsData')
+    $views_data = $this->getMockBuilder(ViewsData::class)
       ->disableOriginalConstructor()
       ->getMock();
-    $route_provider = $this->getMock('Drupal\Core\Routing\RouteProviderInterface');
+    $route_provider = $this->getMock(RouteProviderInterface::class);
     $executable_factory = new ViewExecutableFactory($user, $request_stack, $views_data, $route_provider);
     $container->set('views.executable', $executable_factory);
     $container->set('plugin.manager.views.display', $display_manager);
@@ -148,7 +159,7 @@ public function testBuildRowEntityList() {
 
     // Setup a view list builder with a mocked buildOperations method,
     // because t() is called on there.
-    $entity_type = $this->getMock('Drupal\Core\Entity\EntityTypeInterface');
+    $entity_type = $this->getMock(EntityTypeInterface::class);
     $view_list_builder = new TestViewListBuilder($entity_type, $storage, $display_manager);
     $view_list_builder->setStringTranslation($this->getStringTranslationStub());
 
diff --git a/core/modules/views_ui/tests/src/Unit/ViewUIObjectTest.php b/core/modules/views_ui/tests/src/Unit/ViewUIObjectTest.php
index f49b25a..8b2f7d5 100644
--- a/core/modules/views_ui/tests/src/Unit/ViewUIObjectTest.php
+++ b/core/modules/views_ui/tests/src/Unit/ViewUIObjectTest.php
@@ -3,7 +3,9 @@
 namespace Drupal\Tests\views_ui\Unit;
 
 use Drupal\Core\Language\LanguageInterface;
+use Drupal\Core\Session\AccountInterface;
 use Drupal\Tests\UnitTestCase;
+use Drupal\views\ViewExecutable;
 use Drupal\views\Entity\View;
 use Drupal\views_ui\ViewUI;
 use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -43,8 +45,8 @@ public function testEntityDecoration() {
       }
     }
 
-    $storage = $this->getMock('Drupal\views\Entity\View', $interface_methods, [[], 'view']);
-    $executable = $this->getMockBuilder('Drupal\views\ViewExecutable')
+    $storage = $this->getMock(View::class, $interface_methods, [[], 'view']);
+    $executable = $this->getMockBuilder(ViewExecutable::class)
       ->disableOriginalConstructor()
       ->setConstructorArgs([$storage])
       ->getMock();
@@ -70,13 +72,13 @@ public function testEntityDecoration() {
    * Tests the isLocked method.
    */
   public function testIsLocked() {
-    $storage = $this->getMock('Drupal\views\Entity\View', [], [[], 'view']);
-    $executable = $this->getMockBuilder('Drupal\views\ViewExecutable')
+    $storage = $this->getMock(View::class, [], [[], 'view']);
+    $executable = $this->getMockBuilder(ViewExecutable::class)
       ->disableOriginalConstructor()
       ->setConstructorArgs([$storage])
       ->getMock();
     $storage->set('executable', $executable);
-    $account = $this->getMock('Drupal\Core\Session\AccountInterface');
+    $account = $this->getMock(AccountInterface::class);
     $account->expects($this->exactly(2))
       ->method('id')
       ->will($this->returnValue(1));
@@ -118,7 +120,7 @@ public function testSerialization() {
     \Drupal::setContainer($container);
 
     $storage = new View([], 'view');
-    $executable = $this->getMockBuilder('Drupal\views\ViewExecutable')
+    $executable = $this->getMockBuilder(ViewExecutable::class)
       ->disableOriginalConstructor()
       ->setConstructorArgs([$storage])
       ->getMock();
diff --git a/core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php b/core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php
index 3689ddd..75fed18 100644
--- a/core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php
+++ b/core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php
@@ -123,7 +123,7 @@ public function testClickLink() {
   }
 
   public function testError() {
-    $this->setExpectedException('\Exception', 'User notice: foo');
+    $this->setExpectedException(\Exception::class, 'User notice: foo');
     $this->drupalGet('test-error');
   }
 
diff --git a/core/tests/Drupal/KernelTests/Core/Config/DefaultConfigTest.php b/core/tests/Drupal/KernelTests/Core/Config/DefaultConfigTest.php
index f06806c..eb39a96 100644
--- a/core/tests/Drupal/KernelTests/Core/Config/DefaultConfigTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Config/DefaultConfigTest.php
@@ -47,7 +47,7 @@ protected function setUp() {
   public function register(ContainerBuilder $container) {
     parent::register($container);
     $container->register('default_config_test.schema_storage')
-      ->setClass('\Drupal\config_test\TestInstallStorage')
+      ->setClass(TestInstallStorage::class)
       ->addArgument(InstallStorage::CONFIG_SCHEMA_DIRECTORY);
 
     $definition = $container->getDefinition('config.typed');
diff --git a/core/tests/Drupal/Tests/Component/Datetime/TimeTest.php b/core/tests/Drupal/Tests/Component/Datetime/TimeTest.php
index 0553451..df8c7c8 100644
--- a/core/tests/Drupal/Tests/Component/Datetime/TimeTest.php
+++ b/core/tests/Drupal/Tests/Component/Datetime/TimeTest.php
@@ -5,6 +5,7 @@
 use Drupal\Component\Datetime\Time;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\HttpFoundation\Request;
+use Symfony\Component\HttpFoundation\RequestStack;
 
 /**
  * @coversDefaultClass \Drupal\Component\Datetime\Time
@@ -37,7 +38,7 @@ class TimeTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $this->requestStack = $this->getMock('Symfony\Component\HttpFoundation\RequestStack');
+    $this->requestStack = $this->getMock(RequestStack::class);
 
     $this->time = new Time($this->requestStack);
   }
diff --git a/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php b/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php
index f78304b..8794a33 100644
--- a/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php
+++ b/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php
@@ -8,6 +8,7 @@
 namespace Drupal\Tests\Component\DependencyInjection;
 
 use Drupal\Component\Utility\Crypt;
+use Drupal\Tests\Component\DependencyInjection\MockConfiguratorInterface;
 use PHPUnit\Framework\TestCase;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
@@ -514,7 +515,7 @@ public function testGetForConfigurator() {
     $container = $this->container;
 
     // Setup a configurator.
-    $configurator = $this->prophesize('\Drupal\Tests\Component\DependencyInjection\MockConfiguratorInterface');
+    $configurator = $this->prophesize(MockConfiguratorInterface::class);
     $configurator->configureService(Argument::type('object'))
       ->shouldBeCalled(1)
       ->will(function($args) use ($container) {
diff --git a/core/tests/Drupal/Tests/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumperTest.php b/core/tests/Drupal/Tests/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumperTest.php
index 038e018..474cd2f 100644
--- a/core/tests/Drupal/Tests/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumperTest.php
+++ b/core/tests/Drupal/Tests/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumperTest.php
@@ -9,6 +9,7 @@
 
   use Drupal\Component\Utility\Crypt;
   use PHPUnit\Framework\TestCase;
+use Symfony\Component\DependencyInjection\ContainerBuilder;
   use Symfony\Component\DependencyInjection\Definition;
   use Symfony\Component\DependencyInjection\Reference;
   use Symfony\Component\DependencyInjection\Parameter;
@@ -64,7 +65,7 @@ class OptimizedPhpArrayDumperTest extends TestCase {
      */
     protected function setUp() {
       // Setup a mock container builder.
-      $this->containerBuilder = $this->prophesize('\Symfony\Component\DependencyInjection\ContainerBuilder');
+      $this->containerBuilder = $this->prophesize(ContainerBuilder::class);
       $this->containerBuilder->getAliases()->willReturn([]);
       $this->containerBuilder->getParameterBag()->willReturn(new ParameterBag());
       $this->containerBuilder->getDefinitions()->willReturn(NULL);
@@ -395,7 +396,7 @@ public function getDefinitionsDataProvider() {
       ];
 
       foreach ($service_definitions as $service_definition) {
-        $definition = $this->prophesize('\Symfony\Component\DependencyInjection\Definition');
+        $definition = $this->prophesize(Definition::class);
         $definition->getClass()->willReturn($service_definition['class']);
         $definition->isPublic()->willReturn($service_definition['public']);
         $definition->getFile()->willReturn($service_definition['file']);
diff --git a/core/tests/Drupal/Tests/Component/Plugin/Context/ContextTest.php b/core/tests/Drupal/Tests/Component/Plugin/Context/ContextTest.php
index f320c55..397c251 100644
--- a/core/tests/Drupal/Tests/Component/Plugin/Context/ContextTest.php
+++ b/core/tests/Drupal/Tests/Component/Plugin/Context/ContextTest.php
@@ -3,6 +3,8 @@
 namespace Drupal\Tests\Component\Plugin\Context;
 
 use Drupal\Component\Plugin\Context\Context;
+use Drupal\Component\Plugin\Context\ContextDefinitionInterface;
+use Drupal\Component\Plugin\Exception\ContextException;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -28,7 +30,7 @@ public function providerGetContextValue() {
    */
   public function testGetContextValue($expected, $context_value, $is_required, $data_type) {
     // Mock a Context object.
-    $mock_context = $this->getMockBuilder('Drupal\Component\Plugin\Context\Context')
+    $mock_context = $this->getMockBuilder(Context::class)
       ->disableOriginalConstructor()
       ->setMethods(['getContextDefinition'])
       ->getMock();
@@ -48,7 +50,7 @@ public function testGetContextValue($expected, $context_value, $is_required, $da
     // throwing an exception if the definition requires it.
     else {
       // Create a mock definition.
-      $mock_definition = $this->getMockBuilder('Drupal\Component\Plugin\Context\ContextDefinitionInterface')
+      $mock_definition = $this->getMockBuilder(ContextDefinitionInterface::class)
         ->setMethods(['isRequired', 'getDataType'])
         ->getMockForAbstractClass();
 
@@ -72,7 +74,7 @@ public function testGetContextValue($expected, $context_value, $is_required, $da
       // Set expectation for exception.
       if ($is_required) {
         $this->setExpectedException(
-          'Drupal\Component\Plugin\Exception\ContextException',
+          ContextException::class,
           sprintf("The %s context is required and not present.", $data_type)
         );
       }
@@ -86,7 +88,7 @@ public function testGetContextValue($expected, $context_value, $is_required, $da
    * @covers ::getContextValue
    */
   public function testDefaultValue() {
-    $mock_definition = $this->getMockBuilder('Drupal\Component\Plugin\Context\ContextDefinitionInterface')
+    $mock_definition = $this->getMockBuilder(ContextDefinitionInterface::class)
       ->setMethods(['getDefaultValue'])
       ->getMockForAbstractClass();
 
diff --git a/core/tests/Drupal/Tests/Component/Plugin/Discovery/DiscoveryCachedTraitTest.php b/core/tests/Drupal/Tests/Component/Plugin/Discovery/DiscoveryCachedTraitTest.php
index 0f112fb..5311b85 100644
--- a/core/tests/Drupal/Tests/Component/Plugin/Discovery/DiscoveryCachedTraitTest.php
+++ b/core/tests/Drupal/Tests/Component/Plugin/Discovery/DiscoveryCachedTraitTest.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\Tests\Component\Plugin\Discovery;
 
+use Drupal\Component\Plugin\Discovery\DiscoveryCachedTrait;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -34,7 +35,7 @@ public function providerGetDefinition() {
    */
   public function testGetDefinition($expected, $cached_definitions, $get_definitions, $plugin_id) {
     // Mock a DiscoveryCachedTrait.
-    $trait = $this->getMockForTrait('Drupal\Component\Plugin\Discovery\DiscoveryCachedTrait');
+    $trait = $this->getMockForTrait(DiscoveryCachedTrait::class);
     $reflection_definitions = new \ReflectionProperty($trait, 'definitions');
     $reflection_definitions->setAccessible(TRUE);
     // getDefinition() needs the ::$definitions property to be set in one of two
diff --git a/core/tests/Drupal/Tests/Component/Plugin/Discovery/DiscoveryTraitTest.php b/core/tests/Drupal/Tests/Component/Plugin/Discovery/DiscoveryTraitTest.php
index b0f58c9..54d1f83 100644
--- a/core/tests/Drupal/Tests/Component/Plugin/Discovery/DiscoveryTraitTest.php
+++ b/core/tests/Drupal/Tests/Component/Plugin/Discovery/DiscoveryTraitTest.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\Tests\Component\Plugin\Discovery;
 
+use Drupal\Component\Plugin\Discovery\DiscoveryTrait;
 use Drupal\Component\Plugin\Exception\PluginNotFoundException;
 use Drupal\Tests\UnitTestCase;
 
@@ -32,7 +33,7 @@ public function providerDoGetDefinition() {
    */
   public function testDoGetDefinition($expected, $definitions, $plugin_id) {
     // Mock the trait.
-    $trait = $this->getMockForTrait('Drupal\Component\Plugin\Discovery\DiscoveryTrait');
+    $trait = $this->getMockForTrait(DiscoveryTrait::class);
     // Un-protect the method using reflection.
     $method_ref = new \ReflectionMethod($trait, 'doGetDefinition');
     $method_ref->setAccessible(TRUE);
@@ -64,7 +65,7 @@ public function providerDoGetDefinitionException() {
    */
   public function testDoGetDefinitionException($expected, $definitions, $plugin_id) {
     // Mock the trait.
-    $trait = $this->getMockForTrait('Drupal\Component\Plugin\Discovery\DiscoveryTrait');
+    $trait = $this->getMockForTrait(DiscoveryTrait::class);
     // Un-protect the method using reflection.
     $method_ref = new \ReflectionMethod($trait, 'doGetDefinition');
     $method_ref->setAccessible(TRUE);
@@ -81,7 +82,7 @@ public function testGetDefinition($expected, $definitions, $plugin_id) {
     // Since getDefinition is a wrapper around doGetDefinition(), we can re-use
     // its data provider. We just have to tell abstract method getDefinitions()
     // to use the $definitions array.
-    $trait = $this->getMockForTrait('Drupal\Component\Plugin\Discovery\DiscoveryTrait');
+    $trait = $this->getMockForTrait(DiscoveryTrait::class);
     $trait->expects($this->once())
       ->method('getDefinitions')
       ->willReturn($definitions);
@@ -101,7 +102,7 @@ public function testGetDefinitionException($expected, $definitions, $plugin_id)
     // Since getDefinition is a wrapper around doGetDefinition(), we can re-use
     // its data provider. We just have to tell abstract method getDefinitions()
     // to use the $definitions array.
-    $trait = $this->getMockForTrait('Drupal\Component\Plugin\Discovery\DiscoveryTrait');
+    $trait = $this->getMockForTrait(DiscoveryTrait::class);
     $trait->expects($this->once())
       ->method('getDefinitions')
       ->willReturn($definitions);
@@ -129,7 +130,7 @@ public function providerHasDefinition() {
    * @dataProvider providerHasDefinition
    */
   public function testHasDefinition($expected, $plugin_id) {
-    $trait = $this->getMockBuilder('Drupal\Component\Plugin\Discovery\DiscoveryTrait')
+    $trait = $this->getMockBuilder(DiscoveryTrait::class)
       ->setMethods(['getDefinition'])
       ->getMockForTrait();
     // Set up our mocked getDefinition() to return TRUE for 'valid' and FALSE
diff --git a/core/tests/Drupal/Tests/Component/Plugin/Discovery/StaticDiscoveryDecoratorTest.php b/core/tests/Drupal/Tests/Component/Plugin/Discovery/StaticDiscoveryDecoratorTest.php
index 1828d73..2bb9fa5 100644
--- a/core/tests/Drupal/Tests/Component/Plugin/Discovery/StaticDiscoveryDecoratorTest.php
+++ b/core/tests/Drupal/Tests/Component/Plugin/Discovery/StaticDiscoveryDecoratorTest.php
@@ -2,6 +2,9 @@
 
 namespace Drupal\Tests\Component\Plugin\Discovery;
 
+use Drupal\Component\Plugin\Discovery\DiscoveryInterface;
+use Drupal\Component\Plugin\Discovery\StaticDiscoveryDecorator;
+use Drupal\Component\Plugin\Exception\PluginNotFoundException;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -22,7 +25,7 @@ class StaticDiscoveryDecoratorTest extends UnitTestCase {
    *   called once.
    */
   public function getRegisterDefinitionsCallback() {
-    $mock_callable = $this->getMockBuilder('\stdClass')
+    $mock_callable = $this->getMockBuilder(\stdClass::class)
       ->setMethods(['registerDefinitionsCallback'])
       ->getMock();
     // Set expectations for the callback method.
@@ -60,7 +63,7 @@ public function providerGetDefinition() {
    */
   public function testGetDefinition($expected, $has_register_definitions, $exception_on_invalid, $definitions, $base_plugin_id) {
     // Mock our StaticDiscoveryDecorator.
-    $mock_decorator = $this->getMockBuilder('Drupal\Component\Plugin\Discovery\StaticDiscoveryDecorator')
+    $mock_decorator = $this->getMockBuilder(StaticDiscoveryDecorator::class)
       ->disableOriginalConstructor()
       ->setMethods(['registeredDefintionCallback'])
       ->getMock();
@@ -86,7 +89,7 @@ public function testGetDefinition($expected, $has_register_definitions, $excepti
     $ref_definitions->setValue($mock_decorator, []);
 
     // Mock a decorated object.
-    $mock_decorated = $this->getMockBuilder('Drupal\Component\Plugin\Discovery\DiscoveryInterface')
+    $mock_decorated = $this->getMockBuilder(DiscoveryInterface::class)
       ->setMethods(['getDefinitions'])
       ->getMockForAbstractClass();
     // Return our definitions from getDefinitions().
@@ -100,7 +103,7 @@ public function testGetDefinition($expected, $has_register_definitions, $excepti
     $ref_decorated->setValue($mock_decorator, $mock_decorated);
 
     if ($exception_on_invalid) {
-      $this->setExpectedException('Drupal\Component\Plugin\Exception\PluginNotFoundException');
+      $this->setExpectedException(PluginNotFoundException::class);
     }
 
     // Exercise getDefinition(). It calls parent::getDefinition().
@@ -130,7 +133,7 @@ public function providerGetDefinitions() {
    */
   public function testGetDefinitions($has_register_definitions, $definitions) {
     // Mock our StaticDiscoveryDecorator.
-    $mock_decorator = $this->getMockBuilder('Drupal\Component\Plugin\Discovery\StaticDiscoveryDecorator')
+    $mock_decorator = $this->getMockBuilder(StaticDiscoveryDecorator::class)
       ->disableOriginalConstructor()
       ->setMethods(['registeredDefintionCallback'])
       ->getMock();
@@ -156,7 +159,7 @@ public function testGetDefinitions($has_register_definitions, $definitions) {
     $ref_definitions->setValue($mock_decorator, []);
 
     // Mock a decorated object.
-    $mock_decorated = $this->getMockBuilder('Drupal\Component\Plugin\Discovery\DiscoveryInterface')
+    $mock_decorated = $this->getMockBuilder(DiscoveryInterface::class)
       ->setMethods(['getDefinitions'])
       ->getMockForAbstractClass();
     // Our mocked method will return any arguments sent to it.
@@ -198,7 +201,7 @@ public function providerCall() {
    */
   public function testCall($method, $args) {
     // Mock a decorated object.
-    $mock_decorated = $this->getMockBuilder('Drupal\Component\Plugin\Discovery\DiscoveryInterface')
+    $mock_decorated = $this->getMockBuilder(DiscoveryInterface::class)
       ->setMethods([$method])
       ->getMockForAbstractClass();
     // Our mocked method will return any arguments sent to it.
@@ -211,7 +214,7 @@ function () {
       );
 
     // Create a mock decorator.
-    $mock_decorator = $this->getMockBuilder('Drupal\Component\Plugin\Discovery\StaticDiscoveryDecorator')
+    $mock_decorator = $this->getMockBuilder(StaticDiscoveryDecorator::class)
       ->disableOriginalConstructor()
       ->getMock();
     // Poke the decorated object into our decorator.
diff --git a/core/tests/Drupal/Tests/Component/Plugin/Factory/ReflectionFactoryTest.php b/core/tests/Drupal/Tests/Component/Plugin/Factory/ReflectionFactoryTest.php
index c6a0adf..fd4d96b 100644
--- a/core/tests/Drupal/Tests/Component/Plugin/Factory/ReflectionFactoryTest.php
+++ b/core/tests/Drupal/Tests/Component/Plugin/Factory/ReflectionFactoryTest.php
@@ -9,6 +9,7 @@
 
 namespace Drupal\Tests\Component\Plugin\Factory;
 
+use Drupal\Component\Plugin\Discovery\DiscoveryInterface;
 use Drupal\Component\Plugin\Factory\ReflectionFactory;
 use Drupal\Tests\UnitTestCase;
 
@@ -87,7 +88,7 @@ public function providerGetInstanceArguments() {
    */
   public function testCreateInstance($expected, $reflector_name, $plugin_id, $plugin_definition, $configuration) {
     // Create a mock DiscoveryInterface which can return our plugin definition.
-    $mock_discovery = $this->getMockBuilder('Drupal\Component\Plugin\Discovery\DiscoveryInterface')
+    $mock_discovery = $this->getMockBuilder(DiscoveryInterface::class)
       ->setMethods(['getDefinition', 'getDefinitions', 'hasDefinition'])
       ->getMock();
     $mock_discovery->expects($this->never())->method('getDefinitions');
@@ -111,7 +112,7 @@ public function testCreateInstance($expected, $reflector_name, $plugin_id, $plug
    * @dataProvider providerGetInstanceArguments
    */
   public function testGetInstanceArguments($expected, $reflector_name, $plugin_id, $plugin_definition, $configuration) {
-    $reflection_factory = $this->getMockBuilder('Drupal\Component\Plugin\Factory\ReflectionFactory')
+    $reflection_factory = $this->getMockBuilder(ReflectionFactory::class)
       ->disableOriginalConstructor()
       ->getMock();
     $get_instance_arguments_ref = new \ReflectionMethod($reflection_factory, 'getInstanceArguments');
@@ -123,7 +124,7 @@ public function testGetInstanceArguments($expected, $reflector_name, $plugin_id,
     // us to use one data set for this test method as well as
     // testCreateInstance().
     if ($plugin_id == 'arguments_no_constructor') {
-      $this->setExpectedException('\ReflectionException');
+      $this->setExpectedException(\ReflectionException::class);
     }
 
     // Finally invoke getInstanceArguments() on our mocked factory.
diff --git a/core/tests/Drupal/Tests/Component/Plugin/PluginBaseTest.php b/core/tests/Drupal/Tests/Component/Plugin/PluginBaseTest.php
index 0ef8451..6a9f00f 100644
--- a/core/tests/Drupal/Tests/Component/Plugin/PluginBaseTest.php
+++ b/core/tests/Drupal/Tests/Component/Plugin/PluginBaseTest.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\Tests\Component\Plugin;
 
+use Drupal\Component\Plugin\PluginBase;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -15,7 +16,7 @@ class PluginBaseTest extends UnitTestCase {
    * @covers ::getPluginId
    */
   public function testGetPluginId($plugin_id, $expected) {
-    $plugin_base = $this->getMockForAbstractClass('Drupal\Component\Plugin\PluginBase', [
+    $plugin_base = $this->getMockForAbstractClass(PluginBase::class, [
       [],
       $plugin_id,
       [],
@@ -42,7 +43,7 @@ public function providerTestGetPluginId() {
    */
   public function testGetBaseId($plugin_id, $expected) {
     /** @var \Drupal\Component\Plugin\PluginBase|\PHPUnit_Framework_MockObject_MockObject $plugin_base */
-    $plugin_base = $this->getMockForAbstractClass('Drupal\Component\Plugin\PluginBase', [
+    $plugin_base = $this->getMockForAbstractClass(PluginBase::class, [
       [],
       $plugin_id,
       [],
@@ -70,7 +71,7 @@ public function providerTestGetBaseId() {
    */
   public function testGetDerivativeId($plugin_id = NULL, $expected = NULL) {
     /** @var \Drupal\Component\Plugin\PluginBase|\PHPUnit_Framework_MockObject_MockObject $plugin_base */
-    $plugin_base = $this->getMockForAbstractClass('Drupal\Component\Plugin\PluginBase', [
+    $plugin_base = $this->getMockForAbstractClass(PluginBase::class, [
       [],
       $plugin_id,
       [],
@@ -95,7 +96,7 @@ public function providerTestGetDerivativeId() {
    * @covers ::getPluginDefinition
    */
   public function testGetPluginDefinition() {
-    $plugin_base = $this->getMockForAbstractClass('Drupal\Component\Plugin\PluginBase', [
+    $plugin_base = $this->getMockForAbstractClass(PluginBase::class, [
       [],
       'plugin_id',
       ['value', ['key' => 'value']],
diff --git a/core/tests/Drupal/Tests/Component/Plugin/PluginManagerBaseTest.php b/core/tests/Drupal/Tests/Component/Plugin/PluginManagerBaseTest.php
index 24a7b08..a32104a 100644
--- a/core/tests/Drupal/Tests/Component/Plugin/PluginManagerBaseTest.php
+++ b/core/tests/Drupal/Tests/Component/Plugin/PluginManagerBaseTest.php
@@ -2,7 +2,9 @@
 
 namespace Drupal\Tests\Component\Plugin;
 
+use Drupal\Component\Plugin\PluginManagerBase;
 use Drupal\Component\Plugin\Exception\PluginNotFoundException;
+use Drupal\Component\Plugin\Factory\FactoryInterface;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -31,7 +33,7 @@ public function createInstanceCallback() {
    * Generates a mocked FactoryInterface object with known properties.
    */
   public function getMockFactoryInterface($expects_count) {
-    $mock_factory = $this->getMockBuilder('Drupal\Component\Plugin\Factory\FactoryInterface')
+    $mock_factory = $this->getMockBuilder(FactoryInterface::class)
       ->setMethods(['createInstance'])
       ->getMockForAbstractClass();
     $mock_factory->expects($this->exactly($expects_count))
@@ -46,7 +48,7 @@ public function getMockFactoryInterface($expects_count) {
    * @covers ::createInstance
    */
   public function testCreateInstance() {
-    $manager = $this->getMockBuilder('Drupal\Component\Plugin\PluginManagerBase')
+    $manager = $this->getMockBuilder(PluginManagerBase::class)
       ->getMockForAbstractClass();
     // PluginManagerBase::createInstance() looks for a factory object and then
     // calls createInstance() on it. So we have to mock a factory object.
diff --git a/core/tests/Drupal/Tests/Component/Serialization/YamlTest.php b/core/tests/Drupal/Tests/Component/Serialization/YamlTest.php
index 841ac05..13b1d2c 100644
--- a/core/tests/Drupal/Tests/Component/Serialization/YamlTest.php
+++ b/core/tests/Drupal/Tests/Component/Serialization/YamlTest.php
@@ -22,7 +22,7 @@ class YamlTest extends UnitTestCase {
 
   public function setUp() {
     parent::setUp();
-    $this->mockParser = $this->getMockBuilder('\stdClass')
+    $this->mockParser = $this->getMockBuilder(\stdClass::class)
       ->setMethods(['encode', 'decode', 'getFileExtension'])
       ->getMock();
     YamlParserProxy::setMock($this->mockParser);
diff --git a/core/tests/Drupal/Tests/Component/Utility/ArgumentsResolverTest.php b/core/tests/Drupal/Tests/Component/Utility/ArgumentsResolverTest.php
index 1710609..257ea17 100644
--- a/core/tests/Drupal/Tests/Component/Utility/ArgumentsResolverTest.php
+++ b/core/tests/Drupal/Tests/Component/Utility/ArgumentsResolverTest.php
@@ -8,6 +8,9 @@
 namespace Drupal\Tests\Component\Utility;
 
 use Drupal\Component\Utility\ArgumentsResolver;
+use Drupal\Tests\Component\Utility\TestClass;
+use Drupal\Tests\Component\Utility\TestInterface1;
+use Drupal\Tests\Component\Utility\TestInterface2;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -96,9 +99,9 @@ public function testGetWildcardArgument() {
    * Tests getArgument() with a Route, Request, and Account object.
    */
   public function testGetArgumentOrder() {
-    $a1 = $this->getMock('\Drupal\Tests\Component\Utility\TestInterface1');
-    $a2 = $this->getMock('\Drupal\Tests\Component\Utility\TestClass');
-    $a3 = $this->getMock('\Drupal\Tests\Component\Utility\TestInterface2');
+    $a1 = $this->getMock(TestInterface1::class);
+    $a2 = $this->getMock(TestClass::class);
+    $a3 = $this->getMock(TestInterface2::class);
 
     $objects = [
       't1' => $a1,
@@ -123,7 +126,7 @@ public function testGetArgumentOrder() {
    * Without the typehint, the wildcard object will not be passed to the callable.
    */
   public function testGetWildcardArgumentNoTypehint() {
-    $a = $this->getMock('\Drupal\Tests\Component\Utility\TestInterface1');
+    $a = $this->getMock(TestInterface1::class);
     $wildcards = [$a];
     $resolver = new ArgumentsResolver([], [], $wildcards);
 
diff --git a/core/tests/Drupal/Tests/Component/Utility/ColorTest.php b/core/tests/Drupal/Tests/Component/Utility/ColorTest.php
index e2f1629..5dd1b47 100644
--- a/core/tests/Drupal/Tests/Component/Utility/ColorTest.php
+++ b/core/tests/Drupal/Tests/Component/Utility/ColorTest.php
@@ -26,7 +26,7 @@ class ColorTest extends UnitTestCase {
    */
   public function testHexToRgb($value, $expected, $invalid = FALSE) {
     if ($invalid) {
-      $this->setExpectedException('InvalidArgumentException');
+      $this->setExpectedException(\InvalidArgumentException::class);
     }
     $this->assertSame($expected, Color::hexToRgb($value));
   }
diff --git a/core/tests/Drupal/Tests/Component/Utility/SafeMarkupTest.php b/core/tests/Drupal/Tests/Component/Utility/SafeMarkupTest.php
index 0a7fc77..cd844a9 100644
--- a/core/tests/Drupal/Tests/Component/Utility/SafeMarkupTest.php
+++ b/core/tests/Drupal/Tests/Component/Utility/SafeMarkupTest.php
@@ -37,7 +37,7 @@ protected function tearDown() {
    * @covers ::isSafe
    */
   public function testIsSafe() {
-    $safe_string = $this->getMock('\Drupal\Component\Render\MarkupInterface');
+    $safe_string = $this->getMock(MarkupInterface::class);
     $this->assertTrue(SafeMarkup::isSafe($safe_string));
     $string_object = new SafeMarkupTestString('test');
     $this->assertFalse(SafeMarkup::isSafe($string_object));
diff --git a/core/tests/Drupal/Tests/Component/Utility/UnicodeTest.php b/core/tests/Drupal/Tests/Component/Utility/UnicodeTest.php
index b834d2b..9456bc4 100644
--- a/core/tests/Drupal/Tests/Component/Utility/UnicodeTest.php
+++ b/core/tests/Drupal/Tests/Component/Utility/UnicodeTest.php
@@ -33,7 +33,7 @@ protected function setUp() {
    */
   public function testStatus($value, $expected, $invalid = FALSE) {
     if ($invalid) {
-      $this->setExpectedException('InvalidArgumentException');
+      $this->setExpectedException(\InvalidArgumentException::class);
     }
     Unicode::setStatus($value);
     $this->assertEquals($expected, Unicode::getStatus());
diff --git a/core/tests/Drupal/Tests/Core/Access/AccessManagerTest.php b/core/tests/Drupal/Tests/Core/Access/AccessManagerTest.php
index 231f809..550cd70 100644
--- a/core/tests/Drupal/Tests/Core/Access/AccessManagerTest.php
+++ b/core/tests/Drupal/Tests/Core/Access/AccessManagerTest.php
@@ -7,14 +7,20 @@
 
 namespace Drupal\Tests\Core\Access;
 
+use Drupal\Component\Utility\ArgumentsResolverInterface;
+use Drupal\Core\Access\AccessArgumentsResolverFactoryInterface;
 use Drupal\Core\Access\AccessCheckInterface;
 use Drupal\Core\Access\AccessException;
 use Drupal\Core\Access\AccessResult;
 use Drupal\Core\Access\CheckProvider;
 use Drupal\Core\Cache\Context\CacheContextsManager;
 use Drupal\Core\Routing\RouteMatch;
+use Drupal\Core\Routing\RouteProviderInterface;
 use Drupal\Core\Access\AccessManager;
 use Drupal\Core\Access\DefaultAccessCheck;
+use Drupal\Core\ParamConverter\ParamConverterManagerInterface;
+use Drupal\Core\Session\AccountInterface;
+use Drupal\Tests\Core\Access\TestAccessCheckInterface;
 use Drupal\Tests\UnitTestCase;
 use Drupal\router_test\Access\DefinedTestAccessCheck;
 use Symfony\Cmf\Component\Routing\RouteObjectInterface;
@@ -105,7 +111,7 @@ protected function setUp() {
     $this->routeCollection->add('test_route_3', new Route('/test-route-3', [], ['_access' => 'FALSE']));
     $this->routeCollection->add('test_route_4', new Route('/test-route-4/{value}', [], ['_access' => 'TRUE']));
 
-    $this->routeProvider = $this->getMock('Drupal\Core\Routing\RouteProviderInterface');
+    $this->routeProvider = $this->getMock(RouteProviderInterface::class);
     $map = [];
     foreach ($this->routeCollection->all() as $name => $route) {
       $map[] = [$name, [], $route];
@@ -121,11 +127,11 @@ protected function setUp() {
     $map[] = ['test_route_3', [], '/test-route-3'];
     $map[] = ['test_route_4', ['value' => 'example'], '/test-route-4/example'];
 
-    $this->paramConverter = $this->getMock('Drupal\Core\ParamConverter\ParamConverterManagerInterface');
+    $this->paramConverter = $this->getMock(ParamConverterManagerInterface::class);
 
-    $this->account = $this->getMock('Drupal\Core\Session\AccountInterface');
-    $this->currentUser = $this->getMock('Drupal\Core\Session\AccountInterface');
-    $this->argumentsResolverFactory = $this->getMock('Drupal\Core\Access\AccessArgumentsResolverFactoryInterface');
+    $this->account = $this->getMock(AccountInterface::class);
+    $this->currentUser = $this->getMock(AccountInterface::class);
+    $this->argumentsResolverFactory = $this->getMock(AccessArgumentsResolverFactoryInterface::class);
     $this->checkProvider = new CheckProvider();
     $this->checkProvider->setContainer($this->container);
 
@@ -160,7 +166,7 @@ public function testSetChecksWithDynamicAccessChecker() {
     $this->accessManager = new AccessManager($this->routeProvider, $this->paramConverter, $this->argumentsResolverFactory, $this->currentUser, $this->checkProvider);
 
     // Setup the dynamic access checker.
-    $access_check = $this->getMock('Drupal\Tests\Core\Access\TestAccessCheckInterface');
+    $access_check = $this->getMock(TestAccessCheckInterface::class);
     $this->container->set('test_access', $access_check);
     $this->checkProvider->addCheckService('test_access', 'access');
 
@@ -369,7 +375,7 @@ public function testCheckNamedRouteWithUpcastedValues() {
     $route = new Route('/test-route-1/{value}', [], ['_test_access' => 'TRUE']);
     $this->routeCollection->add('test_route_1', $route);
 
-    $this->routeProvider = $this->getMock('Drupal\Core\Routing\RouteProviderInterface');
+    $this->routeProvider = $this->getMock(RouteProviderInterface::class);
     $this->routeProvider->expects($this->any())
       ->method('getRouteByName')
       ->with('test_route_1', ['value' => 'example'])
@@ -378,7 +384,7 @@ public function testCheckNamedRouteWithUpcastedValues() {
     $map = [];
     $map[] = ['test_route_1', ['value' => 'example'], '/test-route-1/example'];
 
-    $this->paramConverter = $this->getMock('Drupal\Core\ParamConverter\ParamConverterManagerInterface');
+    $this->paramConverter = $this->getMock(ParamConverterManagerInterface::class);
     $this->paramConverter->expects($this->atLeastOnce())
       ->method('convert')
       ->with(['value' => 'example', RouteObjectInterface::ROUTE_NAME => 'test_route_1', RouteObjectInterface::ROUTE_OBJECT => $route])
@@ -391,7 +397,7 @@ public function testCheckNamedRouteWithUpcastedValues() {
 
     $this->accessManager = new AccessManager($this->routeProvider, $this->paramConverter, $this->argumentsResolverFactory, $this->currentUser, $this->checkProvider);
 
-    $access_check = $this->getMock('Drupal\Tests\Core\Access\TestAccessCheckInterface');
+    $access_check = $this->getMock(TestAccessCheckInterface::class);
     $access_check->expects($this->atLeastOnce())
       ->method('applies')
       ->will($this->returnValue(TRUE));
@@ -418,7 +424,7 @@ public function testCheckNamedRouteWithDefaultValue() {
     $route = new Route('/test-route-1/{value}', ['value' => 'example'], ['_test_access' => 'TRUE']);
     $this->routeCollection->add('test_route_1', $route);
 
-    $this->routeProvider = $this->getMock('Drupal\Core\Routing\RouteProviderInterface');
+    $this->routeProvider = $this->getMock(RouteProviderInterface::class);
     $this->routeProvider->expects($this->any())
       ->method('getRouteByName')
       ->with('test_route_1', [])
@@ -427,7 +433,7 @@ public function testCheckNamedRouteWithDefaultValue() {
     $map = [];
     $map[] = ['test_route_1', ['value' => 'example'], '/test-route-1/example'];
 
-    $this->paramConverter = $this->getMock('Drupal\Core\ParamConverter\ParamConverterManagerInterface');
+    $this->paramConverter = $this->getMock(ParamConverterManagerInterface::class);
     $this->paramConverter->expects($this->atLeastOnce())
       ->method('convert')
       ->with(['value' => 'example', RouteObjectInterface::ROUTE_NAME => 'test_route_1', RouteObjectInterface::ROUTE_OBJECT => $route])
@@ -440,7 +446,7 @@ public function testCheckNamedRouteWithDefaultValue() {
 
     $this->accessManager = new AccessManager($this->routeProvider, $this->paramConverter, $this->argumentsResolverFactory, $this->currentUser, $this->checkProvider);
 
-    $access_check = $this->getMock('Drupal\Tests\Core\Access\TestAccessCheckInterface');
+    $access_check = $this->getMock(TestAccessCheckInterface::class);
     $access_check->expects($this->atLeastOnce())
       ->method('applies')
       ->will($this->returnValue(TRUE));
@@ -477,7 +483,7 @@ public function testCheckNamedRouteWithNonExistingRoute() {
    * @dataProvider providerCheckException
    */
   public function testCheckException($return_value) {
-    $route_provider = $this->getMock('Drupal\Core\Routing\RouteProviderInterface');
+    $route_provider = $this->getMock(RouteProviderInterface::class);
 
     // Setup a test route for each access configuration.
     $requirements = [
@@ -494,7 +500,7 @@ public function testCheckException($return_value) {
       ->method('getRouteByName')
       ->will($this->returnValue($route));
 
-    $this->paramConverter = $this->getMock('Drupal\Core\ParamConverter\ParamConverterManagerInterface');
+    $this->paramConverter = $this->getMock(ParamConverterManagerInterface::class);
     $this->paramConverter->expects($this->any())
       ->method('convert')
       ->will($this->returnValue([]));
@@ -504,7 +510,7 @@ public function testCheckException($return_value) {
     $container = new ContainerBuilder();
 
     // Register a service that will return an incorrect value.
-    $access_check = $this->getMock('Drupal\Tests\Core\Access\TestAccessCheckInterface');
+    $access_check = $this->getMock(TestAccessCheckInterface::class);
     $access_check->expects($this->any())
       ->method('access')
       ->will($this->returnValue($return_value));
@@ -551,7 +557,7 @@ protected function setupAccessArgumentsResolverFactory($constraint = NULL) {
     return $this->argumentsResolverFactory->expects($constraint)
       ->method('getArgumentsResolver')
       ->will($this->returnCallback(function ($route_match, $account) {
-        $resolver = $this->getMock('Drupal\Component\Utility\ArgumentsResolverInterface');
+        $resolver = $this->getMock(ArgumentsResolverInterface::class);
         $resolver->expects($this->any())
           ->method('getArguments')
           ->will($this->returnCallback(function ($callable) use ($route_match) {
diff --git a/core/tests/Drupal/Tests/Core/Access/AccessResultTest.php b/core/tests/Drupal/Tests/Core/Access/AccessResultTest.php
index 647da61..7d6c6c6 100644
--- a/core/tests/Drupal/Tests/Core/Access/AccessResultTest.php
+++ b/core/tests/Drupal/Tests/Core/Access/AccessResultTest.php
@@ -13,7 +13,10 @@
 use Drupal\Core\Access\AccessResultReasonInterface;
 use Drupal\Core\Cache\Cache;
 use Drupal\Core\Cache\CacheableDependencyInterface;
+use Drupal\Core\Cache\Context\CacheContextsManager;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
+use Drupal\Core\Session\AccountInterface;
+use Drupal\node\NodeInterface;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -35,7 +38,7 @@ class AccessResultTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $this->cacheContextsManager = $this->getMockBuilder('Drupal\Core\Cache\Context\CacheContextsManager')
+    $this->cacheContextsManager = $this->getMockBuilder(CacheContextsManager::class)
       ->disableOriginalConstructor()
       ->getMock();
 
@@ -177,7 +180,7 @@ public function testAndIf() {
     $neutral = AccessResult::neutral('neutral message');
     $allowed = AccessResult::allowed();
     $forbidden = AccessResult::forbidden('forbidden message');
-    $unused_access_result_due_to_lazy_evaluation = $this->getMock('\Drupal\Core\Access\AccessResultInterface');
+    $unused_access_result_due_to_lazy_evaluation = $this->getMock(AccessResultInterface::class);
     $unused_access_result_due_to_lazy_evaluation->expects($this->never())
       ->method($this->anything());
 
@@ -268,7 +271,7 @@ public function testOrIf() {
     $neutral = AccessResult::neutral('neutral message');
     $allowed = AccessResult::allowed();
     $forbidden = AccessResult::forbidden('forbidden message');
-    $unused_access_result_due_to_lazy_evaluation = $this->getMock('\Drupal\Core\Access\AccessResultInterface');
+    $unused_access_result_due_to_lazy_evaluation = $this->getMock(AccessResultInterface::class);
     $unused_access_result_due_to_lazy_evaluation->expects($this->never())
       ->method($this->anything());
 
@@ -424,7 +427,7 @@ public function testCacheContexts() {
     $this->assertEquals($a, $c);
 
     // ::allowIfHasPermission and ::allowedIfHasPermission convenience methods.
-    $account = $this->getMock('\Drupal\Core\Session\AccountInterface');
+    $account = $this->getMock(AccountInterface::class);
     $account->expects($this->any())
       ->method('hasPermission')
       ->with('may herd llamas')
@@ -477,7 +480,7 @@ public function testCacheTags() {
     $verify($access, ['bar:baz', 'bar:qux', 'foo:bar', 'foo:baz']);
 
     // ::addCacheableDependency() convenience method.
-    $node = $this->getMock('\Drupal\node\NodeInterface');
+    $node = $this->getMock(NodeInterface::class);
     $node->expects($this->any())
       ->method('getCacheTags')
       ->will($this->returnValue(['node:20011988']));
@@ -895,7 +898,7 @@ public function testOrIfCacheabilityMerging() {
    *   The expected access check result.
    */
   public function testAllowedIfHasPermissions($permissions, $conjunction, AccessResult $expected_access) {
-    $account = $this->getMock('\Drupal\Core\Session\AccountInterface');
+    $account = $this->getMock(AccountInterface::class);
     $account->expects($this->any())
       ->method('hasPermission')
       ->willReturnMap([
diff --git a/core/tests/Drupal/Tests/Core/Access/CsrfAccessCheckTest.php b/core/tests/Drupal/Tests/Core/Access/CsrfAccessCheckTest.php
index edbbfba..14c815e 100644
--- a/core/tests/Drupal/Tests/Core/Access/CsrfAccessCheckTest.php
+++ b/core/tests/Drupal/Tests/Core/Access/CsrfAccessCheckTest.php
@@ -6,6 +6,8 @@
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\Routing\Route;
 use Drupal\Core\Access\CsrfAccessCheck;
+use Drupal\Core\Access\CsrfTokenGenerator;
+use Drupal\Core\Routing\RouteMatchInterface;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -36,11 +38,11 @@ class CsrfAccessCheckTest extends UnitTestCase {
   protected $routeMatch;
 
   protected function setUp() {
-    $this->csrfToken = $this->getMockBuilder('Drupal\Core\Access\CsrfTokenGenerator')
+    $this->csrfToken = $this->getMockBuilder(CsrfTokenGenerator::class)
       ->disableOriginalConstructor()
       ->getMock();
 
-    $this->routeMatch = $this->getMock('Drupal\Core\Routing\RouteMatchInterface');
+    $this->routeMatch = $this->getMock(RouteMatchInterface::class);
 
     $this->accessCheck = new CsrfAccessCheck($this->csrfToken);
   }
diff --git a/core/tests/Drupal/Tests/Core/Access/CsrfTokenGeneratorTest.php b/core/tests/Drupal/Tests/Core/Access/CsrfTokenGeneratorTest.php
index 52ed59c..6c33072 100644
--- a/core/tests/Drupal/Tests/Core/Access/CsrfTokenGeneratorTest.php
+++ b/core/tests/Drupal/Tests/Core/Access/CsrfTokenGeneratorTest.php
@@ -2,9 +2,11 @@
 
 namespace Drupal\Tests\Core\Access;
 
+use Drupal\Core\PrivateKey;
 use Drupal\Core\Site\Settings;
 use Drupal\Tests\UnitTestCase;
 use Drupal\Core\Access\CsrfTokenGenerator;
+use Drupal\Core\Session\MetadataBag;
 use Drupal\Component\Utility\Crypt;
 
 /**
@@ -42,12 +44,12 @@ class CsrfTokenGeneratorTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $this->privateKey = $this->getMockBuilder('Drupal\Core\PrivateKey')
+    $this->privateKey = $this->getMockBuilder(PrivateKey::class)
       ->disableOriginalConstructor()
       ->setMethods(['get'])
       ->getMock();
 
-    $this->sessionMetadata = $this->getMockBuilder('Drupal\Core\Session\MetadataBag')
+    $this->sessionMetadata = $this->getMockBuilder(MetadataBag::class)
       ->disableOriginalConstructor()
       ->getMock();
 
diff --git a/core/tests/Drupal/Tests/Core/Access/CustomAccessCheckTest.php b/core/tests/Drupal/Tests/Core/Access/CustomAccessCheckTest.php
index 9f0c2c9..b3f036e 100644
--- a/core/tests/Drupal/Tests/Core/Access/CustomAccessCheckTest.php
+++ b/core/tests/Drupal/Tests/Core/Access/CustomAccessCheckTest.php
@@ -7,8 +7,13 @@
 
 namespace Drupal\Tests\Core\Access;
 
+use Drupal\Component\Utility\ArgumentsResolverInterface;
+use Drupal\Core\Access\AccessArgumentsResolverFactoryInterface;
 use Drupal\Core\Access\AccessResult;
 use Drupal\Core\Access\CustomAccessCheck;
+use Drupal\Core\Controller\ControllerResolverInterface;
+use Drupal\Core\Routing\RouteMatchInterface;
+use Drupal\Core\Session\AccountInterface;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\Routing\Route;
 
@@ -45,8 +50,8 @@ class CustomAccessCheckTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $this->controllerResolver = $this->getMock('Drupal\Core\Controller\ControllerResolverInterface');
-    $this->argumentsResolverFactory = $this->getMock('Drupal\Core\Access\AccessArgumentsResolverFactoryInterface');
+    $this->controllerResolver = $this->getMock(ControllerResolverInterface::class);
+    $this->argumentsResolverFactory = $this->getMock(AccessArgumentsResolverFactoryInterface::class);
     $this->accessChecker = new CustomAccessCheck($this->controllerResolver, $this->argumentsResolverFactory);
   }
 
@@ -54,14 +59,14 @@ protected function setUp() {
    * Test the access method.
    */
   public function testAccess() {
-    $route_match = $this->getMock('Drupal\Core\Routing\RouteMatchInterface');
+    $route_match = $this->getMock(RouteMatchInterface::class);
 
     $this->controllerResolver->expects($this->at(0))
       ->method('getControllerFromDefinition')
       ->with('\Drupal\Tests\Core\Access\TestController::accessDeny')
       ->will($this->returnValue([new TestController(), 'accessDeny']));
 
-    $resolver0 = $this->getMock('Drupal\Component\Utility\ArgumentsResolverInterface');
+    $resolver0 = $this->getMock(ArgumentsResolverInterface::class);
     $resolver0->expects($this->once())
       ->method('getArguments')
       ->will($this->returnValue([]));
@@ -74,7 +79,7 @@ public function testAccess() {
       ->with('\Drupal\Tests\Core\Access\TestController::accessAllow')
       ->will($this->returnValue([new TestController(), 'accessAllow']));
 
-    $resolver1 = $this->getMock('Drupal\Component\Utility\ArgumentsResolverInterface');
+    $resolver1 = $this->getMock(ArgumentsResolverInterface::class);
     $resolver1->expects($this->once())
       ->method('getArguments')
       ->will($this->returnValue([]));
@@ -87,7 +92,7 @@ public function testAccess() {
       ->with('\Drupal\Tests\Core\Access\TestController::accessParameter')
       ->will($this->returnValue([new TestController(), 'accessParameter']));
 
-    $resolver2 = $this->getMock('Drupal\Component\Utility\ArgumentsResolverInterface');
+    $resolver2 = $this->getMock(ArgumentsResolverInterface::class);
     $resolver2->expects($this->once())
       ->method('getArguments')
       ->will($this->returnValue(['parameter' => 'TRUE']));
@@ -96,7 +101,7 @@ public function testAccess() {
       ->will($this->returnValue($resolver2));
 
     $route = new Route('/test-route', [], ['_custom_access' => '\Drupal\Tests\Core\Access\TestController::accessDeny']);
-    $account = $this->getMock('Drupal\Core\Session\AccountInterface');
+    $account = $this->getMock(AccountInterface::class);
     $this->assertEquals(AccessResult::neutral(), $this->accessChecker->access($route, $route_match, $account));
 
     $route = new Route('/test-route', [], ['_custom_access' => '\Drupal\Tests\Core\Access\TestController::accessAllow']);
diff --git a/core/tests/Drupal/Tests/Core/Access/DefaultAccessCheckTest.php b/core/tests/Drupal/Tests/Core/Access/DefaultAccessCheckTest.php
index e465858..7ab0037 100644
--- a/core/tests/Drupal/Tests/Core/Access/DefaultAccessCheckTest.php
+++ b/core/tests/Drupal/Tests/Core/Access/DefaultAccessCheckTest.php
@@ -4,6 +4,7 @@
 
 use Drupal\Core\Access\AccessResult;
 use Drupal\Core\Access\DefaultAccessCheck;
+use Drupal\Core\Session\AccountInterface;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\Routing\Route;
@@ -34,7 +35,7 @@ class DefaultAccessCheckTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $this->account = $this->getMock('Drupal\Core\Session\AccountInterface');
+    $this->account = $this->getMock(AccountInterface::class);
     $this->accessChecker = new DefaultAccessCheck();
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Access/RouteProcessorCsrfTest.php b/core/tests/Drupal/Tests/Core/Access/RouteProcessorCsrfTest.php
index 2fef35f..e1022bf 100644
--- a/core/tests/Drupal/Tests/Core/Access/RouteProcessorCsrfTest.php
+++ b/core/tests/Drupal/Tests/Core/Access/RouteProcessorCsrfTest.php
@@ -3,6 +3,7 @@
 namespace Drupal\Tests\Core\Access;
 
 use Drupal\Component\Utility\Crypt;
+use Drupal\Core\Access\CsrfTokenGenerator;
 use Drupal\Core\Render\BubbleableMetadata;
 use Drupal\Tests\UnitTestCase;
 use Drupal\Core\Access\RouteProcessorCsrf;
@@ -29,7 +30,7 @@ class RouteProcessorCsrfTest extends UnitTestCase {
   protected $processor;
 
   protected function setUp() {
-    $this->csrfToken = $this->getMockBuilder('Drupal\Core\Access\CsrfTokenGenerator')
+    $this->csrfToken = $this->getMockBuilder(CsrfTokenGenerator::class)
       ->disableOriginalConstructor()
       ->getMock();
 
diff --git a/core/tests/Drupal/Tests/Core/Ajax/AjaxCommandsTest.php b/core/tests/Drupal/Tests/Core/Ajax/AjaxCommandsTest.php
index 4db1d02..315c33f 100644
--- a/core/tests/Drupal/Tests/Core/Ajax/AjaxCommandsTest.php
+++ b/core/tests/Drupal/Tests/Core/Ajax/AjaxCommandsTest.php
@@ -21,6 +21,8 @@
 use Drupal\Core\Ajax\SettingsCommand;
 use Drupal\Core\Ajax\CloseDialogCommand;
 use Drupal\Core\Ajax\CloseModalDialogCommand;
+use Drupal\Core\Ajax\OpenDialogCommand;
+use Drupal\Core\Ajax\OpenModalDialogCommand;
 use Drupal\Core\Ajax\SetDialogOptionCommand;
 use Drupal\Core\Ajax\SetDialogTitleCommand;
 use Drupal\Core\Ajax\RedirectCommand;
@@ -293,7 +295,7 @@ public function testSettingsCommand() {
    * @covers \Drupal\Core\Ajax\OpenDialogCommand
    */
   public function testOpenDialogCommand() {
-    $command = $this->getMockBuilder('Drupal\Core\Ajax\OpenDialogCommand')
+    $command = $this->getMockBuilder(OpenDialogCommand::class)
       ->setConstructorArgs([
         '#some-dialog', 'Title', '<p>Text!</p>', [
           'url' => FALSE,
@@ -328,7 +330,7 @@ public function testOpenDialogCommand() {
    * @covers \Drupal\Core\Ajax\OpenModalDialogCommand
    */
   public function testOpenModalDialogCommand() {
-    $command = $this->getMockBuilder('Drupal\Core\Ajax\OpenModalDialogCommand')
+    $command = $this->getMockBuilder(OpenModalDialogCommand::class)
       ->setConstructorArgs([
         'Title', '<p>Text!</p>', [
           'url' => 'example',
diff --git a/core/tests/Drupal/Tests/Core/Ajax/AjaxResponseTest.php b/core/tests/Drupal/Tests/Core/Ajax/AjaxResponseTest.php
index 880aaec..7b948c5 100644
--- a/core/tests/Drupal/Tests/Core/Ajax/AjaxResponseTest.php
+++ b/core/tests/Drupal/Tests/Core/Ajax/AjaxResponseTest.php
@@ -3,7 +3,9 @@
 namespace Drupal\Tests\Core\Ajax;
 
 use Drupal\Core\Ajax\AjaxResponse;
+use Drupal\Core\Ajax\CommandInterface;
 use Drupal\Core\EventSubscriber\AjaxResponseSubscriber;
+use Drupal\Core\Render\AttachmentsResponseProcessorInterface;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
@@ -33,15 +35,15 @@ protected function setUp() {
    * @see \Drupal\Core\Ajax\AjaxResponse::getCommands()
    */
   public function testCommands() {
-    $command_one = $this->getMock('Drupal\Core\Ajax\CommandInterface');
+    $command_one = $this->getMock(CommandInterface::class);
     $command_one->expects($this->once())
       ->method('render')
       ->will($this->returnValue(['command' => 'one']));
-    $command_two = $this->getMock('Drupal\Core\Ajax\CommandInterface');
+    $command_two = $this->getMock(CommandInterface::class);
     $command_two->expects($this->once())
       ->method('render')
       ->will($this->returnValue(['command' => 'two']));
-    $command_three = $this->getMock('Drupal\Core\Ajax\CommandInterface');
+    $command_three = $this->getMock(CommandInterface::class);
     $command_three->expects($this->once())
       ->method('render')
       ->will($this->returnValue(['command' => 'three']));
@@ -78,10 +80,10 @@ public function testPrepareResponseForIeFormRequestsWithFileUpload() {
     $response = new AjaxResponse([]);
     $response->headers->set('Content-Type', 'application/json; charset=utf-8');
 
-    $ajax_response_attachments_processor = $this->getMock('\Drupal\Core\Render\AttachmentsResponseProcessorInterface');
+    $ajax_response_attachments_processor = $this->getMock(AttachmentsResponseProcessorInterface::class);
     $subscriber = new AjaxResponseSubscriber($ajax_response_attachments_processor);
     $event = new FilterResponseEvent(
-      $this->getMock('\Symfony\Component\HttpKernel\HttpKernelInterface'),
+      $this->getMock(HttpKernelInterface::class),
       $request,
       HttpKernelInterface::MASTER_REQUEST,
       $response
diff --git a/core/tests/Drupal/Tests/Core/Asset/AssetResolverTest.php b/core/tests/Drupal/Tests/Core/Asset/AssetResolverTest.php
index 6ed63aa..1ed63d0 100644
--- a/core/tests/Drupal/Tests/Core/Asset/AssetResolverTest.php
+++ b/core/tests/Drupal/Tests/Core/Asset/AssetResolverTest.php
@@ -10,7 +10,14 @@
 use Drupal\Core\Asset\AssetResolver;
 use Drupal\Core\Asset\AttachedAssets;
 use Drupal\Core\Asset\AttachedAssetsInterface;
+use Drupal\Core\Asset\LibraryDependencyResolverInterface;
+use Drupal\Core\Asset\LibraryDiscovery;
 use Drupal\Core\Cache\MemoryBackend;
+use Drupal\Core\Extension\ModuleHandlerInterface;
+use Drupal\Core\Language\LanguageInterface;
+use Drupal\Core\Language\LanguageManagerInterface;
+use Drupal\Core\Theme\ActiveTheme;
+use Drupal\Core\Theme\ThemeManagerInterface;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -74,16 +81,16 @@ class AssetResolverTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $this->libraryDiscovery = $this->getMockBuilder('Drupal\Core\Asset\LibraryDiscovery')
+    $this->libraryDiscovery = $this->getMockBuilder(LibraryDiscovery::class)
       ->disableOriginalConstructor()
       ->getMock();
-    $this->libraryDependencyResolver = $this->getMock('\Drupal\Core\Asset\LibraryDependencyResolverInterface');
+    $this->libraryDependencyResolver = $this->getMock(LibraryDependencyResolverInterface::class);
     $this->libraryDependencyResolver->expects($this->any())
       ->method('getLibrariesWithDependencies')
       ->willReturnArgument(0);
-    $this->moduleHandler = $this->getMock('\Drupal\Core\Extension\ModuleHandlerInterface');
-    $this->themeManager = $this->getMock('\Drupal\Core\Theme\ThemeManagerInterface');
-    $active_theme = $this->getMockBuilder('\Drupal\Core\Theme\ActiveTheme')
+    $this->moduleHandler = $this->getMock(ModuleHandlerInterface::class);
+    $this->themeManager = $this->getMock(ThemeManagerInterface::class);
+    $active_theme = $this->getMockBuilder(ActiveTheme::class)
       ->disableOriginalConstructor()
       ->getMock();
     $active_theme->expects($this->any())
@@ -93,16 +100,16 @@ protected function setUp() {
       ->method('getActiveTheme')
       ->willReturn($active_theme);
 
-    $this->languageManager = $this->getMock('\Drupal\Core\Language\LanguageManagerInterface');
-    $english = $this->getMock('\Drupal\Core\Language\LanguageInterface');
+    $this->languageManager = $this->getMock(LanguageManagerInterface::class);
+    $english = $this->getMock(LanguageInterface::class);
     $english->expects($this->any())
       ->method('getId')
       ->willReturn('en');
-    $japanese = $this->getMock('\Drupal\Core\Language\LanguageInterface');
+    $japanese = $this->getMock(LanguageInterface::class);
     $japanese->expects($this->any())
       ->method('getId')
       ->willReturn('jp');
-    $this->languageManager = $this->getMock('\Drupal\Core\Language\LanguageManagerInterface');
+    $this->languageManager = $this->getMock(LanguageManagerInterface::class);
     $this->languageManager->expects($this->any())
       ->method('getCurrentLanguage')
       ->will($this->onConsecutiveCalls($english, $english, $japanese, $japanese));
diff --git a/core/tests/Drupal/Tests/Core/Asset/CssCollectionRendererUnitTest.php b/core/tests/Drupal/Tests/Core/Asset/CssCollectionRendererUnitTest.php
index c7f1f3d..4640274 100644
--- a/core/tests/Drupal/Tests/Core/Asset/CssCollectionRendererUnitTest.php
+++ b/core/tests/Drupal/Tests/Core/Asset/CssCollectionRendererUnitTest.php
@@ -3,6 +3,7 @@
 namespace Drupal\Tests\Core\Asset;
 
 use Drupal\Core\Asset\CssCollectionRenderer;
+use Drupal\Core\State\StateInterface;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -36,7 +37,7 @@ class CssCollectionRendererUnitTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $this->state = $this->getMock('Drupal\Core\State\StateInterface');
+    $this->state = $this->getMock(StateInterface::class);
 
     $this->renderer = new CssCollectionRenderer($this->state);
     $this->fileCssGroup = [
@@ -453,7 +454,7 @@ public function testRenderInvalidType() {
       ->method('get')
       ->with('system.css_js_query_string')
       ->will($this->returnValue(NULL));
-    $this->setExpectedException('Exception', 'Invalid CSS asset type.');
+    $this->setExpectedException(\Exception::class, 'Invalid CSS asset type.');
 
     $css_group = [
       'group' => 0,
diff --git a/core/tests/Drupal/Tests/Core/Asset/CssOptimizerUnitTest.php b/core/tests/Drupal/Tests/Core/Asset/CssOptimizerUnitTest.php
index 59ddca0e..75690c9 100644
--- a/core/tests/Drupal/Tests/Core/Asset/CssOptimizerUnitTest.php
+++ b/core/tests/Drupal/Tests/Core/Asset/CssOptimizerUnitTest.php
@@ -227,7 +227,7 @@ public function testOptimize($css_asset, $expected) {
    * Tests a file CSS asset with preprocessing disabled.
    */
   public function testTypeFilePreprocessingDisabled() {
-    $this->setExpectedException('Exception', 'Only file CSS assets with preprocessing enabled can be optimized.');
+    $this->setExpectedException(\Exception::class, 'Only file CSS assets with preprocessing enabled can be optimized.');
 
     $css_asset = [
       'group' => -100,
@@ -247,7 +247,7 @@ public function testTypeFilePreprocessingDisabled() {
    * Tests a CSS asset with 'type' => 'external'.
    */
   public function testTypeExternal() {
-    $this->setExpectedException('Exception', 'Only file CSS assets can be optimized.');
+    $this->setExpectedException(\Exception::class, 'Only file CSS assets can be optimized.');
 
     $css_asset = [
       'group' => -100,
diff --git a/core/tests/Drupal/Tests/Core/Asset/LibraryDependencyResolverTest.php b/core/tests/Drupal/Tests/Core/Asset/LibraryDependencyResolverTest.php
index 40e1821..99570c2 100644
--- a/core/tests/Drupal/Tests/Core/Asset/LibraryDependencyResolverTest.php
+++ b/core/tests/Drupal/Tests/Core/Asset/LibraryDependencyResolverTest.php
@@ -3,6 +3,7 @@
 namespace Drupal\Tests\Core\Asset;
 
 use Drupal\Core\Asset\LibraryDependencyResolver;
+use Drupal\Core\Asset\LibraryDiscovery;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -53,7 +54,7 @@ class LibraryDependencyResolverTest extends UnitTestCase {
    * {@inheritdoc}
    */
   protected function setUp() {
-    $this->libraryDiscovery = $this->getMockBuilder('Drupal\Core\Asset\LibraryDiscovery')
+    $this->libraryDiscovery = $this->getMockBuilder(LibraryDiscovery::class)
       ->disableOriginalConstructor()
       ->setMethods(['getLibrariesByExtension'])
       ->getMock();
diff --git a/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryCollectorTest.php b/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryCollectorTest.php
index 2eb34d3..3b7a5d3 100644
--- a/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryCollectorTest.php
+++ b/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryCollectorTest.php
@@ -3,7 +3,12 @@
 namespace Drupal\Tests\Core\Asset;
 
 use Drupal\Core\Asset\LibraryDiscoveryCollector;
+use Drupal\Core\Asset\LibraryDiscoveryParser;
 use Drupal\Core\Cache\Cache;
+use Drupal\Core\Cache\CacheBackendInterface;
+use Drupal\Core\Lock\LockBackendInterface;
+use Drupal\Core\Theme\ActiveTheme;
+use Drupal\Core\Theme\ThemeManagerInterface;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -69,12 +74,12 @@ class LibraryDiscoveryCollectorTest extends UnitTestCase {
    * {@inheritdoc}
    */
   protected function setUp() {
-    $this->cache = $this->getMock('Drupal\Core\Cache\CacheBackendInterface');
-    $this->lock = $this->getMock('Drupal\Core\Lock\LockBackendInterface');
-    $this->themeManager = $this->getMockBuilder('Drupal\Core\Theme\ThemeManagerInterface')
+    $this->cache = $this->getMock(CacheBackendInterface::class);
+    $this->lock = $this->getMock(LockBackendInterface::class);
+    $this->themeManager = $this->getMockBuilder(ThemeManagerInterface::class)
       ->disableOriginalConstructor()
       ->getMock();
-    $this->libraryDiscoveryParser = $this->getMockBuilder('Drupal\Core\Asset\LibraryDiscoveryParser')
+    $this->libraryDiscoveryParser = $this->getMockBuilder(LibraryDiscoveryParser::class)
       ->disableOriginalConstructor()
       ->getMock();
 
@@ -86,7 +91,7 @@ protected function setUp() {
    * @covers ::resolveCacheMiss
    */
   public function testResolveCacheMiss() {
-    $this->activeTheme = $this->getMockBuilder('Drupal\Core\Theme\ActiveTheme')
+    $this->activeTheme = $this->getMockBuilder(ActiveTheme::class)
       ->disableOriginalConstructor()
       ->getMock();
     $this->themeManager->expects($this->exactly(3))
@@ -112,7 +117,7 @@ public function testResolveCacheMiss() {
    * @covers ::destruct
    */
   public function testDestruct() {
-    $this->activeTheme = $this->getMockBuilder('Drupal\Core\Theme\ActiveTheme')
+    $this->activeTheme = $this->getMockBuilder(ActiveTheme::class)
       ->disableOriginalConstructor()
       ->getMock();
     $this->themeManager->expects($this->exactly(3))
diff --git a/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php b/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php
index f65d932..2d61964 100644
--- a/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php
+++ b/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php
@@ -11,6 +11,9 @@
 use Drupal\Core\Asset\Exception\InvalidLibraryFileException;
 use Drupal\Core\Asset\Exception\LibraryDefinitionMissingLicenseException;
 use Drupal\Core\Asset\LibraryDiscoveryParser;
+use Drupal\Core\Extension\ModuleHandlerInterface;
+use Drupal\Core\Theme\ActiveTheme;
+use Drupal\Core\Theme\ThemeManagerInterface;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -60,9 +63,9 @@ class LibraryDiscoveryParserTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $this->moduleHandler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface');
-    $this->themeManager = $this->getMock('Drupal\Core\Theme\ThemeManagerInterface');
-    $mock_active_theme = $this->getMockBuilder('Drupal\Core\Theme\ActiveTheme')
+    $this->moduleHandler = $this->getMock(ModuleHandlerInterface::class);
+    $this->themeManager = $this->getMock(ThemeManagerInterface::class);
+    $mock_active_theme = $this->getMockBuilder(ActiveTheme::class)
       ->disableOriginalConstructor()
       ->getMock();
     $mock_active_theme->expects($this->any())
diff --git a/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryTest.php b/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryTest.php
index 67da06e..f9f108f 100644
--- a/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryTest.php
+++ b/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryTest.php
@@ -3,6 +3,8 @@
 namespace Drupal\Tests\Core\Asset;
 
 use Drupal\Core\Asset\LibraryDiscovery;
+use Drupal\Core\Asset\LibraryDiscoveryCollector;
+use Drupal\Core\Cache\CacheTagsInvalidatorInterface;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -58,8 +60,8 @@ class LibraryDiscoveryTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $this->cacheTagsInvalidator = $this->getMock('Drupal\Core\Cache\CacheTagsInvalidatorInterface');
-    $this->libraryDiscoveryCollector = $this->getMockBuilder('Drupal\Core\Asset\LibraryDiscoveryCollector')
+    $this->cacheTagsInvalidator = $this->getMock(CacheTagsInvalidatorInterface::class);
+    $this->libraryDiscoveryCollector = $this->getMockBuilder(LibraryDiscoveryCollector::class)
       ->disableOriginalConstructor()
       ->getMock();
     $this->libraryDiscovery = new LibraryDiscovery($this->libraryDiscoveryCollector, $this->cacheTagsInvalidator);
diff --git a/core/tests/Drupal/Tests/Core/Authentication/AuthenticationManagerTest.php b/core/tests/Drupal/Tests/Core/Authentication/AuthenticationManagerTest.php
index 315d5d6..a3370cf 100644
--- a/core/tests/Drupal/Tests/Core/Authentication/AuthenticationManagerTest.php
+++ b/core/tests/Drupal/Tests/Core/Authentication/AuthenticationManagerTest.php
@@ -11,6 +11,7 @@
 use Drupal\Core\Authentication\AuthenticationManager;
 use Drupal\Core\Authentication\AuthenticationProviderFilterInterface;
 use Drupal\Core\Authentication\AuthenticationProviderInterface;
+use Drupal\Tests\Core\Authentication\TestAuthenticationProviderInterface;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Cmf\Component\Routing\RouteObjectInterface;
 use Symfony\Component\HttpFoundation\Request;
@@ -29,7 +30,7 @@ class AuthenticationManagerTest extends UnitTestCase {
    * @dataProvider providerTestDefaultFilter
    */
   public function testDefaultFilter($applies, $has_route, $auth_option, $provider_id, $global) {
-    $auth_provider = $this->getMock('Drupal\Core\Authentication\AuthenticationProviderInterface');
+    $auth_provider = $this->getMock(AuthenticationProviderInterface::class);
     $auth_collector = new AuthenticationCollector();
     $auth_collector->addProvider($auth_provider, $provider_id, 0, $global);
     $authentication_manager = new AuthenticationManager($auth_collector);
@@ -50,7 +51,7 @@ public function testDefaultFilter($applies, $has_route, $auth_option, $provider_
    * @covers ::applyFilter
    */
   public function testApplyFilterWithFilterprovider() {
-    $auth_provider = $this->getMock('Drupal\Tests\Core\Authentication\TestAuthenticationProviderInterface');
+    $auth_provider = $this->getMock(TestAuthenticationProviderInterface::class);
     $auth_provider->expects($this->once())
       ->method('appliesToRoutedRequest')
       ->willReturn(TRUE);
diff --git a/core/tests/Drupal/Tests/Core/Block/BlockBaseTest.php b/core/tests/Drupal/Tests/Core/Block/BlockBaseTest.php
index 70bc7f2..fe84718 100644
--- a/core/tests/Drupal/Tests/Core/Block/BlockBaseTest.php
+++ b/core/tests/Drupal/Tests/Core/Block/BlockBaseTest.php
@@ -3,6 +3,8 @@
 namespace Drupal\Tests\Core\Block;
 
 use Drupal\block_test\Plugin\Block\TestBlockInstantiation;
+use Drupal\Core\Extension\ModuleHandlerInterface;
+use Drupal\Core\Transliteration\PhpTransliteration;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -17,8 +19,8 @@ class BlockBaseTest extends UnitTestCase {
    * @see \Drupal\Core\Block\BlockBase::getMachineNameSuggestion()
    */
   public function testGetMachineNameSuggestion() {
-    $module_handler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface');
-    $transliteration = $this->getMockBuilder('Drupal\Core\Transliteration\PhpTransliteration')
+    $module_handler = $this->getMock(ModuleHandlerInterface::class);
+    $transliteration = $this->getMockBuilder(PhpTransliteration::class)
       ->setConstructorArgs([NULL, $module_handler])
       ->setMethods(['readLanguageOverrides'])
       ->getMock();
diff --git a/core/tests/Drupal/Tests/Core/Breadcrumb/BreadcrumbManagerTest.php b/core/tests/Drupal/Tests/Core/Breadcrumb/BreadcrumbManagerTest.php
index aed60a6..b7aa4e3 100644
--- a/core/tests/Drupal/Tests/Core/Breadcrumb/BreadcrumbManagerTest.php
+++ b/core/tests/Drupal/Tests/Core/Breadcrumb/BreadcrumbManagerTest.php
@@ -3,10 +3,13 @@
 namespace Drupal\Tests\Core\Breadcrumb;
 
 use Drupal\Core\Breadcrumb\Breadcrumb;
+use Drupal\Core\Breadcrumb\BreadcrumbBuilderInterface;
 use Drupal\Core\Breadcrumb\BreadcrumbManager;
 use Drupal\Core\Cache\Cache;
 use Drupal\Core\Cache\Context\CacheContextsManager;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
+use Drupal\Core\Extension\ModuleHandlerInterface;
+use Drupal\Core\Routing\RouteMatchInterface;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -47,7 +50,7 @@ class BreadcrumbManagerTest extends UnitTestCase {
    * {@inheritdoc}
    */
   protected function setUp() {
-    $this->moduleHandler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface');
+    $this->moduleHandler = $this->getMock(ModuleHandlerInterface::class);
     $this->breadcrumbManager = new BreadcrumbManager($this->moduleHandler);
     $this->breadcrumb = new Breadcrumb();
 
@@ -63,12 +66,12 @@ protected function setUp() {
    * Tests the breadcrumb manager without any set breadcrumb.
    */
   public function testBuildWithoutBuilder() {
-    $route_match = $this->getMock('Drupal\Core\Routing\RouteMatchInterface');
+    $route_match = $this->getMock(RouteMatchInterface::class);
     $this->moduleHandler->expects($this->once())
       ->method('alter')
       ->with('system_breadcrumb', $this->breadcrumb, $route_match, ['builder' => NULL]);
 
-    $breadcrumb = $this->breadcrumbManager->build($this->getMock('Drupal\Core\Routing\RouteMatchInterface'));
+    $breadcrumb = $this->breadcrumbManager->build($this->getMock(RouteMatchInterface::class));
     $this->assertEquals([], $breadcrumb->getLinks());
     $this->assertEquals([], $breadcrumb->getCacheContexts());
     $this->assertEquals([], $breadcrumb->getCacheTags());
@@ -79,7 +82,7 @@ public function testBuildWithoutBuilder() {
    * Tests the build method with a single breadcrumb builder.
    */
   public function testBuildWithSingleBuilder() {
-    $builder = $this->getMock('Drupal\Core\Breadcrumb\BreadcrumbBuilderInterface');
+    $builder = $this->getMock(BreadcrumbBuilderInterface::class);
     $links = ['<a href="/example">Test</a>'];
     $this->breadcrumb->setLinks($links);
     $this->breadcrumb->addCacheContexts(['foo'])->addCacheTags(['bar']);
@@ -92,7 +95,7 @@ public function testBuildWithSingleBuilder() {
       ->method('build')
       ->willReturn($this->breadcrumb);
 
-    $route_match = $this->getMock('Drupal\Core\Routing\RouteMatchInterface');
+    $route_match = $this->getMock(RouteMatchInterface::class);
     $this->moduleHandler->expects($this->once())
       ->method('alter')
       ->with('system_breadcrumb', $this->breadcrumb, $route_match, ['builder' => $builder]);
@@ -110,13 +113,13 @@ public function testBuildWithSingleBuilder() {
    * Tests multiple breadcrumb builder with different priority.
    */
   public function testBuildWithMultipleApplyingBuilders() {
-    $builder1 = $this->getMock('Drupal\Core\Breadcrumb\BreadcrumbBuilderInterface');
+    $builder1 = $this->getMock(BreadcrumbBuilderInterface::class);
     $builder1->expects($this->never())
       ->method('applies');
     $builder1->expects($this->never())
       ->method('build');
 
-    $builder2 = $this->getMock('Drupal\Core\Breadcrumb\BreadcrumbBuilderInterface');
+    $builder2 = $this->getMock(BreadcrumbBuilderInterface::class);
     $links2 = ['<a href="/example2">Test2</a>'];
     $this->breadcrumb->setLinks($links2);
     $this->breadcrumb->addCacheContexts(['baz'])->addCacheTags(['qux']);
@@ -127,7 +130,7 @@ public function testBuildWithMultipleApplyingBuilders() {
       ->method('build')
       ->willReturn($this->breadcrumb);
 
-    $route_match = $this->getMock('Drupal\Core\Routing\RouteMatchInterface');
+    $route_match = $this->getMock(RouteMatchInterface::class);
 
     $this->moduleHandler->expects($this->once())
       ->method('alter')
@@ -147,14 +150,14 @@ public function testBuildWithMultipleApplyingBuilders() {
    * Tests multiple breadcrumb builders of which one returns NULL.
    */
   public function testBuildWithOneNotApplyingBuilders() {
-    $builder1 = $this->getMock('Drupal\Core\Breadcrumb\BreadcrumbBuilderInterface');
+    $builder1 = $this->getMock(BreadcrumbBuilderInterface::class);
     $builder1->expects($this->once())
       ->method('applies')
       ->will($this->returnValue(FALSE));
     $builder1->expects($this->never())
       ->method('build');
 
-    $builder2 = $this->getMock('Drupal\Core\Breadcrumb\BreadcrumbBuilderInterface');
+    $builder2 = $this->getMock(BreadcrumbBuilderInterface::class);
     $links2 = ['<a href="/example2">Test2</a>'];
     $this->breadcrumb->setLinks($links2);
     $this->breadcrumb->addCacheContexts(['baz'])->addCacheTags(['qux']);
@@ -165,7 +168,7 @@ public function testBuildWithOneNotApplyingBuilders() {
       ->method('build')
       ->willReturn($this->breadcrumb);
 
-    $route_match = $this->getMock('Drupal\Core\Routing\RouteMatchInterface');
+    $route_match = $this->getMock(RouteMatchInterface::class);
 
     $this->moduleHandler->expects($this->once())
       ->method('alter')
@@ -185,7 +188,7 @@ public function testBuildWithOneNotApplyingBuilders() {
    * Tests a breadcrumb builder with a bad return value.
    */
   public function testBuildWithInvalidBreadcrumbResult() {
-    $builder = $this->getMock('Drupal\Core\Breadcrumb\BreadcrumbBuilderInterface');
+    $builder = $this->getMock(BreadcrumbBuilderInterface::class);
     $builder->expects($this->once())
       ->method('applies')
       ->will($this->returnValue(TRUE));
@@ -195,7 +198,7 @@ public function testBuildWithInvalidBreadcrumbResult() {
 
     $this->breadcrumbManager->addBuilder($builder, 0);
     $this->setExpectedException(\UnexpectedValueException::class);
-    $this->breadcrumbManager->build($this->getMock('Drupal\Core\Routing\RouteMatchInterface'));
+    $this->breadcrumbManager->build($this->getMock(RouteMatchInterface::class));
   }
 
 }
diff --git a/core/tests/Drupal/Tests/Core/Cache/BackendChainImplementationUnitTest.php b/core/tests/Drupal/Tests/Core/Cache/BackendChainImplementationUnitTest.php
index ad51768..77df992 100644
--- a/core/tests/Drupal/Tests/Core/Cache/BackendChainImplementationUnitTest.php
+++ b/core/tests/Drupal/Tests/Core/Cache/BackendChainImplementationUnitTest.php
@@ -4,6 +4,7 @@
 
 use Drupal\Core\Cache\BackendChain;
 use Drupal\Core\Cache\Cache;
+use Drupal\Core\Cache\CacheBackendInterface;
 use Drupal\Core\Cache\MemoryBackend;
 use Drupal\Tests\UnitTestCase;
 
@@ -290,7 +291,7 @@ public function testDeleteTagsPropagation() {
   public function testRemoveBin() {
     $chain = new BackendChain('foo');
     for ($i = 0; $i < 3; $i++) {
-      $backend = $this->getMock('Drupal\Core\Cache\CacheBackendInterface');
+      $backend = $this->getMock(CacheBackendInterface::class);
       $backend->expects($this->once())->method('removeBin');
       $chain->appendBackend($backend);
     }
diff --git a/core/tests/Drupal/Tests/Core/Cache/CacheCollectorTest.php b/core/tests/Drupal/Tests/Core/Cache/CacheCollectorTest.php
index 1ff6629..c586281 100644
--- a/core/tests/Drupal/Tests/Core/Cache/CacheCollectorTest.php
+++ b/core/tests/Drupal/Tests/Core/Cache/CacheCollectorTest.php
@@ -3,6 +3,9 @@
 namespace Drupal\Tests\Core\Cache;
 
 use Drupal\Core\Cache\Cache;
+use Drupal\Core\Cache\CacheBackendInterface;
+use Drupal\Core\Cache\CacheTagsInvalidatorInterface;
+use Drupal\Core\Lock\LockBackendInterface;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -50,9 +53,9 @@ class CacheCollectorTest extends UnitTestCase {
    * {@inheritdoc}
    */
   protected function setUp() {
-    $this->cacheBackend = $this->getMock('Drupal\Core\Cache\CacheBackendInterface');
-    $this->cacheTagsInvalidator = $this->getMock('Drupal\Core\Cache\CacheTagsInvalidatorInterface');
-    $this->lock = $this->getMock('Drupal\Core\Lock\LockBackendInterface');
+    $this->cacheBackend = $this->getMock(CacheBackendInterface::class);
+    $this->cacheTagsInvalidator = $this->getMock(CacheTagsInvalidatorInterface::class);
+    $this->lock = $this->getMock(LockBackendInterface::class);
     $this->cid = $this->randomMachineName();
     $this->collector = new CacheCollectorHelper($this->cid, $this->cacheBackend, $this->lock);
 
diff --git a/core/tests/Drupal/Tests/Core/Cache/CacheFactoryTest.php b/core/tests/Drupal/Tests/Core/Cache/CacheFactoryTest.php
index 0c43bb2..45e3506 100644
--- a/core/tests/Drupal/Tests/Core/Cache/CacheFactoryTest.php
+++ b/core/tests/Drupal/Tests/Core/Cache/CacheFactoryTest.php
@@ -2,8 +2,10 @@
 
 namespace Drupal\Tests\Core\Cache;
 
+use Drupal\Core\Cache\CacheBackendInterface;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
 use Drupal\Core\Cache\CacheFactory;
+use Drupal\Core\Cache\CacheFactoryInterface;
 use Drupal\Core\Site\Settings;
 use Drupal\Tests\UnitTestCase;
 
@@ -26,10 +28,10 @@ public function testCacheFactoryWithDefaultSettings() {
     $container = new ContainerBuilder();
     $cache_factory->setContainer($container);
 
-    $builtin_default_backend_factory = $this->getMock('\Drupal\Core\Cache\CacheFactoryInterface');
+    $builtin_default_backend_factory = $this->getMock(CacheFactoryInterface::class);
     $container->set('cache.backend.database', $builtin_default_backend_factory);
 
-    $render_bin = $this->getMock('\Drupal\Core\Cache\CacheBackendInterface');
+    $render_bin = $this->getMock(CacheBackendInterface::class);
     $builtin_default_backend_factory->expects($this->once())
       ->method('get')
       ->with('render')
@@ -56,10 +58,10 @@ public function testCacheFactoryWithCustomizedDefaultBackend() {
     $container = new ContainerBuilder();
     $cache_factory->setContainer($container);
 
-    $custom_default_backend_factory = $this->getMock('\Drupal\Core\Cache\CacheFactoryInterface');
+    $custom_default_backend_factory = $this->getMock(CacheFactoryInterface::class);
     $container->set('cache.backend.custom', $custom_default_backend_factory);
 
-    $render_bin = $this->getMock('\Drupal\Core\Cache\CacheBackendInterface');
+    $render_bin = $this->getMock(CacheBackendInterface::class);
     $custom_default_backend_factory->expects($this->once())
       ->method('get')
       ->with('render')
@@ -92,10 +94,10 @@ public function testCacheFactoryWithDefaultBinBackend() {
     $container = new ContainerBuilder();
     $cache_factory->setContainer($container);
 
-    $custom_default_backend_factory = $this->getMock('\Drupal\Core\Cache\CacheFactoryInterface');
+    $custom_default_backend_factory = $this->getMock(CacheFactoryInterface::class);
     $container->set('cache.backend.custom', $custom_default_backend_factory);
 
-    $render_bin = $this->getMock('\Drupal\Core\Cache\CacheBackendInterface');
+    $render_bin = $this->getMock(CacheBackendInterface::class);
     $custom_default_backend_factory->expects($this->once())
       ->method('get')
       ->with('render')
@@ -132,10 +134,10 @@ public function testCacheFactoryWithSpecifiedPerBinBackend() {
     $container = new ContainerBuilder();
     $cache_factory->setContainer($container);
 
-    $custom_render_backend_factory = $this->getMock('\Drupal\Core\Cache\CacheFactoryInterface');
+    $custom_render_backend_factory = $this->getMock(CacheFactoryInterface::class);
     $container->set('cache.backend.custom', $custom_render_backend_factory);
 
-    $render_bin = $this->getMock('\Drupal\Core\Cache\CacheBackendInterface');
+    $render_bin = $this->getMock(CacheBackendInterface::class);
     $custom_render_backend_factory->expects($this->once())
       ->method('get')
       ->with('render')
diff --git a/core/tests/Drupal/Tests/Core/Cache/CacheTagsInvalidatorTest.php b/core/tests/Drupal/Tests/Core/Cache/CacheTagsInvalidatorTest.php
index 5466a09..1a44683 100644
--- a/core/tests/Drupal/Tests/Core/Cache/CacheTagsInvalidatorTest.php
+++ b/core/tests/Drupal/Tests/Core/Cache/CacheTagsInvalidatorTest.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\Tests\Core\Cache;
 
+use Drupal\Core\Cache\CacheBackendInterface;
 use Drupal\Core\Cache\CacheTagsInvalidator;
 use Drupal\Core\DependencyInjection\Container;
 use Drupal\Tests\UnitTestCase;
@@ -31,7 +32,7 @@ public function testInvalidateTags() {
     // This does not actually implement,
     // \Drupal\Cache\Cache\CacheBackendInterface but we can not mock from two
     // interfaces, we would need a test class for that.
-    $invalidator_cache_bin = $this->getMock('\Drupal\Core\Cache\CacheTagsInvalidator');
+    $invalidator_cache_bin = $this->getMock(CacheTagsInvalidator::class);
     $invalidator_cache_bin->expects($this->once())
       ->method('invalidateTags')
       ->with(['node:1']);
@@ -39,7 +40,7 @@ public function testInvalidateTags() {
     // We do not have to define that invalidateTags() is never called as the
     // interface does not define that method, trying to call it would result in
     // a fatal error.
-    $non_invalidator_cache_bin = $this->getMock('\Drupal\Core\Cache\CacheBackendInterface');
+    $non_invalidator_cache_bin = $this->getMock(CacheBackendInterface::class);
 
     $container = new Container();
     $container->set('cache.invalidator_cache_bin', $invalidator_cache_bin);
@@ -47,7 +48,7 @@ public function testInvalidateTags() {
     $container->setParameter('cache_bins', ['cache.invalidator_cache_bin' => 'invalidator_cache_bin', 'cache.non_invalidator_cache_bin' => 'non_invalidator_cache_bin']);
     $cache_tags_invalidator->setContainer($container);
 
-    $invalidator = $this->getMock('\Drupal\Core\Cache\CacheTagsInvalidator');
+    $invalidator = $this->getMock(CacheTagsInvalidator::class);
     $invalidator->expects($this->once())
       ->method('invalidateTags')
       ->with(['node:1']);
diff --git a/core/tests/Drupal/Tests/Core/Cache/CacheTest.php b/core/tests/Drupal/Tests/Core/Cache/CacheTest.php
index 446afcd..ecbcf2b 100644
--- a/core/tests/Drupal/Tests/Core/Cache/CacheTest.php
+++ b/core/tests/Drupal/Tests/Core/Cache/CacheTest.php
@@ -47,7 +47,7 @@ public function validateTagsProvider() {
    */
   public function testValidateTags(array $tags, $expected_exception_message) {
     if ($expected_exception_message !== FALSE) {
-      $this->setExpectedException('LogicException', $expected_exception_message);
+      $this->setExpectedException(\LogicException::class, $expected_exception_message);
     }
     // If it doesn't throw an exception, validateTags() returns NULL.
     $this->assertNull(Cache::validateTags($tags));
diff --git a/core/tests/Drupal/Tests/Core/Cache/CacheableMetadataTest.php b/core/tests/Drupal/Tests/Core/Cache/CacheableMetadataTest.php
index 5eecf1c..e445f58 100644
--- a/core/tests/Drupal/Tests/Core/Cache/CacheableMetadataTest.php
+++ b/core/tests/Drupal/Tests/Core/Cache/CacheableMetadataTest.php
@@ -4,6 +4,7 @@
 
 use Drupal\Core\Cache\Cache;
 use Drupal\Core\Cache\CacheableMetadata;
+use Drupal\Core\Cache\Context\CacheContextsManager;
 use Drupal\Tests\Core\Render\TestCacheableDependency;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -26,7 +27,7 @@ class CacheableMetadataTest extends UnitTestCase {
    * @see \Drupal\Tests\Core\Cache\CacheContextsTest
    */
   public function testMerge(CacheableMetadata $a, CacheableMetadata $b, CacheableMetadata $expected) {
-    $cache_contexts_manager = $this->getMockBuilder('Drupal\Core\Cache\Context\CacheContextsManager')
+    $cache_contexts_manager = $this->getMockBuilder(CacheContextsManager::class)
       ->disableOriginalConstructor()
       ->getMock();
     $cache_contexts_manager->method('assertValidTokens')->willReturn(TRUE);
@@ -50,7 +51,7 @@ public function testMerge(CacheableMetadata $a, CacheableMetadata $b, CacheableM
    * @see \Drupal\Tests\Core\Cache\CacheContextsTest
    */
   public function testAddCacheableDependency(CacheableMetadata $a, CacheableMetadata $b, CacheableMetadata $expected) {
-    $cache_contexts_manager = $this->getMockBuilder('Drupal\Core\Cache\Context\CacheContextsManager')
+    $cache_contexts_manager = $this->getMockBuilder(CacheContextsManager::class)
       ->disableOriginalConstructor()
       ->getMock();
     $cache_contexts_manager->method('assertValidTokens')->willReturn(TRUE);
@@ -111,7 +112,7 @@ public function testAddCacheTags() {
   public function testSetCacheMaxAge($data, $expect_exception) {
     $metadata = new CacheableMetadata();
     if ($expect_exception) {
-      $this->setExpectedException('\InvalidArgumentException');
+      $this->setExpectedException(\InvalidArgumentException::class);
     }
     $metadata->setCacheMaxAge($data);
     $this->assertEquals($data, $metadata->getCacheMaxAge());
diff --git a/core/tests/Drupal/Tests/Core/Cache/ChainedFastBackendTest.php b/core/tests/Drupal/Tests/Core/Cache/ChainedFastBackendTest.php
index 52f1851..64f9743 100644
--- a/core/tests/Drupal/Tests/Core/Cache/ChainedFastBackendTest.php
+++ b/core/tests/Drupal/Tests/Core/Cache/ChainedFastBackendTest.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\Tests\Core\Cache;
 
+use Drupal\Core\Cache\CacheBackendInterface;
 use Drupal\Core\Cache\ChainedFastBackend;
 use Drupal\Core\Cache\MemoryBackend;
 use Drupal\Tests\UnitTestCase;
@@ -37,7 +38,7 @@ class ChainedFastBackendTest extends UnitTestCase {
    * Tests a get() on the fast backend, with no hit on the consistent backend.
    */
   public function testGetDoesntHitConsistentBackend() {
-    $consistent_cache = $this->getMock('Drupal\Core\Cache\CacheBackendInterface');
+    $consistent_cache = $this->getMock(CacheBackendInterface::class);
     $timestamp_cid = ChainedFastBackend::LAST_WRITE_TIMESTAMP_PREFIX . 'cache_foo';
     // Use the request time because that is what we will be comparing against.
     $timestamp_item = (object) ['cid' => $timestamp_cid, 'data' => (int) $_SERVER['REQUEST_TIME'] - 60];
@@ -74,8 +75,8 @@ public function testFallThroughToConsistentCache() {
       'tags' => ['tag'],
     ];
 
-    $consistent_cache = $this->getMock('Drupal\Core\Cache\CacheBackendInterface');
-    $fast_cache = $this->getMock('Drupal\Core\Cache\CacheBackendInterface');
+    $consistent_cache = $this->getMock(CacheBackendInterface::class);
+    $fast_cache = $this->getMock(CacheBackendInterface::class);
 
     // We should get a call for the timestamp on the consistent backend.
     $consistent_cache->expects($this->once())
diff --git a/core/tests/Drupal/Tests/Core/Cache/Context/CacheContextsManagerTest.php b/core/tests/Drupal/Tests/Core/Cache/Context/CacheContextsManagerTest.php
index f89e639..cd15313 100644
--- a/core/tests/Drupal/Tests/Core/Cache/Context/CacheContextsManagerTest.php
+++ b/core/tests/Drupal/Tests/Core/Cache/Context/CacheContextsManagerTest.php
@@ -11,6 +11,7 @@
 use Drupal\Core\Cache\Context\CacheContextsManager;
 use Drupal\Core\Cache\Context\CacheContextInterface;
 use Drupal\Core\Cache\Context\CalculatedCacheContextInterface;
+use Drupal\Core\DependencyInjection\Container;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\DependencyInjection\Container;
@@ -27,7 +28,7 @@ class CacheContextsManagerTest extends UnitTestCase {
    * @dataProvider providerTestOptimizeTokens
    */
   public function testOptimizeTokens(array $context_tokens, array $optimized_context_tokens) {
-    $container = $this->getMockBuilder('Drupal\Core\DependencyInjection\Container')
+    $container = $this->getMockBuilder(Container::class)
       ->disableOriginalConstructor()
       ->getMock();
     $container->expects($this->any())
@@ -156,7 +157,7 @@ protected function getContextsFixture() {
   }
 
   protected function getMockContainer() {
-    $container = $this->getMockBuilder('Drupal\Core\DependencyInjection\Container')
+    $container = $this->getMockBuilder(Container::class)
       ->disableOriginalConstructor()
       ->getMock();
     $container->expects($this->any())
@@ -209,7 +210,7 @@ public function testValidateContexts(array $contexts, $expected_exception_messag
     $container = new ContainerBuilder();
     $cache_contexts_manager = new CacheContextsManager($container, ['foo', 'foo.bar', 'baz']);
     if ($expected_exception_message !== FALSE) {
-      $this->setExpectedException('LogicException', $expected_exception_message);
+      $this->setExpectedException(\LogicException::class, $expected_exception_message);
     }
     // If it doesn't throw an exception, validateTokens() returns NULL.
     $this->assertNull($cache_contexts_manager->validateTokens($contexts));
diff --git a/core/tests/Drupal/Tests/Core/Cache/Context/SessionCacheContextTest.php b/core/tests/Drupal/Tests/Core/Cache/Context/SessionCacheContextTest.php
index 9538bd2..03f147f 100644
--- a/core/tests/Drupal/Tests/Core/Cache/Context/SessionCacheContextTest.php
+++ b/core/tests/Drupal/Tests/Core/Cache/Context/SessionCacheContextTest.php
@@ -6,6 +6,7 @@
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpFoundation\RequestStack;
+use Symfony\Component\HttpFoundation\Session\SessionInterface;
 
 /**
  * @coversDefaultClass \Drupal\Core\Cache\Context\SessionCacheContext
@@ -40,7 +41,7 @@ public function setUp() {
     $this->requestStack = new RequestStack();
     $this->requestStack->push($request);
 
-    $this->session = $this->getMock('\Symfony\Component\HttpFoundation\Session\SessionInterface');
+    $this->session = $this->getMock(SessionInterface::class);
     $request->setSession($this->session);
 
     $this->cacheContext = new SessionCacheContext($this->requestStack);
diff --git a/core/tests/Drupal/Tests/Core/Condition/ConditionAccessResolverTraitTest.php b/core/tests/Drupal/Tests/Core/Condition/ConditionAccessResolverTraitTest.php
index f0da231..1d73ba9 100644
--- a/core/tests/Drupal/Tests/Core/Condition/ConditionAccessResolverTraitTest.php
+++ b/core/tests/Drupal/Tests/Core/Condition/ConditionAccessResolverTraitTest.php
@@ -8,6 +8,7 @@
 namespace Drupal\Tests\Core\Condition;
 
 use Drupal\Component\Plugin\Exception\ContextException;
+use Drupal\Core\Condition\ConditionInterface;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -31,22 +32,22 @@ public function testResolveConditions($conditions, $logic, $expected) {
   public function providerTestResolveConditions() {
     $data = [];
 
-    $condition_true = $this->getMock('Drupal\Core\Condition\ConditionInterface');
+    $condition_true = $this->getMock(ConditionInterface::class);
     $condition_true->expects($this->any())
       ->method('execute')
       ->will($this->returnValue(TRUE));
-    $condition_false = $this->getMock('Drupal\Core\Condition\ConditionInterface');
+    $condition_false = $this->getMock(ConditionInterface::class);
     $condition_false->expects($this->any())
       ->method('execute')
       ->will($this->returnValue(FALSE));
-    $condition_exception = $this->getMock('Drupal\Core\Condition\ConditionInterface');
+    $condition_exception = $this->getMock(ConditionInterface::class);
     $condition_exception->expects($this->any())
       ->method('execute')
       ->will($this->throwException(new ContextException()));
     $condition_exception->expects($this->atLeastOnce())
       ->method('isNegated')
       ->will($this->returnValue(FALSE));
-    $condition_negated = $this->getMock('Drupal\Core\Condition\ConditionInterface');
+    $condition_negated = $this->getMock(ConditionInterface::class);
     $condition_negated->expects($this->any())
       ->method('execute')
       ->will($this->throwException(new ContextException()));
diff --git a/core/tests/Drupal/Tests/Core/Config/CachedStorageTest.php b/core/tests/Drupal/Tests/Core/Config/CachedStorageTest.php
index c39efd6..a83921c 100644
--- a/core/tests/Drupal/Tests/Core/Config/CachedStorageTest.php
+++ b/core/tests/Drupal/Tests/Core/Config/CachedStorageTest.php
@@ -4,6 +4,7 @@
 
 use Drupal\Tests\UnitTestCase;
 use Drupal\Core\Config\CachedStorage;
+use Drupal\Core\Config\StorageInterface;
 use Drupal\Core\Cache\NullBackend;
 
 /**
@@ -23,7 +24,7 @@ class CachedStorageTest extends UnitTestCase {
    */
   public function testListAllStaticCache() {
     $prefix = __FUNCTION__;
-    $storage = $this->getMock('Drupal\Core\Config\StorageInterface');
+    $storage = $this->getMock(StorageInterface::class);
 
     $response = ["$prefix." . $this->randomMachineName(), "$prefix." . $this->randomMachineName()];
     $storage->expects($this->once())
diff --git a/core/tests/Drupal/Tests/Core/Config/ConfigFactoryTest.php b/core/tests/Drupal/Tests/Core/Config/ConfigFactoryTest.php
index 3c7cac1..6b41ae1 100644
--- a/core/tests/Drupal/Tests/Core/Config/ConfigFactoryTest.php
+++ b/core/tests/Drupal/Tests/Core/Config/ConfigFactoryTest.php
@@ -2,10 +2,14 @@
 
 namespace Drupal\Tests\Core\Config;
 
+use Drupal\Core\Cache\CacheTagsInvalidatorInterface;
 use Drupal\Core\Config\Config;
 use Drupal\Core\Config\ConfigFactory;
+use Drupal\Core\Config\StorageInterface;
+use Drupal\Core\Config\TypedConfigManagerInterface;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\DependencyInjection\ContainerBuilder;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 
 /**
  * @group Config
@@ -52,12 +56,12 @@ class ConfigFactoryTest extends UnitTestCase {
    * {@inheritdoc}
    */
   protected function setUp() {
-    $this->storage = $this->getMock('Drupal\Core\Config\StorageInterface');
-    $this->eventDispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
-    $this->typedConfig = $this->getMock('\Drupal\Core\Config\TypedConfigManagerInterface');
+    $this->storage = $this->getMock(StorageInterface::class);
+    $this->eventDispatcher = $this->getMock(EventDispatcherInterface::class);
+    $this->typedConfig = $this->getMock(TypedConfigManagerInterface::class);
     $this->configFactory = new ConfigFactory($this->storage, $this->eventDispatcher, $this->typedConfig);
 
-    $this->cacheTagsInvalidator = $this->getMock('Drupal\Core\Cache\CacheTagsInvalidatorInterface');
+    $this->cacheTagsInvalidator = $this->getMock(CacheTagsInvalidatorInterface::class);
 
     $container = new ContainerBuilder();
     $container->set('cache_tags.invalidator', $this->cacheTagsInvalidator);
diff --git a/core/tests/Drupal/Tests/Core/Config/ConfigTest.php b/core/tests/Drupal/Tests/Core/Config/ConfigTest.php
index 41c3e93..2dd7857 100644
--- a/core/tests/Drupal/Tests/Core/Config/ConfigTest.php
+++ b/core/tests/Drupal/Tests/Core/Config/ConfigTest.php
@@ -2,11 +2,16 @@
 
 namespace Drupal\Tests\Core\Config;
 
+use Drupal\Core\Cache\CacheTagsInvalidatorInterface;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
 use Drupal\Core\Render\Markup;
 use Drupal\Tests\UnitTestCase;
 use Drupal\Core\Config\Config;
+use Drupal\Core\Config\ConfigNameException;
 use Drupal\Core\Config\ConfigValueException;
+use Drupal\Core\Config\StorageInterface;
+use Drupal\Core\Config\TypedConfigManagerInterface;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 
 /**
  * Tests the Config.
@@ -55,11 +60,11 @@ class ConfigTest extends UnitTestCase {
   protected $cacheTagsInvalidator;
 
   protected function setUp() {
-    $this->storage = $this->getMock('Drupal\Core\Config\StorageInterface');
-    $this->eventDispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
-    $this->typedConfig = $this->getMock('\Drupal\Core\Config\TypedConfigManagerInterface');
+    $this->storage = $this->getMock(StorageInterface::class);
+    $this->eventDispatcher = $this->getMock(EventDispatcherInterface::class);
+    $this->typedConfig = $this->getMock(TypedConfigManagerInterface::class);
     $this->config = new Config('config.test', $this->storage, $this->eventDispatcher, $this->typedConfig);
-    $this->cacheTagsInvalidator = $this->getMock('Drupal\Core\Cache\CacheTagsInvalidatorInterface');
+    $this->cacheTagsInvalidator = $this->getMock(CacheTagsInvalidatorInterface::class);
 
     $container = new ContainerBuilder();
     $container->set('cache_tags.invalidator', $this->cacheTagsInvalidator);
@@ -387,7 +392,7 @@ public function mergeDataProvider() {
    * @dataProvider validateNameProvider
    */
   public function testValidateNameException($name, $exception_message) {
-    $this->setExpectedException('\Drupal\Core\Config\ConfigNameException', $exception_message);
+    $this->setExpectedException(ConfigNameException::class, $exception_message);
     $this->config->validateName($name);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php
index 0a5d3d3..cd9e412 100644
--- a/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php
+++ b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php
@@ -8,9 +8,19 @@
 namespace Drupal\Tests\Core\Config\Entity;
 
 use Drupal\Component\Plugin\PluginManagerInterface;
+use Drupal\Component\Uuid\UuidInterface;
+use Drupal\Core\Cache\CacheTagsInvalidatorInterface;
+use Drupal\Core\Config\Entity\ConfigEntityBase;
+use Drupal\Core\Config\Entity\ConfigEntityInterface;
+use Drupal\Core\Config\Entity\ConfigEntityStorageInterface;
+use Drupal\Core\Config\TypedConfigManagerInterface;
+use Drupal\Core\Config\Entity\ConfigEntityTypeInterface;
 use Drupal\Core\Config\Schema\SchemaIncompleteException;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Entity\Query\QueryInterface;
 use Drupal\Core\Language\Language;
+use Drupal\Core\Language\LanguageManagerInterface;
 use Drupal\Core\Plugin\DefaultLazyPluginCollection;
 use Drupal\Tests\Core\Config\Entity\Fixtures\ConfigEntityBaseWithPluginCollections;
 use Drupal\Tests\Core\Plugin\Fixtures\TestConfigurablePlugin;
@@ -104,7 +114,7 @@ protected function setUp() {
     ];
     $this->entityTypeId = $this->randomMachineName();
     $this->provider = $this->randomMachineName();
-    $this->entityType = $this->getMock('\Drupal\Core\Config\Entity\ConfigEntityTypeInterface');
+    $this->entityType = $this->getMock(ConfigEntityTypeInterface::class);
     $this->entityType->expects($this->any())
       ->method('getProvider')
       ->will($this->returnValue($this->provider));
@@ -112,23 +122,23 @@ protected function setUp() {
       ->method('getConfigPrefix')
       ->willReturn('test_provider.' . $this->entityTypeId);
 
-    $this->entityManager = $this->getMock('\Drupal\Core\Entity\EntityManagerInterface');
+    $this->entityManager = $this->getMock(EntityManagerInterface::class);
     $this->entityManager->expects($this->any())
       ->method('getDefinition')
       ->with($this->entityTypeId)
       ->will($this->returnValue($this->entityType));
 
-    $this->uuid = $this->getMock('\Drupal\Component\Uuid\UuidInterface');
+    $this->uuid = $this->getMock(UuidInterface::class);
 
-    $this->languageManager = $this->getMock('\Drupal\Core\Language\LanguageManagerInterface');
+    $this->languageManager = $this->getMock(LanguageManagerInterface::class);
     $this->languageManager->expects($this->any())
       ->method('getLanguage')
       ->with('en')
       ->will($this->returnValue(new Language(['id' => 'en'])));
 
-    $this->cacheTagsInvalidator = $this->getMock('Drupal\Core\Cache\CacheTagsInvalidatorInterface');
+    $this->cacheTagsInvalidator = $this->getMock(CacheTagsInvalidatorInterface::class);
 
-    $this->typedConfigManager = $this->getMock('Drupal\Core\Config\TypedConfigManagerInterface');
+    $this->typedConfigManager = $this->getMock(TypedConfigManagerInterface::class);
 
     $container = new ContainerBuilder();
     $container->set('entity.manager', $this->entityManager);
@@ -138,7 +148,7 @@ protected function setUp() {
     $container->set('config.typed', $this->typedConfigManager);
     \Drupal::setContainer($container);
 
-    $this->entity = $this->getMockForAbstractClass('\Drupal\Core\Config\Entity\ConfigEntityBase', [$values, $this->entityTypeId]);
+    $this->entity = $this->getMockForAbstractClass(ConfigEntityBase::class, [$values, $this->entityTypeId]);
   }
 
   /**
@@ -162,8 +172,8 @@ public function testCalculateDependencies() {
    * @covers ::preSave
    */
   public function testPreSaveDuringSync() {
-    $query = $this->getMock('\Drupal\Core\Entity\Query\QueryInterface');
-    $storage = $this->getMock('\Drupal\Core\Config\Entity\ConfigEntityStorageInterface');
+    $query = $this->getMock(QueryInterface::class);
+    $storage = $this->getMock(ConfigEntityStorageInterface::class);
 
     $query->expects($this->any())
       ->method('execute')
@@ -224,7 +234,7 @@ public function testAddDependency() {
    */
   public function testCalculateDependenciesWithPluginCollections($definition, $expected_dependencies) {
     $values = [];
-    $this->entity = $this->getMockBuilder('\Drupal\Tests\Core\Config\Entity\Fixtures\ConfigEntityBaseWithPluginCollections')
+    $this->entity = $this->getMockBuilder(ConfigEntityBaseWithPluginCollections::class)
       ->setConstructorArgs([$values, $this->entityTypeId])
       ->setMethods(['getPluginCollections'])
       ->getMock();
@@ -234,7 +244,7 @@ public function testCalculateDependenciesWithPluginCollections($definition, $exp
     $instance = new TestConfigurablePlugin([], $instance_id, $definition);
 
     // Create a plugin collection to contain the instance.
-    $pluginCollection = $this->getMockBuilder('\Drupal\Core\Plugin\DefaultLazyPluginCollection')
+    $pluginCollection = $this->getMockBuilder(DefaultLazyPluginCollection::class)
       ->disableOriginalConstructor()
       ->setMethods(['get'])
       ->getMock();
@@ -298,7 +308,7 @@ public function providerCalculateDependenciesWithPluginCollections() {
    * @covers ::onDependencyRemoval
    */
   public function testCalculateDependenciesWithThirdPartySettings() {
-    $this->entity = $this->getMockForAbstractClass('\Drupal\Core\Config\Entity\ConfigEntityBase', [[], $this->entityTypeId]);
+    $this->entity = $this->getMockForAbstractClass(ConfigEntityBase::class, [[], $this->entityTypeId]);
     $this->entity->setThirdPartySetting('test_provider', 'test', 'test');
     $this->entity->setThirdPartySetting('test_provider2', 'test', 'test');
     $this->entity->setThirdPartySetting($this->provider, 'test', 'test');
@@ -477,11 +487,11 @@ public function testSort() {
         ],
       ]));
 
-    $entity_a = $this->getMock('\Drupal\Core\Config\Entity\ConfigEntityInterface');
+    $entity_a = $this->getMock(ConfigEntityInterface::class);
     $entity_a->expects($this->atLeastOnce())
       ->method('label')
       ->willReturn('foo');
-    $entity_b = $this->getMock('\Drupal\Core\Config\Entity\ConfigEntityInterface');
+    $entity_b = $this->getMock(ConfigEntityInterface::class);
     $entity_b->expects($this->atLeastOnce())
       ->method('label')
       ->willReturn('bar');
@@ -529,7 +539,7 @@ public function testToArray() {
    * @covers ::toArray
    */
   public function testToArrayIdKey() {
-    $entity = $this->getMockForAbstractClass('\Drupal\Core\Config\Entity\ConfigEntityBase', [[], $this->entityTypeId], '', TRUE, TRUE, TRUE, ['id', 'get']);
+    $entity = $this->getMockForAbstractClass(ConfigEntityBase::class, [[], $this->entityTypeId], '', TRUE, TRUE, TRUE, ['id', 'get']);
     $entity->expects($this->atLeastOnce())
       ->method('id')
       ->willReturn($this->id);
diff --git a/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityTypeTest.php b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityTypeTest.php
index 914d4f6..aa6bf26 100644
--- a/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityTypeTest.php
+++ b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityTypeTest.php
@@ -3,6 +3,7 @@
 namespace Drupal\Tests\Core\Config\Entity;
 
 use Drupal\Tests\UnitTestCase;
+use Drupal\Core\Config\ConfigPrefixLengthException;
 use Drupal\Core\Config\Entity\ConfigEntityType;
 use Drupal\Core\Config\Entity\Exception\ConfigEntityStorageClassException;
 
@@ -44,7 +45,7 @@ public function testConfigPrefixLengthExceeds() {
     ];
     $config_entity = $this->setUpConfigEntityType($definition);
     $this->setExpectedException(
-      '\Drupal\Core\Config\ConfigPrefixLengthException',
+      ConfigPrefixLengthException::class,
       "The configuration file name prefix {$definition['provider']}.{$definition['config_prefix']} exceeds the maximum character limit of " . ConfigEntityType::PREFIX_LENGTH
     );
     $this->assertEmpty($config_entity->getConfigPrefix());
diff --git a/core/tests/Drupal/Tests/Core/Config/Entity/EntityDisplayBaseTest.php b/core/tests/Drupal/Tests/Core/Config/Entity/EntityDisplayBaseTest.php
index 8dd7e77..a1a0898 100644
--- a/core/tests/Drupal/Tests/Core/Config/Entity/EntityDisplayBaseTest.php
+++ b/core/tests/Drupal/Tests/Core/Config/Entity/EntityDisplayBaseTest.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\Tests\Core\Config\Entity;
 
+use Drupal\Core\Entity\EntityDisplayBase;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -15,7 +16,7 @@ class EntityDisplayBaseTest extends UnitTestCase {
    * @covers ::getTargetEntityTypeId
    */
   public function testGetTargetEntityTypeId() {
-    $mock = $this->getMockForAbstractClass('\Drupal\Core\Entity\EntityDisplayBase', [], '', FALSE);
+    $mock = $this->getMockForAbstractClass(EntityDisplayBase::class, [], '', FALSE);
     $reflection = new \ReflectionProperty($mock, 'targetEntityType');
     $reflection->setAccessible(TRUE);
     $reflection->setValue($mock, 'test');
@@ -26,7 +27,7 @@ public function testGetTargetEntityTypeId() {
    * @covers ::getMode
    */
   public function testGetMode() {
-    $mock = $this->getMockForAbstractClass('\Drupal\Core\Entity\EntityDisplayBase', [], '', FALSE);
+    $mock = $this->getMockForAbstractClass(EntityDisplayBase::class, [], '', FALSE);
     $reflection = new \ReflectionProperty($mock, 'mode');
     $reflection->setAccessible(TRUE);
     $reflection->setValue($mock, 'test');
@@ -37,7 +38,7 @@ public function testGetMode() {
    * @covers ::getOriginalMode
    */
   public function testGetOriginalMode() {
-    $mock = $this->getMockForAbstractClass('\Drupal\Core\Entity\EntityDisplayBase', [], '', FALSE);
+    $mock = $this->getMockForAbstractClass(EntityDisplayBase::class, [], '', FALSE);
     $reflection = new \ReflectionProperty($mock, 'originalMode');
     $reflection->setAccessible(TRUE);
     $reflection->setValue($mock, 'test');
@@ -48,7 +49,7 @@ public function testGetOriginalMode() {
    * @covers ::getTargetBundle
    */
   public function testGetTargetBundle() {
-    $mock = $this->getMockForAbstractClass('\Drupal\Core\Entity\EntityDisplayBase', [], '', FALSE);
+    $mock = $this->getMockForAbstractClass(EntityDisplayBase::class, [], '', FALSE);
     $reflection = new \ReflectionProperty($mock, 'bundle');
     $reflection->setAccessible(TRUE);
     $reflection->setValue($mock, 'test');
@@ -59,7 +60,7 @@ public function testGetTargetBundle() {
    * @covers ::setTargetBundle
    */
   public function testSetTargetBundle() {
-    $mock = $this->getMockForAbstractClass('\Drupal\Core\Entity\EntityDisplayBase', [], '', FALSE);
+    $mock = $this->getMockForAbstractClass(EntityDisplayBase::class, [], '', FALSE);
     $reflection = new \ReflectionProperty($mock, 'bundle');
     $reflection->setAccessible(TRUE);
     $mock->setTargetBundle('test');
diff --git a/core/tests/Drupal/Tests/Core/Config/Entity/EntityDisplayModeBaseUnitTest.php b/core/tests/Drupal/Tests/Core/Config/Entity/EntityDisplayModeBaseUnitTest.php
index 728fdca..f9203b2 100644
--- a/core/tests/Drupal/Tests/Core/Config/Entity/EntityDisplayModeBaseUnitTest.php
+++ b/core/tests/Drupal/Tests/Core/Config/Entity/EntityDisplayModeBaseUnitTest.php
@@ -2,7 +2,11 @@
 
 namespace Drupal\Tests\Core\Config\Entity;
 
+use Drupal\Component\Uuid\UuidInterface;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
+use Drupal\Core\Entity\EntityDisplayModeBase;
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Entity\EntityTypeInterface;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -52,14 +56,14 @@ class EntityDisplayModeBaseUnitTest extends UnitTestCase {
   protected function setUp() {
     $this->entityType = $this->randomMachineName();
 
-    $this->entityInfo = $this->getMock('\Drupal\Core\Entity\EntityTypeInterface');
+    $this->entityInfo = $this->getMock(EntityTypeInterface::class);
     $this->entityInfo->expects($this->any())
       ->method('getProvider')
       ->will($this->returnValue('entity'));
 
-    $this->entityManager = $this->getMock('\Drupal\Core\Entity\EntityManagerInterface');
+    $this->entityManager = $this->getMock(EntityManagerInterface::class);
 
-    $this->uuid = $this->getMock('\Drupal\Component\Uuid\UuidInterface');
+    $this->uuid = $this->getMock(UuidInterface::class);
 
     $container = new ContainerBuilder();
     $container->set('entity.manager', $this->entityManager);
@@ -73,7 +77,7 @@ protected function setUp() {
   public function testCalculateDependencies() {
     $target_entity_type_id = $this->randomMachineName(16);
 
-    $target_entity_type = $this->getMock('\Drupal\Core\Entity\EntityTypeInterface');
+    $target_entity_type = $this->getMock(EntityTypeInterface::class);
     $target_entity_type->expects($this->any())
       ->method('getProvider')
       ->will($this->returnValue('test_module'));
@@ -88,7 +92,7 @@ public function testCalculateDependencies() {
       ->with($this->entityType)
       ->will($this->returnValue($this->entityInfo));
 
-    $this->entity = $this->getMockBuilder('\Drupal\Core\Entity\EntityDisplayModeBase')
+    $this->entity = $this->getMockBuilder(EntityDisplayModeBase::class)
       ->setConstructorArgs([$values, $this->entityType])
       ->setMethods(['getFilterFormat'])
       ->getMock();
@@ -103,7 +107,7 @@ public function testCalculateDependencies() {
   public function testSetTargetType() {
     // Generate mock.
     $mock = $this->getMock(
-      'Drupal\Core\Entity\EntityDisplayModeBase',
+      EntityDisplayModeBase::class,
       NULL,
       [['something' => 'nothing'], 'test_type']
     );
@@ -132,7 +136,7 @@ public function testSetTargetType() {
   public function testGetTargetType() {
     // Generate mock.
     $mock = $this->getMock(
-      'Drupal\Core\Entity\EntityDisplayModeBase',
+      EntityDisplayModeBase::class,
       NULL,
       [['something' => 'nothing'], 'test_type']
     );
diff --git a/core/tests/Drupal/Tests/Core/Config/Entity/Query/QueryFactoryTest.php b/core/tests/Drupal/Tests/Core/Config/Entity/Query/QueryFactoryTest.php
index f3c882c..3e38491 100644
--- a/core/tests/Drupal/Tests/Core/Config/Entity/Query/QueryFactoryTest.php
+++ b/core/tests/Drupal/Tests/Core/Config/Entity/Query/QueryFactoryTest.php
@@ -3,7 +3,11 @@
 namespace Drupal\Tests\Core\Config\Entity\Query;
 
 use Drupal\Core\Config\Config;
+use Drupal\Core\Config\ConfigFactoryInterface;
+use Drupal\Core\Config\ConfigManagerInterface;
+use Drupal\Core\Config\Entity\ConfigEntityTypeInterface;
 use Drupal\Core\Config\Entity\Query\QueryFactory;
+use Drupal\Core\KeyValueStore\KeyValueFactoryInterface;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -19,10 +23,10 @@ class QueryFactoryTest extends UnitTestCase {
    * @dataProvider providerTestGetKeys
    */
   public function testGetKeys(array $expected, $key, Config $config) {
-    $config_factory = $this->getMock('Drupal\Core\Config\ConfigFactoryInterface');
-    $key_value_factory = $this->getMock('Drupal\Core\KeyValueStore\KeyValueFactoryInterface');
-    $config_manager = $this->getMock('Drupal\Core\Config\ConfigManagerInterface');
-    $config_entity_type = $this->getMock('Drupal\Core\Config\Entity\ConfigEntityTypeInterface');
+    $config_factory = $this->getMock(ConfigFactoryInterface::class);
+    $key_value_factory = $this->getMock(KeyValueFactoryInterface::class);
+    $config_manager = $this->getMock(ConfigManagerInterface::class);
+    $config_entity_type = $this->getMock(ConfigEntityTypeInterface::class);
     $query_factory = new QueryFactory($config_factory, $key_value_factory, $config_manager);
     $method = new \ReflectionMethod($query_factory, 'getKeys');
     $method->setAccessible(TRUE);
@@ -100,10 +104,10 @@ public function providerTestGetKeys() {
    * @covers ::getValues
    */
   public function testGetKeysWildCardEnd() {
-    $config_factory = $this->getMock('Drupal\Core\Config\ConfigFactoryInterface');
-    $key_value_factory = $this->getMock('Drupal\Core\KeyValueStore\KeyValueFactoryInterface');
-    $config_manager = $this->getMock('Drupal\Core\Config\ConfigManagerInterface');
-    $config_entity_type = $this->getMock('Drupal\Core\Config\Entity\ConfigEntityTypeInterface');
+    $config_factory = $this->getMock(ConfigFactoryInterface::class);
+    $key_value_factory = $this->getMock(KeyValueFactoryInterface::class);
+    $config_manager = $this->getMock(ConfigManagerInterface::class);
+    $config_entity_type = $this->getMock(ConfigEntityTypeInterface::class);
     $config_entity_type->expects($this->atLeastOnce())
       ->method('id')
       ->willReturn('test_config_entity_type');
@@ -125,7 +129,7 @@ public function testGetKeysWildCardEnd() {
    *   The test configuration object.
    */
   protected function getConfigObject($name) {
-    $config = $this->getMockBuilder('Drupal\Core\Config\Config')
+    $config = $this->getMockBuilder(Config::class)
       ->disableOriginalConstructor()
       ->setMethods(['save', 'delete'])
       ->getMock();
diff --git a/core/tests/Drupal/Tests/Core/Config/ImmutableConfigTest.php b/core/tests/Drupal/Tests/Core/Config/ImmutableConfigTest.php
index 0ac8299..f016443 100644
--- a/core/tests/Drupal/Tests/Core/Config/ImmutableConfigTest.php
+++ b/core/tests/Drupal/Tests/Core/Config/ImmutableConfigTest.php
@@ -4,7 +4,10 @@
 
 use Drupal\Core\Config\ImmutableConfig;
 use Drupal\Core\Config\ImmutableConfigException;
+use Drupal\Core\Config\StorageInterface;
+use Drupal\Core\Config\TypedConfigManagerInterface;
 use Drupal\Tests\UnitTestCase;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 
 /**
  * @coversDefaultClass \Drupal\Core\Config\ImmutableConfig
@@ -21,9 +24,9 @@ class ImmutableConfigTest extends UnitTestCase {
 
   protected function setUp() {
     parent::setUp();
-    $storage = $this->getMock('Drupal\Core\Config\StorageInterface');
-    $event_dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
-    $typed_config = $this->getMock('Drupal\Core\Config\TypedConfigManagerInterface');
+    $storage = $this->getMock(StorageInterface::class);
+    $event_dispatcher = $this->getMock(EventDispatcherInterface::class);
+    $typed_config = $this->getMock(TypedConfigManagerInterface::class);
     $this->config = new ImmutableConfig('test', $storage, $event_dispatcher, $typed_config);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Config/StorageComparerTest.php b/core/tests/Drupal/Tests/Core/Config/StorageComparerTest.php
index fc0d63b..093df96 100644
--- a/core/tests/Drupal/Tests/Core/Config/StorageComparerTest.php
+++ b/core/tests/Drupal/Tests/Core/Config/StorageComparerTest.php
@@ -3,7 +3,9 @@
 namespace Drupal\Tests\Core\Config;
 
 use Drupal\Component\Uuid\Php;
+use Drupal\Core\Config\ConfigManagerInterface;
 use Drupal\Core\Config\StorageComparer;
+use Drupal\Core\Config\StorageInterface;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -42,9 +44,9 @@ class StorageComparerTest extends UnitTestCase {
   protected $configData;
 
   protected function setUp() {
-    $this->sourceStorage = $this->getMock('Drupal\Core\Config\StorageInterface');
-    $this->targetStorage = $this->getMock('Drupal\Core\Config\StorageInterface');
-    $this->configManager = $this->getMock('Drupal\Core\Config\ConfigManagerInterface');
+    $this->sourceStorage = $this->getMock(StorageInterface::class);
+    $this->targetStorage = $this->getMock(StorageInterface::class);
+    $this->configManager = $this->getMock(ConfigManagerInterface::class);
     $this->storageComparer = new StorageComparer($this->sourceStorage, $this->targetStorage, $this->configManager);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Controller/AjaxRendererTest.php b/core/tests/Drupal/Tests/Core/Controller/AjaxRendererTest.php
index 3d42dec..b530d7a 100644
--- a/core/tests/Drupal/Tests/Core/Controller/AjaxRendererTest.php
+++ b/core/tests/Drupal/Tests/Core/Controller/AjaxRendererTest.php
@@ -7,7 +7,10 @@
 
 namespace Drupal\Tests\Core\Controller;
 
+use Drupal\Core\Render\ElementInfoManagerInterface;
+use Drupal\Core\Render\Renderer;
 use Drupal\Core\Render\MainContent\AjaxRenderer;
+use Drupal\Core\Routing\RouteMatchInterface;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -36,7 +39,7 @@ class AjaxRendererTest extends UnitTestCase {
    * {@inheritdoc}
    */
   protected function setUp() {
-    $element_info_manager = $this->getMock('Drupal\Core\Render\ElementInfoManagerInterface');
+    $element_info_manager = $this->getMock(ElementInfoManagerInterface::class);
     $element_info_manager->expects($this->any())
       ->method('getInfo')
       ->with('ajax')
@@ -47,7 +50,7 @@ protected function setUp() {
       ]);
     $this->ajaxRenderer = new TestAjaxRenderer($element_info_manager);
 
-    $this->renderer = $this->getMockBuilder('Drupal\Core\Render\Renderer')
+    $this->renderer = $this->getMockBuilder(Renderer::class)
       ->disableOriginalConstructor()
       ->setMethods(NULL)
       ->getMock();
@@ -64,7 +67,7 @@ protected function setUp() {
   public function testRenderWithFragmentObject() {
     $main_content = ['#markup' => 'example content'];
     $request = new Request();
-    $route_match = $this->getMock('Drupal\Core\Routing\RouteMatchInterface');
+    $route_match = $this->getMock(RouteMatchInterface::class);
     /** @var \Drupal\Core\Ajax\AjaxResponse $result */
     $result = $this->ajaxRenderer->renderResponse($main_content, $request, $route_match);
 
diff --git a/core/tests/Drupal/Tests/Core/Controller/ControllerBaseTest.php b/core/tests/Drupal/Tests/Core/Controller/ControllerBaseTest.php
index 3f55f15..0625ffe 100644
--- a/core/tests/Drupal/Tests/Core/Controller/ControllerBaseTest.php
+++ b/core/tests/Drupal/Tests/Core/Controller/ControllerBaseTest.php
@@ -2,7 +2,9 @@
 
 namespace Drupal\Tests\Core\Controller;
 
+use Drupal\Core\Controller\ControllerBase;
 use Drupal\Tests\UnitTestCase;
+use Symfony\Component\DependencyInjection\ContainerInterface;
 
 /**
  * Tests that the base controller class.
@@ -19,7 +21,7 @@ class ControllerBaseTest extends UnitTestCase {
   protected $controllerBase;
 
   protected function setUp() {
-    $this->controllerBase = $this->getMockForAbstractClass('Drupal\Core\Controller\ControllerBase');
+    $this->controllerBase = $this->getMockForAbstractClass(ControllerBase::class);
   }
 
   /**
@@ -35,7 +37,7 @@ public function testGetConfig() {
       ],
     ]);
 
-    $container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
+    $container = $this->getMock(ContainerInterface::class);
     $container->expects($this->once())
       ->method('get')
       ->with('config.factory')
diff --git a/core/tests/Drupal/Tests/Core/Controller/ControllerResolverTest.php b/core/tests/Drupal/Tests/Core/Controller/ControllerResolverTest.php
index 0b7aa25..9438e66 100644
--- a/core/tests/Drupal/Tests/Core/Controller/ControllerResolverTest.php
+++ b/core/tests/Drupal/Tests/Core/Controller/ControllerResolverTest.php
@@ -10,9 +10,11 @@
 use Drupal\Core\Controller\ControllerResolver;
 use Drupal\Core\DependencyInjection\ClassResolver;
 use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
+use Drupal\Core\Entity\Entity;
 use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Routing\RouteMatch;
 use Drupal\Core\Routing\RouteMatchInterface;
+use Drupal\Core\Session\AccountInterface;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\DependencyInjection\ContainerAwareInterface;
 use Symfony\Component\DependencyInjection\ContainerAwareTrait;
@@ -76,10 +78,10 @@ protected function setUp() {
   public function testGetArguments() {
     $controller = function(EntityInterface $entity, $user, RouteMatchInterface $route_match, ServerRequestInterface $psr_7) {
     };
-    $mock_entity = $this->getMockBuilder('Drupal\Core\Entity\Entity')
+    $mock_entity = $this->getMockBuilder(Entity::class)
       ->disableOriginalConstructor()
       ->getMock();
-    $mock_account = $this->getMock('Drupal\Core\Session\AccountInterface');
+    $mock_account = $this->getMock(AccountInterface::class);
     $request = new Request([], [], [
       'entity' => $mock_entity,
       'user' => $mock_account,
diff --git a/core/tests/Drupal/Tests/Core/Controller/TitleResolverTest.php b/core/tests/Drupal/Tests/Core/Controller/TitleResolverTest.php
index 7633f78..444048f 100644
--- a/core/tests/Drupal/Tests/Core/Controller/TitleResolverTest.php
+++ b/core/tests/Drupal/Tests/Core/Controller/TitleResolverTest.php
@@ -7,12 +7,14 @@
 
 namespace Drupal\Tests\Core\Controller;
 
+use Drupal\Core\Controller\ControllerResolverInterface;
 use Drupal\Core\Controller\TitleResolver;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\HttpFoundation\ParameterBag;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\Routing\Route;
 use Drupal\Core\StringTranslation\TranslatableMarkup;
+use Drupal\Core\StringTranslation\TranslationInterface;
 
 /**
  * @coversDefaultClass \Drupal\Core\Controller\TitleResolver
@@ -42,8 +44,8 @@ class TitleResolverTest extends UnitTestCase {
   protected $titleResolver;
 
   protected function setUp() {
-    $this->controllerResolver = $this->getMock('\Drupal\Core\Controller\ControllerResolverInterface');
-    $this->translationManager = $this->getMock('\Drupal\Core\StringTranslation\TranslationInterface');
+    $this->controllerResolver = $this->getMock(ControllerResolverInterface::class);
+    $this->translationManager = $this->getMock(TranslationInterface::class);
 
     $this->titleResolver = new TitleResolver($this->controllerResolver, $this->translationManager);
   }
@@ -87,7 +89,7 @@ public function testStaticTitleWithParameter($title, $expected_title) {
   }
 
   public function providerTestStaticTitleWithParameter() {
-    $translation_manager = $this->getMock('\Drupal\Core\StringTranslation\TranslationInterface');
+    $translation_manager = $this->getMock(TranslationInterface::class);
     return [
       ['static title @test', new TranslatableMarkup('static title @test', ['@test' => 'value', '%test' => 'value', '@test2' => 'value2', '%test2' => 'value2'], [], $translation_manager)],
       ['static title %test', new TranslatableMarkup('static title %test', ['@test' => 'value', '%test' => 'value', '@test2' => 'value2', '%test2' => 'value2'], [], $translation_manager)],
diff --git a/core/tests/Drupal/Tests/Core/Database/ConnectionTest.php b/core/tests/Drupal/Tests/Core/Database/ConnectionTest.php
index e455847..36d1c96 100644
--- a/core/tests/Drupal/Tests/Core/Database/ConnectionTest.php
+++ b/core/tests/Drupal/Tests/Core/Database/ConnectionTest.php
@@ -3,6 +3,7 @@
 namespace Drupal\Tests\Core\Database;
 
 use Drupal\Tests\Core\Database\Stub\StubConnection;
+use Drupal\Tests\Core\Database\Stub\StubPDO;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -45,7 +46,7 @@ public function providerPrefixRoundTrip() {
    * @dataProvider providerPrefixRoundTrip
    */
   public function testPrefixRoundTrip($expected, $prefix_info) {
-    $mock_pdo = $this->getMock('Drupal\Tests\Core\Database\Stub\StubPDO');
+    $mock_pdo = $this->getMock(StubPDO::class);
     $connection = new StubConnection($mock_pdo, []);
 
     // setPrefix() is protected, so we make it accessible with reflection.
@@ -94,7 +95,7 @@ public function providerTestPrefixTables() {
    * @dataProvider providerTestPrefixTables
    */
   public function testPrefixTables($expected, $prefix_info, $query) {
-    $mock_pdo = $this->getMock('Drupal\Tests\Core\Database\Stub\StubPDO');
+    $mock_pdo = $this->getMock(StubPDO::class);
     $connection = new StubConnection($mock_pdo, ['prefix' => $prefix_info]);
     $this->assertEquals($expected, $connection->prefixTables($query));
   }
@@ -128,7 +129,7 @@ public function providerEscapeMethods() {
    * @todo Separate test method for each escape method?
    */
   public function testEscapeMethods($expected, $name) {
-    $mock_pdo = $this->getMock('Drupal\Tests\Core\Database\Stub\StubPDO');
+    $mock_pdo = $this->getMock(StubPDO::class);
     $connection = new StubConnection($mock_pdo, []);
     $this->assertEquals($expected, $connection->escapeDatabase($name));
     $this->assertEquals($expected, $connection->escapeTable($name));
@@ -172,7 +173,7 @@ public function providerGetDriverClass() {
    * @dataProvider providerGetDriverClass
    */
   public function testGetDriverClass($expected, $namespace, $class) {
-    $mock_pdo = $this->getMock('Drupal\Tests\Core\Database\Stub\StubPDO');
+    $mock_pdo = $this->getMock(StubPDO::class);
     $connection = new StubConnection($mock_pdo, ['namespace' => $namespace]);
     // Set the driver using our stub class' public property.
     $this->assertEquals($expected, $connection->getDriverClass($class));
@@ -203,7 +204,7 @@ public function providerSchema() {
    * @dataProvider providerSchema
    */
   public function testSchema($expected, $driver, $namespace) {
-    $mock_pdo = $this->getMock('Drupal\Tests\Core\Database\Stub\StubPDO');
+    $mock_pdo = $this->getMock(StubPDO::class);
     $connection = new StubConnection($mock_pdo, ['namespace' => $namespace]);
     $connection->driver = $driver;
     $this->assertInstanceOf($expected, $connection->schema());
@@ -213,10 +214,10 @@ public function testSchema($expected, $driver, $namespace) {
    * Test Connection::destroy().
    */
   public function testDestroy() {
-    $mock_pdo = $this->getMock('Drupal\Tests\Core\Database\Stub\StubPDO');
+    $mock_pdo = $this->getMock(StubPDO::class);
     // Mocking StubConnection gives us access to the $schema attribute.
     $connection = $this->getMock(
-      'Drupal\Tests\Core\Database\Stub\StubConnection',
+      StubConnection::class,
       NULL,
       [$mock_pdo, ['namespace' => 'Drupal\\Tests\\Core\\Database\\Stub\\Driver']]
     );
@@ -260,7 +261,7 @@ public function providerMakeComments() {
    * @dataProvider providerMakeComments
    */
   public function testMakeComments($expected, $comment_array) {
-    $mock_pdo = $this->getMock('Drupal\Tests\Core\Database\Stub\StubPDO');
+    $mock_pdo = $this->getMock(StubPDO::class);
     $connection = new StubConnection($mock_pdo, []);
     $this->assertEquals($expected, $connection->makeComment($comment_array));
   }
@@ -287,7 +288,7 @@ public function providerFilterComments() {
    * @dataProvider providerFilterComments
    */
   public function testFilterComments($expected, $comment) {
-    $mock_pdo = $this->getMock('Drupal\Tests\Core\Database\Stub\StubPDO');
+    $mock_pdo = $this->getMock(StubPDO::class);
     $connection = new StubConnection($mock_pdo, []);
 
     // filterComment() is protected, so we make it accessible with reflection.
diff --git a/core/tests/Drupal/Tests/Core/Database/Driver/pgsql/PostgresqlConnectionTest.php b/core/tests/Drupal/Tests/Core/Database/Driver/pgsql/PostgresqlConnectionTest.php
index b55ddbb..b596a19 100644
--- a/core/tests/Drupal/Tests/Core/Database/Driver/pgsql/PostgresqlConnectionTest.php
+++ b/core/tests/Drupal/Tests/Core/Database/Driver/pgsql/PostgresqlConnectionTest.php
@@ -3,6 +3,7 @@
 namespace Drupal\Tests\Core\Database\Driver\pgsql;
 
 use Drupal\Core\Database\Driver\pgsql\Connection;
+use Drupal\Tests\Core\Database\Stub\StubPDO;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -23,7 +24,7 @@ class PostgresqlConnectionTest extends UnitTestCase {
    */
   protected function setUp() {
     parent::setUp();
-    $this->mockPdo = $this->getMock('Drupal\Tests\Core\Database\Stub\StubPDO');
+    $this->mockPdo = $this->getMock(StubPDO::class);
   }
 
   /**
diff --git a/core/tests/Drupal/Tests/Core/Database/Driver/pgsql/PostgresqlSchemaTest.php b/core/tests/Drupal/Tests/Core/Database/Driver/pgsql/PostgresqlSchemaTest.php
index d25d2cd..717a0a5 100644
--- a/core/tests/Drupal/Tests/Core/Database/Driver/pgsql/PostgresqlSchemaTest.php
+++ b/core/tests/Drupal/Tests/Core/Database/Driver/pgsql/PostgresqlSchemaTest.php
@@ -2,6 +2,8 @@
 
 namespace Drupal\Tests\Core\Database\Driver\pgsql;
 
+use Drupal\Core\Database\StatementInterface;
+use Drupal\Core\Database\Driver\pgsql\Connection;
 use Drupal\Core\Database\Driver\pgsql\Schema;
 use Drupal\Tests\UnitTestCase;
 
@@ -24,7 +26,7 @@ class PostgresqlSchemaTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $this->connection = $this->getMockBuilder('\Drupal\Core\Database\Driver\pgsql\Connection')
+    $this->connection = $this->getMockBuilder(Connection::class)
       ->disableOriginalConstructor()
       ->getMock();
   }
@@ -46,7 +48,7 @@ public function testComputedConstraintName($table_name, $name, $expected) {
     $max_identifier_length = 63;
     $schema = new Schema($this->connection);
 
-    $statement = $this->getMock('\Drupal\Core\Database\StatementInterface');
+    $statement = $this->getMock(StatementInterface::class);
     $statement->expects($this->any())
       ->method('fetchField')
       ->willReturn($max_identifier_length);
@@ -58,7 +60,7 @@ public function testComputedConstraintName($table_name, $name, $expected) {
     $this->connection->expects($this->at(2))
       ->method('query')
       ->with("SELECT 1 FROM pg_constraint WHERE conname = '$expected'")
-      ->willReturn($this->getMock('\Drupal\Core\Database\StatementInterface'));
+      ->willReturn($this->getMock(StatementInterface::class));
 
     $schema->constraintExists($table_name, $name);
   }
diff --git a/core/tests/Drupal/Tests/Core/Database/OrderByTest.php b/core/tests/Drupal/Tests/Core/Database/OrderByTest.php
index bab2571..4892854 100644
--- a/core/tests/Drupal/Tests/Core/Database/OrderByTest.php
+++ b/core/tests/Drupal/Tests/Core/Database/OrderByTest.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\Tests\Core\Database;
 
+use Drupal\Core\Database\Connection;
 use Drupal\Core\Database\Query\Select;
 use Drupal\Tests\UnitTestCase;
 
@@ -23,7 +24,7 @@ class OrderByTest extends UnitTestCase {
    * {@inheritdoc}
    */
   protected function setUp() {
-    $connection = $this->getMockBuilder('Drupal\Core\Database\Connection')
+    $connection = $this->getMockBuilder(Connection::class)
       ->disableOriginalConstructor()
       ->getMockForAbstractClass();
     $this->query = new Select('test', NULL, $connection);
diff --git a/core/tests/Drupal/Tests/Core/Datetime/DateTest.php b/core/tests/Drupal/Tests/Core/Datetime/DateTest.php
index 7dd8e19..7c15497 100644
--- a/core/tests/Drupal/Tests/Core/Datetime/DateTest.php
+++ b/core/tests/Drupal/Tests/Core/Datetime/DateTest.php
@@ -6,9 +6,14 @@
 use Drupal\Core\Datetime\DateFormatter;
 use Drupal\Core\Datetime\FormattedDateDiff;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Entity\EntityStorageInterface;
+use Drupal\Core\Language\LanguageManagerInterface;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\HttpFoundation\Request;
+use Symfony\Component\HttpFoundation\RequestStack;
 use Drupal\Core\StringTranslation\TranslatableMarkup;
+use Drupal\Core\StringTranslation\TranslationInterface;
 
 /**
  * @coversDefaultClass \Drupal\Core\Datetime\DateFormatter
@@ -61,14 +66,14 @@ class DateTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $entity_storage = $this->getMock('Drupal\Core\Entity\EntityStorageInterface');
+    $entity_storage = $this->getMock(EntityStorageInterface::class);
 
-    $this->entityManager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
+    $this->entityManager = $this->getMock(EntityManagerInterface::class);
     $this->entityManager->expects($this->any())->method('getStorage')->with('date_format')->willReturn($entity_storage);
 
-    $this->languageManager = $this->getMock('Drupal\Core\Language\LanguageManagerInterface');
-    $this->stringTranslation = $this->getMock('Drupal\Core\StringTranslation\TranslationInterface');
-    $this->requestStack = $this->getMock('Symfony\Component\HttpFoundation\RequestStack');
+    $this->languageManager = $this->getMock(LanguageManagerInterface::class);
+    $this->stringTranslation = $this->getMock(TranslationInterface::class);
+    $this->requestStack = $this->getMock(RequestStack::class);
 
     $config_factory = $this->getConfigFactoryStub(['system.date' => ['country' => ['default' => 'GB']]]);
     $container = new ContainerBuilder();
@@ -78,7 +83,7 @@ protected function setUp() {
 
     $this->dateFormatter = new DateFormatter($this->entityManager, $this->languageManager, $this->stringTranslation, $this->getConfigFactoryStub(), $this->requestStack);
 
-    $this->dateFormatterStub = $this->getMockBuilder('\Drupal\Core\Datetime\DateFormatter')
+    $this->dateFormatterStub = $this->getMockBuilder(DateFormatter::class)
       ->setConstructorArgs([$this->entityManager, $this->languageManager, $this->stringTranslation, $this->getConfigFactoryStub(), $this->requestStack])
       ->setMethods(['formatDiff'])
       ->getMock();
diff --git a/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/BackendCompilerPassTest.php b/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/BackendCompilerPassTest.php
index 3f8ca09..1d235bb 100644
--- a/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/BackendCompilerPassTest.php
+++ b/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/BackendCompilerPassTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\Tests\Core\DependencyInjection\Compiler;
 
+use Drupal\Core\Database\Driver\sqlite\Connection;
 use Drupal\Core\DependencyInjection\Compiler\BackendCompilerPass;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\DependencyInjection\Alias;
@@ -103,7 +104,7 @@ protected function getSqliteContainer($service) {
     $container = new ContainerBuilder();
     $container->setDefinition('service', $service);
     $container->setDefinition('sqlite.service', new Definition(__NAMESPACE__ . '\\ServiceClassSqlite'));
-    $mock = $this->getMockBuilder('Drupal\Core\Database\Driver\sqlite\Connection')->setMethods(NULL)->disableOriginalConstructor()->getMock();
+    $mock = $this->getMockBuilder(Connection::class)->setMethods(NULL)->disableOriginalConstructor()->getMock();
     $container->set('database', $mock);
     return $container;
   }
diff --git a/core/tests/Drupal/Tests/Core/Display/DisplayVariantTest.php b/core/tests/Drupal/Tests/Core/Display/DisplayVariantTest.php
index 3729d7e..a8a56f7 100644
--- a/core/tests/Drupal/Tests/Core/Display/DisplayVariantTest.php
+++ b/core/tests/Drupal/Tests/Core/Display/DisplayVariantTest.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\Tests\Core\Display;
 
+use Drupal\Core\Display\VariantBase;
 use Drupal\Core\Form\FormState;
 use Drupal\Tests\UnitTestCase;
 
@@ -23,7 +24,7 @@ class DisplayVariantTest extends UnitTestCase {
    *   A mocked display variant plugin.
    */
   public function setUpDisplayVariant($configuration = [], $definition = []) {
-    return $this->getMockBuilder('Drupal\Core\Display\VariantBase')
+    return $this->getMockBuilder(VariantBase::class)
       ->setConstructorArgs([$configuration, 'test', $definition])
       ->setMethods(['build'])
       ->getMock();
diff --git a/core/tests/Drupal/Tests/Core/DrupalTest.php b/core/tests/Drupal/Tests/Core/DrupalTest.php
index 2ff6ebf..ef59229 100644
--- a/core/tests/Drupal/Tests/Core/DrupalTest.php
+++ b/core/tests/Drupal/Tests/Core/DrupalTest.php
@@ -2,13 +2,20 @@
 
 namespace Drupal\Tests\Core;
 
+use Drupal\Core\Config\ConfigFactoryInterface;
 use Drupal\Core\DependencyInjection\ContainerNotInitializedException;
 use Drupal\Core\Entity\EntityStorageInterface;
 use Drupal\Core\Entity\EntityTypeManagerInterface;
 use Drupal\Core\Entity\Query\QueryAggregateInterface;
 use Drupal\Core\Entity\Query\QueryInterface;
+use Drupal\Core\KeyValueStore\KeyValueExpirableFactory;
+use Drupal\Core\KeyValueStore\KeyValueFactory;
+use Drupal\Core\Queue\QueueFactory;
+use Drupal\Core\Routing\UrlGeneratorInterface;
 use Drupal\Tests\UnitTestCase;
 use Drupal\Core\Url;
+use Drupal\Core\Utility\LinkGeneratorInterface;
+use Symfony\Component\DependencyInjection\ContainerBuilder;
 use Symfony\Component\HttpFoundation\RequestStack;
 
 /**
@@ -31,7 +38,7 @@ class DrupalTest extends UnitTestCase {
    */
   protected function setUp() {
     parent::setUp();
-    $this->container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')
+    $this->container = $this->getMockBuilder(ContainerBuilder::class)
       ->setMethods(['get'])
       ->getMock();
   }
@@ -130,7 +137,7 @@ public function testClassResolver() {
    * @covers ::keyValueExpirable
    */
   public function testKeyValueExpirable() {
-    $keyvalue = $this->getMockBuilder('Drupal\Core\KeyValueStore\KeyValueExpirableFactory')
+    $keyvalue = $this->getMockBuilder(KeyValueExpirableFactory::class)
       ->disableOriginalConstructor()
       ->getMock();
     $keyvalue->expects($this->once())
@@ -158,7 +165,7 @@ public function testLock() {
    * @covers ::config
    */
   public function testConfig() {
-    $config = $this->getMock('Drupal\Core\Config\ConfigFactoryInterface');
+    $config = $this->getMock(ConfigFactoryInterface::class);
     $config->expects($this->once())
       ->method('get')
       ->with('test_config')
@@ -175,7 +182,7 @@ public function testConfig() {
    * @covers ::queue
    */
   public function testQueue() {
-    $queue = $this->getMockBuilder('Drupal\Core\Queue\QueueFactory')
+    $queue = $this->getMockBuilder(QueueFactory::class)
       ->disableOriginalConstructor()
       ->getMock();
     $queue->expects($this->once())
@@ -205,7 +212,7 @@ public function testRequestStack() {
    * @covers ::keyValue
    */
   public function testKeyValue() {
-    $keyvalue = $this->getMockBuilder('Drupal\Core\KeyValueStore\KeyValueFactory')
+    $keyvalue = $this->getMockBuilder(KeyValueFactory::class)
       ->disableOriginalConstructor()
       ->getMock();
     $keyvalue->expects($this->once())
@@ -348,7 +355,7 @@ public function testUrlGenerator() {
   public function testUrl() {
     $route_parameters = ['test_parameter' => 'test'];
     $options = ['test_option' => 'test'];
-    $generator = $this->getMock('Drupal\Core\Routing\UrlGeneratorInterface');
+    $generator = $this->getMock(UrlGeneratorInterface::class);
     $generator->expects($this->once())
       ->method('generateFromRoute')
       ->with('test_route', $route_parameters, $options)
@@ -377,7 +384,7 @@ public function testLinkGenerator() {
   public function testL() {
     $route_parameters = ['test_parameter' => 'test'];
     $options = ['test_option' => 'test'];
-    $generator = $this->getMock('Drupal\Core\Utility\LinkGeneratorInterface');
+    $generator = $this->getMock(LinkGeneratorInterface::class);
     $url = new Url('test_route', $route_parameters, $options);
     $generator->expects($this->once())
       ->method('generate')
diff --git a/core/tests/Drupal/Tests/Core/Enhancer/ParamConversionEnhancerTest.php b/core/tests/Drupal/Tests/Core/Enhancer/ParamConversionEnhancerTest.php
index 064cedf..b7cfe84 100644
--- a/core/tests/Drupal/Tests/Core/Enhancer/ParamConversionEnhancerTest.php
+++ b/core/tests/Drupal/Tests/Core/Enhancer/ParamConversionEnhancerTest.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\Tests\Core\Enhancer;
 
+use Drupal\Core\ParamConverter\ParamConverterManagerInterface;
 use Drupal\Core\Routing\Enhancer\ParamConversionEnhancer;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Cmf\Component\Routing\RouteObjectInterface;
@@ -31,7 +32,7 @@ class ParamConversionEnhancerTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $this->paramConverterManager = $this->getMock('Drupal\Core\ParamConverter\ParamConverterManagerInterface');
+    $this->paramConverterManager = $this->getMock(ParamConverterManagerInterface::class);
     $this->paramConversionEnhancer = new ParamConversionEnhancer($this->paramConverterManager);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Entity/BaseFieldDefinitionTest.php b/core/tests/Drupal/Tests/Core/Entity/BaseFieldDefinitionTest.php
index 616f6ba..8acf96c 100644
--- a/core/tests/Drupal/Tests/Core/Entity/BaseFieldDefinitionTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/BaseFieldDefinitionTest.php
@@ -3,8 +3,12 @@
 namespace Drupal\Tests\Core\Entity;
 
 use Drupal\Core\DependencyInjection\ContainerBuilder;
+use Drupal\Core\Entity\ContentEntityBase;
 use Drupal\Core\Field\BaseFieldDefinition;
+use Drupal\Core\Field\FieldItemList;
 use Drupal\Core\Field\FieldStorageDefinitionInterface;
+use Drupal\Core\Field\FieldTypePluginManagerInterface;
+use Drupal\Core\TypedData\DataDefinition;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -35,7 +39,7 @@ class BaseFieldDefinitionTest extends UnitTestCase {
    */
   protected function setUp() {
     // Mock the field type manager and place it in the container.
-    $field_type_manager = $this->getMock('Drupal\Core\Field\FieldTypePluginManagerInterface');
+    $field_type_manager = $this->getMock(FieldTypePluginManagerInterface::class);
 
     $this->fieldType = $this->randomMachineName();
     $this->fieldTypeDefinition = [
@@ -161,15 +165,15 @@ public function testFieldDefaultValue() {
     ];
     $expected_default_value = [$default_value];
     $definition->setDefaultValue($default_value);
-    $entity = $this->getMockBuilder('Drupal\Core\Entity\ContentEntityBase')
+    $entity = $this->getMockBuilder(ContentEntityBase::class)
       ->disableOriginalConstructor()
       ->getMock();
     // Set the field item list class to be used to avoid requiring the typed
     // data manager to retrieve it.
-    $definition->setClass('Drupal\Core\Field\FieldItemList');
+    $definition->setClass(FieldItemList::class);
     $this->assertEquals($expected_default_value, $definition->getDefaultValue($entity));
 
-    $data_definition = $this->getMockBuilder('Drupal\Core\TypedData\DataDefinition')
+    $data_definition = $this->getMockBuilder(DataDefinition::class)
       ->disableOriginalConstructor()
       ->getMock();
     $data_definition->expects($this->any())
@@ -207,15 +211,15 @@ public function testFieldInitialValue() {
     ];
     $expected_default_value = [$default_value];
     $definition->setInitialValue($default_value);
-    $entity = $this->getMockBuilder('Drupal\Core\Entity\ContentEntityBase')
+    $entity = $this->getMockBuilder(ContentEntityBase::class)
       ->disableOriginalConstructor()
       ->getMock();
     // Set the field item list class to be used to avoid requiring the typed
     // data manager to retrieve it.
-    $definition->setClass('Drupal\Core\Field\FieldItemList');
+    $definition->setClass(FieldItemList::class);
     $this->assertEquals($expected_default_value, $definition->getInitialValue($entity));
 
-    $data_definition = $this->getMockBuilder('Drupal\Core\TypedData\DataDefinition')
+    $data_definition = $this->getMockBuilder(DataDefinition::class)
       ->disableOriginalConstructor()
       ->getMock();
     $data_definition->expects($this->any())
diff --git a/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php b/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php
index 541ec88..82b88c8 100644
--- a/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php
@@ -2,14 +2,28 @@
 
 namespace Drupal\Tests\Core\Entity;
 
+use Drupal\Component\Uuid\UuidInterface;
 use Drupal\Core\Access\AccessResult;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
+use Drupal\Core\Entity\ContentEntityBase;
 use Drupal\Core\Entity\ContentEntityInterface;
+use Drupal\Core\Entity\EntityAccessControlHandlerInterface;
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Entity\EntityStorageInterface;
+use Drupal\Core\Entity\EntityTypeInterface;
 use Drupal\Core\Field\BaseFieldDefinition;
+use Drupal\Core\Field\FieldDefinitionInterface;
+use Drupal\Core\Field\FieldItemBase;
+use Drupal\Core\Field\FieldItemList;
+use Drupal\Core\Field\FieldItemListInterface;
+use Drupal\Core\Field\FieldTypePluginManager;
 use Drupal\Core\Language\LanguageInterface;
 use Drupal\Core\TypedData\TypedDataManagerInterface;
 use Drupal\Tests\UnitTestCase;
 use Drupal\Core\Language\Language;
+use Drupal\Core\Language\LanguageManagerInterface;
+use Symfony\Component\Validator\ConstraintViolationInterface;
+use Symfony\Component\Validator\ConstraintViolationList;
 use Symfony\Component\Validator\Validator\ValidatorInterface;
 
 /**
@@ -116,7 +130,7 @@ protected function setUp() {
     $this->entityTypeId = $this->randomMachineName();
     $this->bundle = $this->randomMachineName();
 
-    $this->entityType = $this->getMock('\Drupal\Core\Entity\EntityTypeInterface');
+    $this->entityType = $this->getMock(EntityTypeInterface::class);
     $this->entityType->expects($this->any())
       ->method('getKeys')
       ->will($this->returnValue([
@@ -124,13 +138,13 @@ protected function setUp() {
         'uuid' => 'uuid',
     ]));
 
-    $this->entityManager = $this->getMock('\Drupal\Core\Entity\EntityManagerInterface');
+    $this->entityManager = $this->getMock(EntityManagerInterface::class);
     $this->entityManager->expects($this->any())
       ->method('getDefinition')
       ->with($this->entityTypeId)
       ->will($this->returnValue($this->entityType));
 
-    $this->uuid = $this->getMock('\Drupal\Component\Uuid\UuidInterface');
+    $this->uuid = $this->getMock(UuidInterface::class);
 
     $this->typedDataManager = $this->getMock(TypedDataManagerInterface::class);
     $this->typedDataManager->expects($this->any())
@@ -140,7 +154,7 @@ protected function setUp() {
 
     $english = new Language(['id' => 'en']);
     $not_specified = new Language(['id' => LanguageInterface::LANGCODE_NOT_SPECIFIED, 'locked' => TRUE]);
-    $this->languageManager = $this->getMock('\Drupal\Core\Language\LanguageManagerInterface');
+    $this->languageManager = $this->getMock(LanguageManagerInterface::class);
     $this->languageManager->expects($this->any())
       ->method('getLanguages')
       ->will($this->returnValue(['en' => $english, LanguageInterface::LANGCODE_NOT_SPECIFIED => $not_specified]));
@@ -153,7 +167,7 @@ protected function setUp() {
       ->with(LanguageInterface::LANGCODE_NOT_SPECIFIED)
       ->will($this->returnValue($not_specified));
 
-    $this->fieldTypePluginManager = $this->getMockBuilder('\Drupal\Core\Field\FieldTypePluginManager')
+    $this->fieldTypePluginManager = $this->getMockBuilder(FieldTypePluginManager::class)
       ->disableOriginalConstructor()
       ->getMock();
     $this->fieldTypePluginManager->expects($this->any())
@@ -164,7 +178,7 @@ protected function setUp() {
       ->will($this->returnValue([]));
     $this->fieldTypePluginManager->expects($this->any())
       ->method('createFieldItemList')
-      ->will($this->returnValue($this->getMock('Drupal\Core\Field\FieldItemListInterface')));
+      ->will($this->returnValue($this->getMock(FieldItemListInterface::class)));
 
     $container = new ContainerBuilder();
     $container->set('entity.manager', $this->entityManager);
@@ -184,9 +198,9 @@ protected function setUp() {
       ->with($this->entityTypeId, $this->bundle)
       ->will($this->returnValue($this->fieldDefinitions));
 
-    $this->entity = $this->getMockForAbstractClass('\Drupal\Core\Entity\ContentEntityBase', [$values, $this->entityTypeId, $this->bundle], '', TRUE, TRUE, TRUE, ['isNew']);
+    $this->entity = $this->getMockForAbstractClass(ContentEntityBase::class, [$values, $this->entityTypeId, $this->bundle], '', TRUE, TRUE, TRUE, ['isNew']);
     $values['defaultLangcode'] = [LanguageInterface::LANGCODE_DEFAULT => LanguageInterface::LANGCODE_NOT_SPECIFIED];
-    $this->entityUnd = $this->getMockForAbstractClass('\Drupal\Core\Entity\ContentEntityBase', [$values, $this->entityTypeId, $this->bundle]);
+    $this->entityUnd = $this->getMockForAbstractClass(ContentEntityBase::class, [$values, $this->entityTypeId, $this->bundle]);
   }
 
   /**
@@ -221,10 +235,10 @@ public function testIsNewRevision() {
       ->with('revision')
       ->will($this->returnValue('revision_id'));
 
-    $field_item_list = $this->getMockBuilder('\Drupal\Core\Field\FieldItemList')
+    $field_item_list = $this->getMockBuilder(FieldItemList::class)
       ->disableOriginalConstructor()
       ->getMock();
-    $field_item = $this->getMockBuilder('\Drupal\Core\Field\FieldItemBase')
+    $field_item = $this->getMockBuilder(FieldItemBase::class)
       ->disableOriginalConstructor()
       ->getMockForAbstractClass();
 
@@ -249,7 +263,7 @@ public function testSetNewRevisionException() {
       ->method('hasKey')
       ->with('revision')
       ->will($this->returnValue(FALSE));
-    $this->setExpectedException('LogicException', 'Entity type ' . $this->entityTypeId . ' does not support revisions.');
+    $this->setExpectedException(\LogicException::class, 'Entity type ' . $this->entityTypeId . ' does not support revisions.');
     $this->entity->setNewRevision();
   }
 
@@ -318,7 +332,7 @@ public function testIsTranslatableForMonolingual() {
    */
   public function testPreSaveRevision() {
     // This method is internal, so check for errors on calling it only.
-    $storage = $this->getMock('\Drupal\Core\Entity\EntityStorageInterface');
+    $storage = $this->getMock(EntityStorageInterface::class);
     $record = new \stdClass();
     // Our mocked entity->preSaveRevision() returns NULL, so assert that.
     $this->assertNull($this->entity->preSaveRevision($storage, $record));
@@ -330,11 +344,11 @@ public function testPreSaveRevision() {
   public function testValidate() {
     $validator = $this->getMock(ValidatorInterface::class);
     /** @var \Symfony\Component\Validator\ConstraintViolationList|\PHPUnit_Framework_MockObject_MockObject $empty_violation_list */
-    $empty_violation_list = $this->getMockBuilder('\Symfony\Component\Validator\ConstraintViolationList')
+    $empty_violation_list = $this->getMockBuilder(ConstraintViolationList::class)
       ->setMethods(NULL)
       ->getMock();
     $non_empty_violation_list = clone $empty_violation_list;
-    $violation = $this->getMock('\Symfony\Component\Validator\ConstraintViolationInterface');
+    $violation = $this->getMock(ConstraintViolationInterface::class);
     $non_empty_violation_list->add($violation);
     $validator->expects($this->at(0))
       ->method('validate')
@@ -363,7 +377,7 @@ public function testValidate() {
   public function testRequiredValidation() {
     $validator = $this->getMock(ValidatorInterface::class);
     /** @var \Symfony\Component\Validator\ConstraintViolationList|\PHPUnit_Framework_MockObject_MockObject $empty_violation_list */
-    $empty_violation_list = $this->getMockBuilder('\Symfony\Component\Validator\ConstraintViolationList')
+    $empty_violation_list = $this->getMockBuilder(ConstraintViolationList::class)
       ->setMethods(NULL)
       ->getMock();
     $validator->expects($this->at(0))
@@ -375,7 +389,7 @@ public function testRequiredValidation() {
       ->will($this->returnValue($validator));
 
     /** @var \Drupal\Core\Entity\EntityStorageInterface|\PHPUnit_Framework_MockObject_MockObject $storage */
-    $storage = $this->getMock('\Drupal\Core\Entity\EntityStorageInterface');
+    $storage = $this->getMock(EntityStorageInterface::class);
     $storage->expects($this->any())
       ->method('save')
       ->willReturnCallback(function (ContentEntityInterface $entity) use ($storage) {
@@ -418,7 +432,7 @@ public function testBundle() {
    * @covers ::access
    */
   public function testAccess() {
-    $access = $this->getMock('\Drupal\Core\Entity\EntityAccessControlHandlerInterface');
+    $access = $this->getMock(EntityAccessControlHandlerInterface::class);
     $operation = $this->randomMachineName();
     $access->expects($this->at(0))
       ->method('access')
@@ -488,7 +502,7 @@ public function providerGet() {
    */
   public function testGet($expected, $field_name, $active_langcode, $fields) {
     // Mock ContentEntityBase.
-    $mock_base = $this->getMockBuilder('Drupal\Core\Entity\ContentEntityBase')
+    $mock_base = $this->getMockBuilder(ContentEntityBase::class)
       ->disableOriginalConstructor()
       ->setMethods(['getTranslatedField'])
       ->getMockForAbstractClass();
@@ -550,7 +564,7 @@ public function providerGetFields() {
    */
   public function testGetFields($expected, $include_computed, $is_computed, $field_definitions) {
     // Mock ContentEntityBase.
-    $mock_base = $this->getMockBuilder('Drupal\Core\Entity\ContentEntityBase')
+    $mock_base = $this->getMockBuilder(ContentEntityBase::class)
       ->disableOriginalConstructor()
       ->setMethods(['getFieldDefinitions', 'get'])
       ->getMockForAbstractClass();
@@ -558,7 +572,7 @@ public function testGetFields($expected, $include_computed, $is_computed, $field
     // Mock field definition objects for each element of $field_definitions.
     $mocked_field_definitions = [];
     foreach ($field_definitions as $name) {
-      $mock_definition = $this->getMockBuilder('Drupal\Core\Field\FieldDefinitionInterface')
+      $mock_definition = $this->getMockBuilder(FieldDefinitionInterface::class)
         ->setMethods(['isComputed'])
         ->getMockForAbstractClass();
       // Set expectations for isComputed(). isComputed() gets called whenever
diff --git a/core/tests/Drupal/Tests/Core/Entity/Enhancer/EntityRouteEnhancerTest.php b/core/tests/Drupal/Tests/Core/Entity/Enhancer/EntityRouteEnhancerTest.php
index 1b6525a..90451c6 100644
--- a/core/tests/Drupal/Tests/Core/Entity/Enhancer/EntityRouteEnhancerTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/Enhancer/EntityRouteEnhancerTest.php
@@ -6,6 +6,7 @@
 use Drupal\Tests\UnitTestCase;
 use Symfony\Cmf\Component\Routing\RouteObjectInterface;
 use Symfony\Component\HttpFoundation\Request;
+use Symfony\Component\Routing\Route;
 
 /**
  * @coversDefaultClass \Drupal\Core\Entity\Enhancer\EntityRouteEnhancer
@@ -62,7 +63,7 @@ public function testEnhancer() {
     // Add a converter.
     $options['parameters']['foo'] = ['type' => 'entity:entity_test'];
     // Set the route.
-    $route = $this->getMockBuilder('Symfony\Component\Routing\Route')
+    $route = $this->getMockBuilder(Route::class)
       ->disableOriginalConstructor()
       ->getMock();
 
diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityConstraintViolationListTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityConstraintViolationListTest.php
index 4afbfe1..2ad598a 100644
--- a/core/tests/Drupal/Tests/Core/Entity/EntityConstraintViolationListTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/EntityConstraintViolationListTest.php
@@ -4,6 +4,7 @@
 
 use Drupal\Core\Entity\EntityConstraintViolationList;
 use Drupal\Core\Entity\FieldableEntityInterface;
+use Drupal\Core\Field\FieldItemListInterface;
 use Drupal\Core\Session\AccountInterface;
 use Drupal\entity_test\Plugin\Validation\Constraint\EntityTestCompositeConstraint;
 use Drupal\Tests\UnitTestCase;
@@ -19,7 +20,7 @@ class EntityConstraintViolationListTest extends UnitTestCase {
    * @covers ::filterByFields
    */
   public function testFilterByFields() {
-    $account = $this->prophesize('\Drupal\Core\Session\AccountInterface')->reveal();
+    $account = $this->prophesize(AccountInterface::class)->reveal();
     $entity = $this->setupEntity($account);
 
     $constraint_list = $this->setupConstraintListWithoutCompositeConstraint($entity);
@@ -34,7 +35,7 @@ public function testFilterByFields() {
    * @covers ::filterByFields
    */
   public function testFilterByFieldsWithCompositeConstraints() {
-    $account = $this->prophesize('\Drupal\Core\Session\AccountInterface')->reveal();
+    $account = $this->prophesize(AccountInterface::class)->reveal();
     $entity = $this->setupEntity($account);
 
     $constraint_list = $this->setupConstraintListWithCompositeConstraint($entity);
@@ -49,7 +50,7 @@ public function testFilterByFieldsWithCompositeConstraints() {
    * @covers ::filterByFieldAccess
    */
   public function testFilterByFieldAccess() {
-    $account = $this->prophesize('\Drupal\Core\Session\AccountInterface')->reveal();
+    $account = $this->prophesize(AccountInterface::class)->reveal();
     $entity = $this->setupEntity($account);
 
     $constraint_list = $this->setupConstraintListWithoutCompositeConstraint($entity);
@@ -64,7 +65,7 @@ public function testFilterByFieldAccess() {
    * @covers ::filterByFieldAccess
    */
   public function testFilterByFieldAccessWithCompositeConstraint() {
-    $account = $this->prophesize('\Drupal\Core\Session\AccountInterface')->reveal();
+    $account = $this->prophesize(AccountInterface::class)->reveal();
     $entity = $this->setupEntity($account);
 
     $constraint_list = $this->setupConstraintListWithCompositeConstraint($entity);
@@ -85,17 +86,17 @@ public function testFilterByFieldAccessWithCompositeConstraint() {
    *   A fieldable entity.
    */
   protected function setupEntity(AccountInterface $account) {
-    $prophecy = $this->prophesize('\Drupal\Core\Field\FieldItemListInterface');
+    $prophecy = $this->prophesize(FieldItemListInterface::class);
     $prophecy->access('edit', $account)
       ->willReturn(FALSE);
     $name_field_item_list = $prophecy->reveal();
 
-    $prophecy = $this->prophesize('\Drupal\Core\Field\FieldItemListInterface');
+    $prophecy = $this->prophesize(FieldItemListInterface::class);
     $prophecy->access('edit', $account)
       ->willReturn(TRUE);
     $type_field_item_list = $prophecy->reveal();
 
-    $prophecy = $this->prophesize('\Drupal\Core\Entity\FieldableEntityInterface');
+    $prophecy = $this->prophesize(FieldableEntityInterface::class);
     $prophecy->hasField('name')
       ->willReturn(TRUE);
     $prophecy->hasField('type')
diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityCreateAccessCheckTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityCreateAccessCheckTest.php
index 2c3d132..b3485b3 100644
--- a/core/tests/Drupal/Tests/Core/Entity/EntityCreateAccessCheckTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/EntityCreateAccessCheckTest.php
@@ -5,9 +5,14 @@
 use Drupal\Core\Access\AccessResult;
 use Drupal\Core\Cache\Context\CacheContextsManager;
 use Drupal\Core\DependencyInjection\Container;
+use Drupal\Core\Entity\EntityAccessControlHandlerInterface;
 use Drupal\Core\Entity\EntityCreateAccessCheck;
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Routing\RouteMatchInterface;
+use Drupal\Core\Session\AccountInterface;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
+use Symfony\Component\Routing\Route;
 
 /**
  * @coversDefaultClass \Drupal\Core\Entity\EntityCreateAccessCheck
@@ -75,12 +80,12 @@ public function testAccess($entity_bundle, $requirement, $access, $expected, $ex
       $expected_access_result->cachePerPermissions();
     }
 
-    $entity_manager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
+    $entity_manager = $this->getMock(EntityManagerInterface::class);
 
     // Don't expect a call to the access control handler when we have a bundle
     // argument requirement but no bundle is provided.
     if ($entity_bundle || strpos($requirement, '{') === FALSE) {
-      $access_control_handler = $this->getMock('Drupal\Core\Entity\EntityAccessControlHandlerInterface');
+      $access_control_handler = $this->getMock(EntityAccessControlHandlerInterface::class);
       $access_control_handler->expects($this->once())
         ->method('createAccess')
         ->with($entity_bundle)
@@ -93,7 +98,7 @@ public function testAccess($entity_bundle, $requirement, $access, $expected, $ex
 
     $applies_check = new EntityCreateAccessCheck($entity_manager);
 
-    $route = $this->getMockBuilder('Symfony\Component\Routing\Route')
+    $route = $this->getMockBuilder(Route::class)
       ->disableOriginalConstructor()
       ->getMock();
     $route->expects($this->any())
@@ -106,12 +111,12 @@ public function testAccess($entity_bundle, $requirement, $access, $expected, $ex
       $raw_variables->set('bundle_argument', $entity_bundle);
     }
 
-    $route_match = $this->getMock('Drupal\Core\Routing\RouteMatchInterface');
+    $route_match = $this->getMock(RouteMatchInterface::class);
     $route_match->expects($this->any())
       ->method('getRawParameters')
       ->will($this->returnValue($raw_variables));
 
-    $account = $this->getMock('Drupal\Core\Session\AccountInterface');
+    $account = $this->getMock(AccountInterface::class);
     $this->assertEquals($expected_access_result, $applies_check->access($route, $route_match, $account));
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityFormBuilderTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityFormBuilderTest.php
index 963c1a1..3a5d44d 100644
--- a/core/tests/Drupal/Tests/Core/Entity/EntityFormBuilderTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/EntityFormBuilderTest.php
@@ -3,6 +3,10 @@
 namespace Drupal\Tests\Core\Entity;
 
 use Drupal\Core\Entity\EntityFormBuilder;
+use Drupal\Core\Entity\EntityFormInterface;
+use Drupal\Core\Entity\EntityInterface;
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Form\FormBuilderInterface;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -38,8 +42,8 @@ class EntityFormBuilderTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $this->formBuilder = $this->getMock('Drupal\Core\Form\FormBuilderInterface');
-    $this->entityManager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
+    $this->formBuilder = $this->getMock(FormBuilderInterface::class);
+    $this->entityManager = $this->getMock(EntityManagerInterface::class);
     $this->entityFormBuilder = new EntityFormBuilder($this->entityManager, $this->formBuilder);
   }
 
@@ -49,7 +53,7 @@ protected function setUp() {
    * @covers ::getForm
    */
   public function testGetForm() {
-    $form_controller = $this->getMock('Drupal\Core\Entity\EntityFormInterface');
+    $form_controller = $this->getMock(EntityFormInterface::class);
     $form_controller->expects($this->any())
       ->method('getFormId')
       ->will($this->returnValue('the_form_id'));
@@ -63,7 +67,7 @@ public function testGetForm() {
       ->with($form_controller, $this->isInstanceOf('Drupal\Core\Form\FormStateInterface'))
       ->will($this->returnValue('the form contents'));
 
-    $entity = $this->getMock('Drupal\Core\Entity\EntityInterface');
+    $entity = $this->getMock(EntityInterface::class);
     $entity->expects($this->once())
       ->method('getEntityTypeId')
       ->will($this->returnValue('the_entity_type'));
diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityFormTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityFormTest.php
index 4bed37d..1271662 100644
--- a/core/tests/Drupal/Tests/Core/Entity/EntityFormTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/EntityFormTest.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\Tests\Core\Entity;
 
+use Drupal\Core\Entity\Entity;
 use Drupal\Core\Entity\EntityForm;
 use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Entity\EntityStorageInterface;
@@ -9,6 +10,7 @@
 use Drupal\Core\Entity\EntityTypeManagerInterface;
 use Drupal\Core\Form\FormState;
 use Drupal\Core\Routing\RouteMatch;
+use Drupal\Tests\Core\Config\Entity\Fixtures\ConfigEntityBaseWithPluginCollections;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\Routing\Route;
 
@@ -52,7 +54,7 @@ protected function setUp() {
   public function testFormId($expected, $definition) {
     $this->entityType->set('entity_keys', ['bundle' => $definition['bundle']]);
 
-    $entity = $this->getMockForAbstractClass('Drupal\Core\Entity\Entity', [[], $definition['entity_type']], '', TRUE, TRUE, TRUE, ['getEntityType', 'bundle']);
+    $entity = $this->getMockForAbstractClass(Entity::class, [[], $definition['entity_type']], '', TRUE, TRUE, TRUE, ['getEntityType', 'bundle']);
 
     $entity->expects($this->any())
       ->method('getEntityType')
@@ -106,7 +108,7 @@ public function providerTestFormIds() {
   public function testCopyFormValuesToEntity() {
     $entity_id = 'test_config_entity_id';
     $values = ['id' => $entity_id];
-    $entity = $this->getMockBuilder('\Drupal\Tests\Core\Config\Entity\Fixtures\ConfigEntityBaseWithPluginCollections')
+    $entity = $this->getMockBuilder(ConfigEntityBaseWithPluginCollections::class)
       ->setConstructorArgs([$values, 'test_config_entity'])
       ->setMethods(['getPluginCollections'])
       ->getMock();
diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityLinkTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityLinkTest.php
index 60bd425..e5d02ff 100644
--- a/core/tests/Drupal/Tests/Core/Entity/EntityLinkTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/EntityLinkTest.php
@@ -3,8 +3,13 @@
 namespace Drupal\Tests\Core\Entity;
 
 use Drupal\Core\DependencyInjection\ContainerBuilder;
+use Drupal\Core\Entity\Entity;
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Entity\EntityTypeInterface;
 use Drupal\Core\Language\Language;
+use Drupal\Core\Language\LanguageManagerInterface;
 use Drupal\Core\Link;
+use Drupal\Core\Utility\LinkGeneratorInterface;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -40,9 +45,9 @@ class EntityLinkTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $this->entityManager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
-    $this->linkGenerator = $this->getMock('Drupal\Core\Utility\LinkGeneratorInterface');
-    $this->languageManager = $this->getMock('Drupal\Core\Language\LanguageManagerInterface');
+    $this->entityManager = $this->getMock(EntityManagerInterface::class);
+    $this->linkGenerator = $this->getMock(LinkGeneratorInterface::class);
+    $this->languageManager = $this->getMock(LanguageManagerInterface::class);
 
     $container = new ContainerBuilder();
     $container->set('entity.manager', $this->entityManager);
@@ -75,7 +80,7 @@ public function testLink($entity_label, $link_text, $expected_text, $link_rel =
     $entity_type_id = 'test_entity_type';
     $expected = '<a href="/test_entity_type/test_entity_id">' . $expected_text . '</a>';
 
-    $entity_type = $this->getMock('Drupal\Core\Entity\EntityTypeInterface');
+    $entity_type = $this->getMock(EntityTypeInterface::class);
     $entity_type->expects($this->once())
       ->method('getLinkTemplates')
       ->willReturn($route_name_map);
@@ -93,7 +98,7 @@ public function testLink($entity_label, $link_text, $expected_text, $link_rel =
       ->will($this->returnValue($entity_type));
 
     /** @var \Drupal\Core\Entity\Entity $entity */
-    $entity = $this->getMockForAbstractClass('Drupal\Core\Entity\Entity', [
+    $entity = $this->getMockForAbstractClass(Entity::class, [
       ['id' => $entity_id, 'label' => $entity_label, 'langcode' => 'es'],
       $entity_type_id,
     ]);
@@ -137,7 +142,7 @@ public function testToLink($entity_label, $link_text, $expected_text, $link_rel
     $entity_type_id = 'test_entity_type';
     $expected = '<a href="/test_entity_type/test_entity_id">' . $expected_text . '</a>';
 
-    $entity_type = $this->getMock('Drupal\Core\Entity\EntityTypeInterface');
+    $entity_type = $this->getMock(EntityTypeInterface::class);
     $entity_type->expects($this->once())
       ->method('getLinkTemplates')
       ->willReturn($route_name_map);
@@ -155,7 +160,7 @@ public function testToLink($entity_label, $link_text, $expected_text, $link_rel
       ->will($this->returnValue($entity_type));
 
     /** @var \Drupal\Core\Entity\Entity $entity */
-    $entity = $this->getMockForAbstractClass('Drupal\Core\Entity\Entity', [
+    $entity = $this->getMockForAbstractClass(Entity::class, [
       ['id' => $entity_id, 'label' => $entity_label, 'langcode' => 'es'],
       $entity_type_id,
     ]);
diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityListBuilderTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityListBuilderTest.php
index 44e771c..60f4bdb 100644
--- a/core/tests/Drupal/Tests/Core/Entity/EntityListBuilderTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/EntityListBuilderTest.php
@@ -7,12 +7,18 @@
 
 namespace Drupal\Tests\Core\Entity;
 
+use Drupal\Core\Url;
 use Drupal\Core\Access\AccessResult;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
 use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Entity\EntityListBuilder;
+use Drupal\Core\Entity\EntityTypeInterface;
+use Drupal\Core\Extension\ModuleHandlerInterface;
+use Drupal\Core\StringTranslation\TranslationInterface;
 use Drupal\entity_test\EntityTestListBuilder;
 use Drupal\Tests\UnitTestCase;
+use Drupal\user\RoleInterface;
+use Drupal\user\RoleStorageInterface;
 
 /**
  * @coversDefaultClass \Drupal\entity_test\EntityTestListBuilder
@@ -75,11 +81,11 @@ class EntityListBuilderTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $this->role = $this->getMock('Drupal\user\RoleInterface');
-    $this->roleStorage = $this->getMock('\Drupal\user\RoleStorageInterface');
-    $this->moduleHandler = $this->getMock('\Drupal\Core\Extension\ModuleHandlerInterface');
-    $this->entityType = $this->getMock('\Drupal\Core\Entity\EntityTypeInterface');
-    $this->translationManager = $this->getMock('\Drupal\Core\StringTranslation\TranslationInterface');
+    $this->role = $this->getMock(RoleInterface::class);
+    $this->roleStorage = $this->getMock(RoleStorageInterface::class);
+    $this->moduleHandler = $this->getMock(ModuleHandlerInterface::class);
+    $this->entityType = $this->getMock(EntityTypeInterface::class);
+    $this->translationManager = $this->getMock(TranslationInterface::class);
     $this->entityListBuilder = new TestEntityListBuilder($this->entityType, $this->roleStorage, $this->moduleHandler);
     $this->container = new ContainerBuilder();
     \Drupal::setContainer($this->container);
@@ -111,7 +117,7 @@ public function testGetOperations() {
     $this->role->expects($this->any())
       ->method('hasLinkTemplate')
       ->will($this->returnValue(TRUE));
-    $url = $this->getMockBuilder('\Drupal\Core\Url')
+    $url = $this->getMockBuilder(Url::class)
       ->disableOriginalConstructor()
       ->getMock();
     $url->expects($this->any())
diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityResolverManagerTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityResolverManagerTest.php
index d2e5eae..7c3f9d8 100644
--- a/core/tests/Drupal/Tests/Core/Entity/EntityResolverManagerTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/EntityResolverManagerTest.php
@@ -9,11 +9,14 @@
 
 use Drupal\Core\Entity\Entity;
 use Drupal\Core\Entity\EntityInterface;
+use Drupal\Core\Entity\EntityManagerInterface;
 use Drupal\Core\Entity\EntityResolverManager;
+use Drupal\Core\Entity\EntityTypeInterface;
 use Drupal\Core\Form\FormBase;
 use Drupal\Core\Form\FormInterface;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Tests\UnitTestCase;
+use Symfony\Component\DependencyInjection\ContainerInterface;
 use Symfony\Component\Routing\Route;
 
 /**
@@ -56,8 +59,8 @@ class EntityResolverManagerTest extends UnitTestCase {
    * @covers ::__construct
    */
   protected function setUp() {
-    $this->entityManager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
-    $this->container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
+    $this->entityManager = $this->getMock(EntityManagerInterface::class);
+    $this->container = $this->getMock(ContainerInterface::class);
     $this->classResolver = $this->getClassResolverStub();
 
     $this->entityResolverManager = new EntityResolverManager($this->entityManager, $this->classResolver);
@@ -441,7 +444,7 @@ public function testSetRouteOptionsWithEntityAddFormRoute() {
    * Creates the entity manager mock returning entity type objects.
    */
   protected function setupEntityTypes() {
-    $definition = $this->getMock('Drupal\Core\Entity\EntityTypeInterface');
+    $definition = $this->getMock(EntityTypeInterface::class);
     $definition->expects($this->any())
       ->method('getClass')
       ->will($this->returnValue('Drupal\Tests\Core\Entity\SimpleTestEntity'));
diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php
index d1045f5..555a907 100644
--- a/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php
@@ -2,8 +2,10 @@
 
 namespace Drupal\Tests\Core\Entity;
 
+use Drupal\Core\Entity\EntityHandlerBase;
 use Drupal\Core\Entity\EntityType;
 use Drupal\Core\Entity\EntityTypeInterface;
+use Drupal\Core\Entity\Exception\EntityTypeIdLengthException;
 use Drupal\Core\StringTranslation\TranslatableMarkup;
 use Drupal\Tests\UnitTestCase;
 
@@ -255,7 +257,7 @@ public function testGetViewBuilderClass() {
   public function testIdExceedsMaxLength() {
     $id = $this->randomMachineName(33);
     $message = 'Attempt to create an entity type with an ID longer than 32 characters: ' . $id;
-    $this->setExpectedException('Drupal\Core\Entity\Exception\EntityTypeIdLengthException', $message);
+    $this->setExpectedException(EntityTypeIdLengthException::class, $message);
     $this->setUpEntityType(['id' => $id]);
   }
 
@@ -395,7 +397,7 @@ public function testGetCountLabelDefault() {
    *   A mock controller class name.
    */
   protected function getTestHandlerClass() {
-    return get_class($this->getMockForAbstractClass('Drupal\Core\Entity\EntityHandlerBase'));
+    return get_class($this->getMockForAbstractClass(EntityHandlerBase::class));
   }
 
   /**
diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php
index ad9e49c..1641c70 100644
--- a/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php
@@ -2,10 +2,20 @@
 
 namespace Drupal\Tests\Core\Entity;
 
+use Drupal\Component\Uuid\UuidInterface;
 use Drupal\Core\Access\AccessResult;
 use Drupal\Core\Cache\Cache;
+use Drupal\Core\Cache\CacheTagsInvalidator;
+use Drupal\Core\Cache\Context\CacheContextsManager;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
+use Drupal\Core\Entity\Entity;
+use Drupal\Core\Entity\EntityAccessControlHandlerInterface;
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Entity\EntityStorageInterface;
+use Drupal\Core\Entity\EntityTypeInterface;
 use Drupal\Core\Language\Language;
+use Drupal\Core\Language\LanguageManagerInterface;
+use Drupal\entity_test\Entity\EntityTestMul;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -89,26 +99,26 @@ protected function setUp() {
     ];
     $this->entityTypeId = $this->randomMachineName();
 
-    $this->entityType = $this->getMock('\Drupal\Core\Entity\EntityTypeInterface');
+    $this->entityType = $this->getMock(EntityTypeInterface::class);
     $this->entityType->expects($this->any())
       ->method('getListCacheTags')
       ->willReturn([$this->entityTypeId . '_list']);
 
-    $this->entityManager = $this->getMock('\Drupal\Core\Entity\EntityManagerInterface');
+    $this->entityManager = $this->getMock(EntityManagerInterface::class);
     $this->entityManager->expects($this->any())
       ->method('getDefinition')
       ->with($this->entityTypeId)
       ->will($this->returnValue($this->entityType));
 
-    $this->uuid = $this->getMock('\Drupal\Component\Uuid\UuidInterface');
+    $this->uuid = $this->getMock(UuidInterface::class);
 
-    $this->languageManager = $this->getMock('\Drupal\Core\Language\LanguageManagerInterface');
+    $this->languageManager = $this->getMock(LanguageManagerInterface::class);
     $this->languageManager->expects($this->any())
       ->method('getLanguage')
       ->with('en')
       ->will($this->returnValue(new Language(['id' => 'en'])));
 
-    $this->cacheTagsInvalidator = $this->getMock('Drupal\Core\Cache\CacheTagsInvalidator');
+    $this->cacheTagsInvalidator = $this->getMock(CacheTagsInvalidator::class);
 
     $container = new ContainerBuilder();
     $container->set('entity.manager', $this->entityManager);
@@ -117,7 +127,7 @@ protected function setUp() {
     $container->set('cache_tags.invalidator', $this->cacheTagsInvalidator);
     \Drupal::setContainer($container);
 
-    $this->entity = $this->getMockForAbstractClass('\Drupal\Core\Entity\Entity', [$this->values, $this->entityTypeId]);
+    $this->entity = $this->getMockForAbstractClass(Entity::class, [$this->values, $this->entityTypeId]);
   }
 
   /**
@@ -204,7 +214,7 @@ public function testLabel() {
    * @covers ::access
    */
   public function testAccess() {
-    $access = $this->getMock('\Drupal\Core\Entity\EntityAccessControlHandlerInterface');
+    $access = $this->getMock(EntityAccessControlHandlerInterface::class);
     $operation = $this->randomMachineName();
     $access->expects($this->at(0))
       ->method('access')
@@ -243,7 +253,7 @@ public function setupTestLoad() {
     unset($methods[array_search('load', $methods)]);
     unset($methods[array_search('loadMultiple', $methods)]);
     unset($methods[array_search('create', $methods)]);
-    $this->entity = $this->getMockBuilder('Drupal\entity_test\Entity\EntityTestMul')
+    $this->entity = $this->getMockBuilder(EntityTestMul::class)
       ->disableOriginalConstructor()
       ->setMethods($methods)
       ->getMock();
@@ -265,7 +275,7 @@ public function testLoad() {
       ->with($class_name)
       ->willReturn($this->entityTypeId);
 
-    $storage = $this->getMock('\Drupal\Core\Entity\EntityStorageInterface');
+    $storage = $this->getMock(EntityStorageInterface::class);
     $storage->expects($this->once())
       ->method('load')
       ->with(1)
@@ -295,7 +305,7 @@ public function testLoadMultiple() {
       ->with($class_name)
       ->willReturn($this->entityTypeId);
 
-    $storage = $this->getMock('\Drupal\Core\Entity\EntityStorageInterface');
+    $storage = $this->getMock(EntityStorageInterface::class);
     $storage->expects($this->once())
       ->method('loadMultiple')
       ->with([1])
@@ -322,7 +332,7 @@ public function testCreate() {
       ->with($class_name)
       ->willReturn($this->entityTypeId);
 
-    $storage = $this->getMock('\Drupal\Core\Entity\EntityStorageInterface');
+    $storage = $this->getMock(EntityStorageInterface::class);
     $storage->expects($this->once())
       ->method('create')
       ->with([])
@@ -341,7 +351,7 @@ public function testCreate() {
    * @covers ::save
    */
   public function testSave() {
-    $storage = $this->getMock('\Drupal\Core\Entity\EntityStorageInterface');
+    $storage = $this->getMock(EntityStorageInterface::class);
     $storage->expects($this->once())
       ->method('save')
       ->with($this->entity);
@@ -357,7 +367,7 @@ public function testSave() {
    */
   public function testDelete() {
     $this->entity->id = $this->randomMachineName();
-    $storage = $this->getMock('\Drupal\Core\Entity\EntityStorageInterface');
+    $storage = $this->getMock(EntityStorageInterface::class);
     // Testing the argument of the delete() method consumes too much memory.
     $storage->expects($this->once())
       ->method('delete');
@@ -380,7 +390,7 @@ public function testGetEntityTypeId() {
    */
   public function testPreSave() {
     // This method is internal, so check for errors on calling it only.
-    $storage = $this->getMock('\Drupal\Core\Entity\EntityStorageInterface');
+    $storage = $this->getMock(EntityStorageInterface::class);
     // Our mocked entity->preSave() returns NULL, so assert that.
     $this->assertNull($this->entity->preSave($storage));
   }
@@ -402,7 +412,7 @@ public function testPostSave() {
       ]);
 
     // This method is internal, so check for errors on calling it only.
-    $storage = $this->getMock('\Drupal\Core\Entity\EntityStorageInterface');
+    $storage = $this->getMock(EntityStorageInterface::class);
 
     // A creation should trigger the invalidation of the "list" cache tag.
     $this->entity->postSave($storage, FALSE);
@@ -416,7 +426,7 @@ public function testPostSave() {
    */
   public function testPreCreate() {
     // This method is internal, so check for errors on calling it only.
-    $storage = $this->getMock('\Drupal\Core\Entity\EntityStorageInterface');
+    $storage = $this->getMock(EntityStorageInterface::class);
     $values = [];
     // Our mocked entity->preCreate() returns NULL, so assert that.
     $this->assertNull($this->entity->preCreate($storage, $values));
@@ -427,7 +437,7 @@ public function testPreCreate() {
    */
   public function testPostCreate() {
     // This method is internal, so check for errors on calling it only.
-    $storage = $this->getMock('\Drupal\Core\Entity\EntityStorageInterface');
+    $storage = $this->getMock(EntityStorageInterface::class);
     // Our mocked entity->postCreate() returns NULL, so assert that.
     $this->assertNull($this->entity->postCreate($storage));
   }
@@ -437,7 +447,7 @@ public function testPostCreate() {
    */
   public function testPreDelete() {
     // This method is internal, so check for errors on calling it only.
-    $storage = $this->getMock('\Drupal\Core\Entity\EntityStorageInterface');
+    $storage = $this->getMock(EntityStorageInterface::class);
     // Our mocked entity->preDelete() returns NULL, so assert that.
     $this->assertNull($this->entity->preDelete($storage, [$this->entity]));
   }
@@ -452,7 +462,7 @@ public function testPostDelete() {
         $this->entityTypeId . ':' . $this->values['id'],
         $this->entityTypeId . '_list',
       ]);
-    $storage = $this->getMock('\Drupal\Core\Entity\EntityStorageInterface');
+    $storage = $this->getMock(EntityStorageInterface::class);
     $storage->expects($this->once())
       ->method('getEntityType')
       ->willReturn($this->entityType);
@@ -466,7 +476,7 @@ public function testPostDelete() {
    */
   public function testPostLoad() {
     // This method is internal, so check for errors on calling it only.
-    $storage = $this->getMock('\Drupal\Core\Entity\EntityStorageInterface');
+    $storage = $this->getMock(EntityStorageInterface::class);
     $entities = [$this->entity];
     // Our mocked entity->postLoad() returns NULL, so assert that.
     $this->assertNull($this->entity->postLoad($storage, $entities));
@@ -506,7 +516,7 @@ public function testCacheTags() {
    * @covers ::addCacheContexts
    */
   public function testCacheContexts() {
-    $cache_contexts_manager = $this->getMockBuilder('Drupal\Core\Cache\Context\CacheContextsManager')
+    $cache_contexts_manager = $this->getMockBuilder(CacheContextsManager::class)
       ->disableOriginalConstructor()
       ->getMock();
     $cache_contexts_manager->method('assertValidTokens')->willReturn(TRUE);
diff --git a/core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php b/core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php
index 6f20444..ec463d2 100644
--- a/core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php
@@ -2,14 +2,21 @@
 
 namespace Drupal\Tests\Core\Entity\KeyValueStore;
 
+use Drupal\Component\Uuid\UuidInterface;
+use Drupal\Core\Cache\CacheTagsInvalidatorInterface;
 use Drupal\Core\Config\Entity\ConfigEntityInterface;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
 use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Entity\EntityMalformedException;
+use Drupal\Core\Entity\EntityManagerInterface;
 use Drupal\Core\Entity\EntityStorageException;
+use Drupal\Core\Entity\EntityTypeInterface;
 use Drupal\Core\Language\Language;
+use Drupal\Core\Language\LanguageManagerInterface;
 use Drupal\Tests\UnitTestCase;
 use Drupal\Core\Entity\KeyValueStore\KeyValueEntityStorage;
+use Drupal\Core\Extension\ModuleHandlerInterface;
+use Drupal\Core\KeyValueStore\KeyValueStoreInterface;
 
 /**
  * @coversDefaultClass \Drupal\Core\Entity\KeyValueStore\KeyValueEntityStorage
@@ -76,7 +83,7 @@ class KeyValueEntityStorageTest extends UnitTestCase {
    */
   protected function setUp() {
     parent::setUp();
-    $this->entityType = $this->getMock('Drupal\Core\Entity\EntityTypeInterface');
+    $this->entityType = $this->getMock(EntityTypeInterface::class);
   }
 
   /**
@@ -102,18 +109,18 @@ protected function setUpKeyValueEntityStorage($uuid_key = 'uuid') {
       ->method('getListCacheTags')
       ->willReturn(['test_entity_type_list']);
 
-    $this->entityManager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
+    $this->entityManager = $this->getMock(EntityManagerInterface::class);
     $this->entityManager->expects($this->any())
       ->method('getDefinition')
       ->with('test_entity_type')
       ->will($this->returnValue($this->entityType));
 
-    $this->cacheTagsInvalidator = $this->getMock('Drupal\Core\Cache\CacheTagsInvalidatorInterface');
+    $this->cacheTagsInvalidator = $this->getMock(CacheTagsInvalidatorInterface::class);
 
-    $this->keyValueStore = $this->getMock('Drupal\Core\KeyValueStore\KeyValueStoreInterface');
-    $this->moduleHandler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface');
-    $this->uuidService = $this->getMock('Drupal\Component\Uuid\UuidInterface');
-    $this->languageManager = $this->getMock('Drupal\Core\Language\LanguageManagerInterface');
+    $this->keyValueStore = $this->getMock(KeyValueStoreInterface::class);
+    $this->moduleHandler = $this->getMock(ModuleHandlerInterface::class);
+    $this->uuidService = $this->getMock(UuidInterface::class);
+    $this->languageManager = $this->getMock(LanguageManagerInterface::class);
     $language = new Language(['langcode' => 'en']);
     $this->languageManager->expects($this->any())
       ->method('getDefaultLanguage')
diff --git a/core/tests/Drupal/Tests/Core/Entity/Query/Sql/QueryTest.php b/core/tests/Drupal/Tests/Core/Entity/Query/Sql/QueryTest.php
index 850e4b4..c8a0f45 100644
--- a/core/tests/Drupal/Tests/Core/Entity/Query/Sql/QueryTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/Query/Sql/QueryTest.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\Tests\Core\Entity\Query\Sql;
 
+use Drupal\Core\Database\Connection;
 use Drupal\Core\Entity\EntityType;
 use Drupal\Tests\UnitTestCase;
 use Drupal\Core\Entity\Query\QueryException;
@@ -27,7 +28,7 @@ protected function setUp() {
     parent::setUp();
     $entity_type = new EntityType(['id' => 'example_entity_query']);
     $conjunction = 'AND';
-    $connection = $this->getMockBuilder('Drupal\Core\Database\Connection')->disableOriginalConstructor()->getMock();
+    $connection = $this->getMockBuilder(Connection::class)->disableOriginalConstructor()->getMock();
     $namespaces = ['Drupal\Core\Entity\Query\Sql'];
 
     $this->query = new Query($entity_type, $conjunction, $connection, $namespaces);
diff --git a/core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php b/core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php
index 39c9a05..9e17f4a 100644
--- a/core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php
@@ -2,9 +2,14 @@
 
 namespace Drupal\Tests\Core\Entity\Sql;
 
+use Drupal\Core\Entity\ContentEntityTypeInterface;
+use Drupal\Core\Entity\EntityManagerInterface;
 use Drupal\Core\Entity\Sql\DefaultTableMapping;
+use Drupal\Core\Entity\Sql\SqlContentEntityStorage;
 use Drupal\Core\Entity\Sql\SqlContentEntityStorageException;
+use Drupal\Tests\Core\Field\TestBaseFieldDefinitionInterface;
 use Drupal\Tests\UnitTestCase;
+use Symfony\Component\DependencyInjection\ContainerInterface;
 
 /**
  * @coversDefaultClass \Drupal\Core\Entity\Sql\DefaultTableMapping
@@ -25,7 +30,7 @@ class DefaultTableMappingTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $this->entityType = $this->getMock('\Drupal\Core\Entity\ContentEntityTypeInterface');
+    $this->entityType = $this->getMock(ContentEntityTypeInterface::class);
     $this->entityType
       ->expects($this->any())
       ->method('id')
@@ -362,7 +367,7 @@ public function testGetFieldTableName($table_names, $expected) {
       ->method('getColumns')
       ->willReturn($columns);
 
-    $storage = $this->getMockBuilder('\Drupal\Core\Entity\Sql\SqlContentEntityStorage')
+    $storage = $this->getMockBuilder(SqlContentEntityStorage::class)
       ->disableOriginalConstructor()
       ->getMock();
 
@@ -381,13 +386,13 @@ public function testGetFieldTableName($table_names, $expected) {
       ->method('getRevisionTable')
       ->willReturn(isset($table_names['revision']) ? $table_names['revision'] : NULL);
 
-    $entity_manager = $this->getMock('\Drupal\Core\Entity\EntityManagerInterface');
+    $entity_manager = $this->getMock(EntityManagerInterface::class);
     $entity_manager
       ->expects($this->any())
       ->method('getStorage')
       ->willReturn($storage);
 
-    $container = $this->getMock('\Symfony\Component\DependencyInjection\ContainerInterface');
+    $container = $this->getMock(ContainerInterface::class);
     $container
       ->expects($this->any())
       ->method('get')
@@ -458,7 +463,7 @@ public function testGetFieldTableNameInvalid() {
    * @return \Drupal\Core\Field\FieldStorageDefinitionInterface|\PHPUnit_Framework_MockObject_MockObject
    */
   protected function setUpDefinition($name, array $column_names, $base_field = TRUE) {
-    $definition = $this->getMock('Drupal\Tests\Core\Field\TestBaseFieldDefinitionInterface');
+    $definition = $this->getMock(TestBaseFieldDefinitionInterface::class);
     $definition->expects($this->any())
       ->method('isBaseField')
       ->willReturn($base_field);
diff --git a/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageSchemaTest.php b/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageSchemaTest.php
index aecc3e4..1e06f90 100644
--- a/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageSchemaTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageSchemaTest.php
@@ -2,9 +2,18 @@
 
 namespace Drupal\Tests\Core\Entity\Sql;
 
+use Drupal\Core\Database\Connection;
+use Drupal\Core\Database\Schema;
 use Drupal\Core\Entity\ContentEntityType;
 use Drupal\Core\Entity\ContentEntityTypeInterface;
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Entity\EntityTypeInterface;
 use Drupal\Core\Entity\Sql\DefaultTableMapping;
+use Drupal\Core\Entity\Sql\SqlContentEntityStorage;
+use Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema;
+use Drupal\Core\KeyValueStore\KeyValueStoreInterface;
+use Drupal\Core\TypedData\DataDefinitionInterface;
+use Drupal\Tests\Core\Field\TestBaseFieldDefinitionInterface;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -59,8 +68,8 @@ class SqlContentEntityStorageSchemaTest extends UnitTestCase {
    * {@inheritdoc}
    */
   protected function setUp() {
-    $this->entityManager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
-    $this->storage = $this->getMockBuilder('Drupal\Core\Entity\Sql\SqlContentEntityStorage')
+    $this->entityManager = $this->getMock(EntityManagerInterface::class);
+    $this->storage = $this->getMockBuilder(SqlContentEntityStorage::class)
       ->disableOriginalConstructor()
       ->getMock();
 
@@ -1115,21 +1124,21 @@ public function testDedicatedTableSchemaForEntityWithStringIdentifier() {
   }
 
   public function providerTestRequiresEntityDataMigration() {
-    $updated_entity_type_definition = $this->getMock('\Drupal\Core\Entity\EntityTypeInterface');
+    $updated_entity_type_definition = $this->getMock(EntityTypeInterface::class);
     $updated_entity_type_definition->expects($this->any())
       ->method('getStorageClass')
       // A class that exists, *any* class.
       ->willReturn('\Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema');
-    $original_entity_type_definition = $this->getMock('\Drupal\Core\Entity\EntityTypeInterface');
+    $original_entity_type_definition = $this->getMock(EntityTypeInterface::class);
     $original_entity_type_definition->expects($this->any())
       ->method('getStorageClass')
       // A class that exists, *any* class.
       ->willReturn('\Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema');
-    $original_entity_type_definition_other_nonexisting = $this->getMock('\Drupal\Core\Entity\EntityTypeInterface');
+    $original_entity_type_definition_other_nonexisting = $this->getMock(EntityTypeInterface::class);
     $original_entity_type_definition_other_nonexisting->expects($this->any())
       ->method('getStorageClass')
       ->willReturn('bar');
-    $original_entity_type_definition_other_existing = $this->getMock('\Drupal\Core\Entity\EntityTypeInterface');
+    $original_entity_type_definition_other_existing = $this->getMock(EntityTypeInterface::class);
     $original_entity_type_definition_other_existing->expects($this->any())
       ->method('getStorageClass')
       // A class that exists, *any* class.
@@ -1167,7 +1176,7 @@ public function testRequiresEntityDataMigration($updated_entity_type_definition,
       'entity_keys' => ['id' => 'id'],
     ]);
 
-    $original_storage = $this->getMockBuilder('Drupal\Core\Entity\Sql\SqlContentEntityStorage')
+    $original_storage = $this->getMockBuilder(SqlContentEntityStorage::class)
       ->disableOriginalConstructor()
       ->getMock();
 
@@ -1179,7 +1188,7 @@ public function testRequiresEntityDataMigration($updated_entity_type_definition,
     $this->storage->expects($this->never())
       ->method('hasData');
 
-    $connection = $this->getMockBuilder('Drupal\Core\Database\Connection')
+    $connection = $this->getMockBuilder(Connection::class)
       ->disableOriginalConstructor()
       ->getMock();
 
@@ -1187,7 +1196,7 @@ public function testRequiresEntityDataMigration($updated_entity_type_definition,
       ->method('createHandlerInstance')
       ->willReturn($original_storage);
 
-    $this->storageSchema = $this->getMockBuilder('Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema')
+    $this->storageSchema = $this->getMockBuilder(SqlContentEntityStorageSchema::class)
       ->setConstructorArgs([$this->entityManager, $this->entityType, $this->storage, $connection])
       ->setMethods(['installedStorageSchema', 'hasSharedTableStructureChange'])
       ->getMock();
@@ -1207,8 +1216,8 @@ public function providerTestRequiresEntityStorageSchemaChanges() {
 
     $cases = [];
 
-    $updated_entity_type_definition = $this->getMock('\Drupal\Core\Entity\ContentEntityTypeInterface');
-    $original_entity_type_definition = $this->getMock('\Drupal\Core\Entity\ContentEntityTypeInterface');
+    $updated_entity_type_definition = $this->getMock(ContentEntityTypeInterface::class);
+    $original_entity_type_definition = $this->getMock(ContentEntityTypeInterface::class);
 
     $updated_entity_type_definition->expects($this->any())
       ->method('id')
@@ -1332,7 +1341,7 @@ protected function setUpStorageSchema(array $expected = []) {
       ->with($this->entityType->id())
       ->will($this->returnValue($this->storageDefinitions));
 
-    $this->dbSchemaHandler = $this->getMockBuilder('Drupal\Core\Database\Schema')
+    $this->dbSchemaHandler = $this->getMockBuilder(Schema::class)
       ->disableOriginalConstructor()
       ->getMock();
 
@@ -1356,15 +1365,15 @@ protected function setUpStorageSchema(array $expected = []) {
         }));
     }
 
-    $connection = $this->getMockBuilder('Drupal\Core\Database\Connection')
+    $connection = $this->getMockBuilder(Connection::class)
       ->disableOriginalConstructor()
       ->getMock();
     $connection->expects($this->any())
       ->method('schema')
       ->will($this->returnValue($this->dbSchemaHandler));
 
-    $key_value = $this->getMock('Drupal\Core\KeyValueStore\KeyValueStoreInterface');
-    $this->storageSchema = $this->getMockBuilder('Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema')
+    $key_value = $this->getMock(KeyValueStoreInterface::class);
+    $this->storageSchema = $this->getMockBuilder(SqlContentEntityStorageSchema::class)
       ->setConstructorArgs([$this->entityManager, $this->entityType, $this->storage, $connection])
       ->setMethods(['installedStorageSchema', 'loadEntitySchemaData', 'hasSharedTableNameChanges', 'isTableEmpty'])
       ->getMock();
@@ -1388,7 +1397,7 @@ protected function setUpStorageSchema(array $expected = []) {
    *   FieldStorageDefinitionInterface::getSchema().
    */
   public function setUpStorageDefinition($field_name, array $schema) {
-    $this->storageDefinitions[$field_name] = $this->getMock('Drupal\Tests\Core\Field\TestBaseFieldDefinitionInterface');
+    $this->storageDefinitions[$field_name] = $this->getMock(TestBaseFieldDefinitionInterface::class);
     $this->storageDefinitions[$field_name]->expects($this->any())
       ->method('isBaseField')
       ->will($this->returnValue(TRUE));
@@ -1407,7 +1416,7 @@ public function setUpStorageDefinition($field_name, array $schema) {
     if (!empty($schema['columns'])) {
       $property_definitions = [];
       foreach ($schema['columns'] as $column => $info) {
-        $property_definitions[$column] = $this->getMock('Drupal\Core\TypedData\DataDefinitionInterface');
+        $property_definitions[$column] = $this->getMock(DataDefinitionInterface::class);
         $property_definitions[$column]->expects($this->any())
           ->method('isRequired')
           ->will($this->returnValue(!empty($info['not null'])));
diff --git a/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php b/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php
index b3e339b..2c33615 100644
--- a/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php
@@ -8,11 +8,23 @@
 namespace Drupal\Tests\Core\Entity\Sql;
 
 use Drupal\Core\Cache\CacheBackendInterface;
+use Drupal\Core\Database\Connection;
+use Drupal\Core\Database\Schema;
+use Drupal\Core\Entity\ContentEntityBase;
+use Drupal\Core\Entity\ContentEntityTypeInterface;
 use Drupal\Core\Entity\EntityInterface;
+use Drupal\Core\Entity\EntityManagerInterface;
 use Drupal\Core\Entity\EntityStorageInterface;
 use Drupal\Core\Entity\Query\QueryFactoryInterface;
+use Drupal\Core\Entity\Query\QueryInterface;
 use Drupal\Core\Entity\Sql\SqlContentEntityStorage;
+use Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema;
+use Drupal\Core\Extension\ModuleHandlerInterface;
+use Drupal\Core\KeyValueStore\KeyValueStoreInterface;
 use Drupal\Core\Language\Language;
+use Drupal\Core\Language\LanguageManagerInterface;
+use Drupal\Tests\Core\Entity\Sql\SqlContentEntityStorageTestEntityInterface;
+use Drupal\Tests\Core\Field\TestBaseFieldDefinitionInterface;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\DependencyInjection\ContainerBuilder;
 
@@ -96,7 +108,7 @@ class SqlContentEntityStorageTest extends UnitTestCase {
    * {@inheritdoc}
    */
   protected function setUp() {
-    $this->entityType = $this->getMock('Drupal\Core\Entity\ContentEntityTypeInterface');
+    $this->entityType = $this->getMock(ContentEntityTypeInterface::class);
     $this->entityType->expects($this->any())
       ->method('id')
       ->will($this->returnValue($this->entityTypeId));
@@ -104,14 +116,14 @@ protected function setUp() {
     $this->container = new ContainerBuilder();
     \Drupal::setContainer($this->container);
 
-    $this->entityManager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
-    $this->moduleHandler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface');
-    $this->cache = $this->getMock('Drupal\Core\Cache\CacheBackendInterface');
-    $this->languageManager = $this->getMock('Drupal\Core\Language\LanguageManagerInterface');
+    $this->entityManager = $this->getMock(EntityManagerInterface::class);
+    $this->moduleHandler = $this->getMock(ModuleHandlerInterface::class);
+    $this->cache = $this->getMock(CacheBackendInterface::class);
+    $this->languageManager = $this->getMock(LanguageManagerInterface::class);
     $this->languageManager->expects($this->any())
       ->method('getDefaultLanguage')
       ->will($this->returnValue(new Language(['langcode' => 'en'])));
-    $this->connection = $this->getMockBuilder('Drupal\Core\Database\Connection')
+    $this->connection = $this->getMockBuilder(Connection::class)
       ->disableOriginalConstructor()
       ->getMock();
   }
@@ -331,7 +343,7 @@ public function testOnEntityTypeCreate() {
       'foreign keys' => [],
     ];
 
-    $schema_handler = $this->getMockBuilder('Drupal\Core\Database\Schema')
+    $schema_handler = $this->getMockBuilder(Schema::class)
       ->disableOriginalConstructor()
       ->getMock();
     $schema_handler->expects($this->any())
@@ -342,13 +354,13 @@ public function testOnEntityTypeCreate() {
       ->method('schema')
       ->will($this->returnValue($schema_handler));
 
-    $storage = $this->getMockBuilder('Drupal\Core\Entity\Sql\SqlContentEntityStorage')
+    $storage = $this->getMockBuilder(SqlContentEntityStorage::class)
       ->setConstructorArgs([$this->entityType, $this->connection, $this->entityManager, $this->cache, $this->languageManager])
       ->setMethods(['getStorageSchema'])
       ->getMock();
 
-    $key_value = $this->getMock('Drupal\Core\KeyValueStore\KeyValueStoreInterface');
-    $schema_handler = $this->getMockBuilder('Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema')
+    $key_value = $this->getMock(KeyValueStoreInterface::class);
+    $schema_handler = $this->getMockBuilder(SqlContentEntityStorageSchema::class)
       ->setConstructorArgs([$this->entityManager, $this->entityType, $storage, $this->connection])
       ->setMethods(['installedStorageSchema', 'createSharedTableSchema'])
       ->getMock();
@@ -994,7 +1006,7 @@ public function testGetTableMappingRevisionableTranslatableWithFields(array $ent
    * @covers ::create
    */
   public function testCreate() {
-    $language_manager = $this->getMock('Drupal\Core\Language\LanguageManagerInterface');
+    $language_manager = $this->getMock(LanguageManagerInterface::class);
 
     $language = new Language(['id' => 'en']);
     $language_manager->expects($this->any())
@@ -1005,7 +1017,7 @@ public function testCreate() {
     $this->container->set('entity.manager', $this->entityManager);
     $this->container->set('module_handler', $this->moduleHandler);
 
-    $entity = $this->getMockBuilder('Drupal\Core\Entity\ContentEntityBase')
+    $entity = $this->getMockBuilder(ContentEntityBase::class)
       ->disableOriginalConstructor()
       ->setMethods(['id'])
       ->getMockForAbstractClass();
@@ -1060,7 +1072,7 @@ public function testCreate() {
    */
   protected function mockFieldDefinitions(array $field_names, $methods = []) {
     $field_definitions = [];
-    $definition = $this->getMock('Drupal\Tests\Core\Field\TestBaseFieldDefinitionInterface');
+    $definition = $this->getMock(TestBaseFieldDefinitionInterface::class);
 
     // Assign common method return values.
     $methods += [
@@ -1089,7 +1101,7 @@ protected function mockFieldDefinitions(array $field_names, $methods = []) {
    * Sets up the content entity database storage.
    */
   protected function setUpEntityStorage() {
-    $this->connection = $this->getMockBuilder('Drupal\Core\Database\Connection')
+    $this->connection = $this->getMockBuilder(Connection::class)
       ->disableOriginalConstructor()
       ->getMock();
 
@@ -1118,7 +1130,7 @@ public function testLoadMultiplePersistentCached() {
 
     $key = 'values:' . $this->entityTypeId . ':1';
     $id = 1;
-    $entity = $this->getMockBuilder('\Drupal\Tests\Core\Entity\Sql\SqlContentEntityStorageTestEntityInterface')
+    $entity = $this->getMockBuilder(SqlContentEntityStorageTestEntityInterface::class)
       ->getMockForAbstractClass();
     $entity->expects($this->any())
       ->method('id')
@@ -1158,7 +1170,7 @@ public function testLoadMultipleNoPersistentCache() {
     $this->setUpModuleHandlerNoImplementations();
 
     $id = 1;
-    $entity = $this->getMockBuilder('\Drupal\Tests\Core\Entity\Sql\SqlContentEntityStorageTestEntityInterface')
+    $entity = $this->getMockBuilder(SqlContentEntityStorageTestEntityInterface::class)
       ->getMockForAbstractClass();
     $entity->expects($this->any())
       ->method('id')
@@ -1181,7 +1193,7 @@ public function testLoadMultipleNoPersistentCache() {
     $this->cache->expects($this->never())
       ->method('set');
 
-    $entity_storage = $this->getMockBuilder('Drupal\Core\Entity\Sql\SqlContentEntityStorage')
+    $entity_storage = $this->getMockBuilder(SqlContentEntityStorage::class)
       ->setConstructorArgs([$this->entityType, $this->connection, $this->entityManager, $this->cache, $this->languageManager])
       ->setMethods(['getFromStorage', 'invokeStorageLoadHook'])
       ->getMock();
@@ -1206,7 +1218,7 @@ public function testLoadMultiplePersistentCacheMiss() {
     $this->setUpModuleHandlerNoImplementations();
 
     $id = 1;
-    $entity = $this->getMockBuilder('\Drupal\Tests\Core\Entity\Sql\SqlContentEntityStorageTestEntityInterface')
+    $entity = $this->getMockBuilder(SqlContentEntityStorageTestEntityInterface::class)
       ->getMockForAbstractClass();
     $entity->expects($this->any())
       ->method('id')
@@ -1233,7 +1245,7 @@ public function testLoadMultiplePersistentCacheMiss() {
       ->method('set')
       ->with($key, $entity, CacheBackendInterface::CACHE_PERMANENT, [$this->entityTypeId . '_values', 'entity_field_info']);
 
-    $entity_storage = $this->getMockBuilder('Drupal\Core\Entity\Sql\SqlContentEntityStorage')
+    $entity_storage = $this->getMockBuilder(SqlContentEntityStorage::class)
       ->setConstructorArgs([$this->entityType, $this->connection, $this->entityManager, $this->cache, $this->languageManager])
       ->setMethods(['getFromStorage', 'invokeStorageLoadHook'])
       ->getMock();
@@ -1252,7 +1264,7 @@ public function testLoadMultiplePersistentCacheMiss() {
    * @covers ::hasData
    */
   public function testHasData() {
-    $query = $this->getMock('Drupal\Core\Entity\Query\QueryInterface');
+    $query = $this->getMock(QueryInterface::class);
     $query->expects(($this->once()))
       ->method('accessCheck')
       ->with(FALSE)
@@ -1273,7 +1285,7 @@ public function testHasData() {
 
     $this->container->set('entity.query.sql', $factory);
 
-    $database = $this->getMockBuilder('Drupal\Core\Database\Connection')
+    $database = $this->getMockBuilder(Connection::class)
       ->disableOriginalConstructor()
       ->getMock();
 
diff --git a/core/tests/Drupal/Tests/Core/Entity/TypedData/EntityAdapterUnitTest.php b/core/tests/Drupal/Tests/Core/Entity/TypedData/EntityAdapterUnitTest.php
index 953daac..7b42705 100644
--- a/core/tests/Drupal/Tests/Core/Entity/TypedData/EntityAdapterUnitTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/TypedData/EntityAdapterUnitTest.php
@@ -2,14 +2,24 @@
 
 namespace Drupal\Tests\Core\Entity\TypedData;
 
+use Drupal\Component\Uuid\UuidInterface;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
+use Drupal\Core\Entity\ContentEntityBase;
+use Drupal\Core\Entity\ContentEntityInterface;
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Entity\EntityTypeInterface;
 use Drupal\Core\Entity\Plugin\DataType\EntityAdapter;
 use Drupal\Core\Field\BaseFieldDefinition;
+use Drupal\Core\Field\FieldItemListInterface;
+use Drupal\Core\Field\FieldTypePluginManager;
 use Drupal\Core\Language\LanguageInterface;
+use Drupal\Core\TypedData\TraversableTypedDataInterface;
 use Drupal\Core\TypedData\Exception\MissingDataException;
 use Drupal\Core\TypedData\TypedDataManagerInterface;
 use Drupal\Tests\UnitTestCase;
 use Drupal\Core\Language\Language;
+use Drupal\Core\Language\LanguageManagerInterface;
+use Drupal\Core\Validation\ConstraintManager;
 
 /**
  * @coversDefaultClass \Drupal\Core\Entity\Plugin\DataType\EntityAdapter
@@ -122,7 +132,7 @@ protected function setUp() {
     $this->entityTypeId = $this->randomMachineName();
     $this->bundle = $this->randomMachineName();
 
-    $this->entityType = $this->getMock('\Drupal\Core\Entity\EntityTypeInterface');
+    $this->entityType = $this->getMock(EntityTypeInterface::class);
     $this->entityType->expects($this->any())
       ->method('getKeys')
       ->will($this->returnValue([
@@ -130,13 +140,13 @@ protected function setUp() {
         'uuid' => 'uuid',
     ]));
 
-    $this->entityManager = $this->getMock('\Drupal\Core\Entity\EntityManagerInterface');
+    $this->entityManager = $this->getMock(EntityManagerInterface::class);
     $this->entityManager->expects($this->any())
       ->method('getDefinition')
       ->with($this->entityTypeId)
       ->will($this->returnValue($this->entityType));
 
-    $this->uuid = $this->getMock('\Drupal\Component\Uuid\UuidInterface');
+    $this->uuid = $this->getMock(UuidInterface::class);
 
     $this->typedDataManager = $this->getMock(TypedDataManagerInterface::class);
     $this->typedDataManager->expects($this->any())
@@ -147,7 +157,7 @@ protected function setUp() {
       ->method('getDefaultConstraints')
       ->willReturn([]);
 
-    $validation_constraint_manager = $this->getMockBuilder('\Drupal\Core\Validation\ConstraintManager')
+    $validation_constraint_manager = $this->getMockBuilder(ConstraintManager::class)
       ->disableOriginalConstructor()
       ->getMock();
     $validation_constraint_manager->expects($this->any())
@@ -158,7 +168,7 @@ protected function setUp() {
       ->willReturn($validation_constraint_manager);
 
     $not_specified = new Language(['id' => LanguageInterface::LANGCODE_NOT_SPECIFIED, 'locked' => TRUE]);
-    $this->languageManager = $this->getMock('\Drupal\Core\Language\LanguageManagerInterface');
+    $this->languageManager = $this->getMock(LanguageManagerInterface::class);
     $this->languageManager->expects($this->any())
       ->method('getLanguages')
       ->will($this->returnValue([LanguageInterface::LANGCODE_NOT_SPECIFIED => $not_specified]));
@@ -168,7 +178,7 @@ protected function setUp() {
       ->with(LanguageInterface::LANGCODE_NOT_SPECIFIED)
       ->will($this->returnValue($not_specified));
 
-    $this->fieldTypePluginManager = $this->getMockBuilder('\Drupal\Core\Field\FieldTypePluginManager')
+    $this->fieldTypePluginManager = $this->getMockBuilder(FieldTypePluginManager::class)
       ->disableOriginalConstructor()
       ->getMock();
     $this->fieldTypePluginManager->expects($this->any())
@@ -178,7 +188,7 @@ protected function setUp() {
       ->method('getDefaultFieldSettings')
       ->will($this->returnValue([]));
 
-    $this->fieldItemList = $this->getMock('\Drupal\Core\Field\FieldItemListInterface');
+    $this->fieldItemList = $this->getMock(FieldItemListInterface::class);
     $this->fieldTypePluginManager->expects($this->any())
       ->method('createFieldItemList')
       ->willReturn($this->fieldItemList);
@@ -200,7 +210,7 @@ protected function setUp() {
       ->method('getFieldDefinitions')
       ->with($this->entityTypeId, $this->bundle)
       ->will($this->returnValue($this->fieldDefinitions));
-    $this->entity = $this->getMockForAbstractClass('\Drupal\Core\Entity\ContentEntityBase', [$values, $this->entityTypeId, $this->bundle]);
+    $this->entity = $this->getMockForAbstractClass(ContentEntityBase::class, [$values, $this->entityTypeId, $this->bundle]);
 
     $this->entityAdapter = EntityAdapter::createFromEntity($this->entity);
   }
@@ -245,7 +255,7 @@ public function testGetParent() {
    */
   public function testSetContext() {
     $name = $this->randomMachineName();
-    $parent = $this->getMock('\Drupal\Core\TypedData\TraversableTypedDataInterface');
+    $parent = $this->getMock(TraversableTypedDataInterface::class);
     // Our mocked entity->setContext() returns NULL, so assert that.
     $this->assertNull($this->entityAdapter->setContext($name, $parent));
     $this->assertEquals($name, $this->entityAdapter->getName());
@@ -356,7 +366,7 @@ public function testIsEmpty() {
    * @covers ::onChange
    */
   public function testOnChange() {
-    $entity = $this->getMock('\Drupal\Core\Entity\ContentEntityInterface');
+    $entity = $this->getMock(ContentEntityInterface::class);
     $entity->expects($this->once())
       ->method('onChange')
       ->with('foo')
@@ -379,7 +389,7 @@ public function testGetDataDefinition() {
    * @covers ::getString
    */
   public function testGetString() {
-    $entity = $this->getMock('\Drupal\Core\Entity\ContentEntityInterface');
+    $entity = $this->getMock(ContentEntityInterface::class);
     $entity->expects($this->once())
       ->method('label')
       ->willReturn('foo');
diff --git a/core/tests/Drupal/Tests/Core/EventSubscriber/CustomPageExceptionHtmlSubscriberTest.php b/core/tests/Drupal/Tests/Core/EventSubscriber/CustomPageExceptionHtmlSubscriberTest.php
index 38cc28c..b5e6301 100644
--- a/core/tests/Drupal/Tests/Core/EventSubscriber/CustomPageExceptionHtmlSubscriberTest.php
+++ b/core/tests/Drupal/Tests/Core/EventSubscriber/CustomPageExceptionHtmlSubscriberTest.php
@@ -3,17 +3,23 @@
 namespace Drupal\Tests\Core\EventSubscriber;
 
 use Drupal\Component\Utility\UrlHelper;
+use Drupal\Core\Access\AccessManagerInterface;
 use Drupal\Core\Access\AccessResult;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
 use Drupal\Core\EventSubscriber\CustomPageExceptionHtmlSubscriber;
+use Drupal\Core\Path\PathValidatorInterface;
 use Drupal\Core\Render\HtmlResponse;
 use Drupal\Core\Routing\AccessAwareRouterInterface;
+use Drupal\Core\Routing\RedirectDestinationInterface;
 use Drupal\Core\Url;
 use Drupal\Tests\UnitTestCase;
+use Psr\Log\LoggerInterface;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpFoundation\Response;
+use Symfony\Component\HttpKernel\HttpKernelInterface;
 use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
 use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
+use Symfony\Component\Routing\Matcher\UrlMatcherInterface;
 use Symfony\Component\Routing\RequestContext;
 
 /**
@@ -83,26 +89,26 @@ class CustomPageExceptionHtmlSubscriberTest extends UnitTestCase {
   protected function setUp() {
     $this->configFactory = $this->getConfigFactoryStub(['system.site' => ['page.403' => '/access-denied-page', 'page.404' => '/not-found-page']]);
 
-    $this->kernel = $this->getMock('Symfony\Component\HttpKernel\HttpKernelInterface');
-    $this->logger = $this->getMock('Psr\Log\LoggerInterface');
-    $this->redirectDestination = $this->getMock('\Drupal\Core\Routing\RedirectDestinationInterface');
+    $this->kernel = $this->getMock(HttpKernelInterface::class);
+    $this->logger = $this->getMock(LoggerInterface::class);
+    $this->redirectDestination = $this->getMock(RedirectDestinationInterface::class);
     $this->redirectDestination->expects($this->any())
       ->method('getAsArray')
       ->willReturn(['destination' => 'test']);
-    $this->accessUnawareRouter = $this->getMock('Symfony\Component\Routing\Matcher\UrlMatcherInterface');
+    $this->accessUnawareRouter = $this->getMock(UrlMatcherInterface::class);
     $this->accessUnawareRouter->expects($this->any())
       ->method('match')
       ->willReturn([
         '_controller' => 'mocked',
       ]);
-    $this->accessManager = $this->getMock('Drupal\Core\Access\AccessManagerInterface');
+    $this->accessManager = $this->getMock(AccessManagerInterface::class);
     $this->accessManager->expects($this->any())
       ->method('checkNamedRoute')
       ->willReturn(AccessResult::allowed()->addCacheTags(['foo', 'bar']));
 
     $this->customPageSubscriber = new CustomPageExceptionHtmlSubscriber($this->configFactory, $this->kernel, $this->logger, $this->redirectDestination, $this->accessUnawareRouter, $this->accessManager);
 
-    $path_validator = $this->getMock('Drupal\Core\Path\PathValidatorInterface');
+    $path_validator = $this->getMock(PathValidatorInterface::class);
     $path_validator->expects($this->any())
       ->method('getUrlIfValidWithoutAccessCheck')
       ->willReturn(Url::fromRoute('foo', ['foo' => 'bar']));
diff --git a/core/tests/Drupal/Tests/Core/EventSubscriber/ModuleRouteSubscriberTest.php b/core/tests/Drupal/Tests/Core/EventSubscriber/ModuleRouteSubscriberTest.php
index 6528d73..93ad695 100644
--- a/core/tests/Drupal/Tests/Core/EventSubscriber/ModuleRouteSubscriberTest.php
+++ b/core/tests/Drupal/Tests/Core/EventSubscriber/ModuleRouteSubscriberTest.php
@@ -5,6 +5,7 @@
 use Drupal\Core\Routing\RouteBuildEvent;
 use Drupal\Tests\UnitTestCase;
 use Drupal\Core\EventSubscriber\ModuleRouteSubscriber;
+use Drupal\Core\Extension\ModuleHandlerInterface;
 use Symfony\Component\Routing\RouteCollection;
 use Symfony\Component\Routing\Route;
 
@@ -22,7 +23,7 @@ class ModuleRouteSubscriberTest extends UnitTestCase {
   protected $moduleHandler;
 
   protected function setUp() {
-    $this->moduleHandler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface');
+    $this->moduleHandler = $this->getMock(ModuleHandlerInterface::class);
 
     $value_map = [
       ['enabled', TRUE],
diff --git a/core/tests/Drupal/Tests/Core/EventSubscriber/PathRootsSubscriberTest.php b/core/tests/Drupal/Tests/Core/EventSubscriber/PathRootsSubscriberTest.php
index ea4ec9f..b494c3e 100644
--- a/core/tests/Drupal/Tests/Core/EventSubscriber/PathRootsSubscriberTest.php
+++ b/core/tests/Drupal/Tests/Core/EventSubscriber/PathRootsSubscriberTest.php
@@ -4,6 +4,7 @@
 
 use Drupal\Core\EventSubscriber\PathRootsSubscriber;
 use Drupal\Core\Routing\RouteBuildEvent;
+use Drupal\Core\State\StateInterface;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\Routing\Route;
 use Symfony\Component\Routing\RouteCollection;
@@ -32,7 +33,7 @@ class PathRootsSubscriberTest extends UnitTestCase {
    * {@inheritdoc}
    */
   protected function setUp() {
-    $this->state = $this->getMock('Drupal\Core\State\StateInterface');
+    $this->state = $this->getMock(StateInterface::class);
     $this->pathRootsSubscriber = new PathRootsSubscriber($this->state);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/EventSubscriber/PsrResponseSubscriberTest.php b/core/tests/Drupal/Tests/Core/EventSubscriber/PsrResponseSubscriberTest.php
index 38ae7f7..a10ecbe 100644
--- a/core/tests/Drupal/Tests/Core/EventSubscriber/PsrResponseSubscriberTest.php
+++ b/core/tests/Drupal/Tests/Core/EventSubscriber/PsrResponseSubscriberTest.php
@@ -4,6 +4,10 @@
 
 use Drupal\Tests\UnitTestCase;
 use \Drupal\Core\EventSubscriber\PsrResponseSubscriber;
+use Psr\Http\Message\ResponseInterface;
+use Symfony\Bridge\PsrHttpMessage\HttpFoundationFactoryInterface;
+use Symfony\Component\HttpFoundation\Response;
+use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent;
 
 /**
  * @coversDefaultClass \Drupal\Core\EventSubscriber\PsrResponseSubscriber
@@ -29,11 +33,11 @@ class PsrResponseSubscriberTest extends UnitTestCase {
    * {@inheritdoc}
    */
   protected function setUp() {
-    $factory = $this->getMock('Symfony\Bridge\PsrHttpMessage\HttpFoundationFactoryInterface', [], [], '', NULL);
+    $factory = $this->getMock(HttpFoundationFactoryInterface::class, [], [], '', NULL);
     $factory
       ->expects($this->any())
       ->method('createResponse')
-      ->willReturn($this->getMock('Symfony\Component\HttpFoundation\Response'));
+      ->willReturn($this->getMock(Response::class));
 
     $this->httpFoundationFactoryMock = $factory;
 
@@ -46,7 +50,7 @@ protected function setUp() {
    * @covers ::onKernelView
    */
   public function testConvertsControllerResult() {
-    $event = $this->createEventMock($this->getMock('Psr\Http\Message\ResponseInterface'));
+    $event = $this->createEventMock($this->getMock(ResponseInterface::class));
     $event
       ->expects($this->once())
       ->method('setResponse')
@@ -83,7 +87,7 @@ public function testDoesNotConvertControllerResult() {
    *    A mock object to test.
    */
   protected function createEventMock($controller_result) {
-    $event = $this->getMock('Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent', [], [], '', NULL);
+    $event = $this->getMock(GetResponseForControllerResultEvent::class, [], [], '', NULL);
     $event
       ->expects($this->once())
       ->method('getControllerResult')
diff --git a/core/tests/Drupal/Tests/Core/EventSubscriber/RedirectResponseSubscriberTest.php b/core/tests/Drupal/Tests/Core/EventSubscriber/RedirectResponseSubscriberTest.php
index 08c1a6c..c14069a 100644
--- a/core/tests/Drupal/Tests/Core/EventSubscriber/RedirectResponseSubscriberTest.php
+++ b/core/tests/Drupal/Tests/Core/EventSubscriber/RedirectResponseSubscriberTest.php
@@ -3,6 +3,7 @@
 namespace Drupal\Tests\Core\EventSubscriber;
 
 use Drupal\Core\EventSubscriber\RedirectResponseSubscriber;
+use Drupal\Core\Routing\RequestContext;
 use Drupal\Core\Routing\TrustedRedirectResponse;
 use Drupal\Core\Utility\UnroutedUrlAssemblerInterface;
 use Drupal\Tests\UnitTestCase;
@@ -41,7 +42,7 @@ class RedirectResponseSubscriberTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $this->requestContext = $this->getMockBuilder('Drupal\Core\Routing\RequestContext')
+    $this->requestContext = $this->getMockBuilder(RequestContext::class)
       ->disableOriginalConstructor()
       ->getMock();
     $this->requestContext->expects($this->any())
@@ -77,7 +78,7 @@ protected function setUp() {
    */
   public function testDestinationRedirect(Request $request, $expected) {
     $dispatcher = new EventDispatcher();
-    $kernel = $this->getMock('Symfony\Component\HttpKernel\HttpKernelInterface');
+    $kernel = $this->getMock(HttpKernelInterface::class);
     $response = new RedirectResponse('http://example.com/drupal');
     $request->headers->set('HOST', 'example.com');
 
@@ -118,7 +119,7 @@ public static function providerTestDestinationRedirect() {
    */
   public function testDestinationRedirectToExternalUrl($request, $expected) {
     $dispatcher = new EventDispatcher();
-    $kernel = $this->getMock('Symfony\Component\HttpKernel\HttpKernelInterface');
+    $kernel = $this->getMock(HttpKernelInterface::class);
     $response = new RedirectResponse('http://other-example.com');
 
     $listener = new RedirectResponseSubscriber($this->urlAssembler, $this->requestContext);
@@ -133,7 +134,7 @@ public function testDestinationRedirectToExternalUrl($request, $expected) {
    */
   public function testRedirectWithOptInExternalUrl() {
     $dispatcher = new EventDispatcher();
-    $kernel = $this->getMock('Symfony\Component\HttpKernel\HttpKernelInterface');
+    $kernel = $this->getMock(HttpKernelInterface::class);
     $response = new TrustedRedirectResponse('http://external-url.com');
     $request = Request::create('');
     $request->headers->set('HOST', 'example.com');
@@ -166,7 +167,7 @@ public function providerTestDestinationRedirectToExternalUrl() {
    */
   public function testDestinationRedirectWithInvalidUrl(Request $request) {
     $dispatcher = new EventDispatcher();
-    $kernel = $this->getMock('Symfony\Component\HttpKernel\HttpKernelInterface');
+    $kernel = $this->getMock(HttpKernelInterface::class);
     $response = new RedirectResponse('http://example.com/drupal');
 
     $listener = new RedirectResponseSubscriber($this->urlAssembler, $this->requestContext);
@@ -206,7 +207,7 @@ public function testSanitizeDestinationForGet($input, $output) {
     $request->query->set('destination', $input);
 
     $listener = new RedirectResponseSubscriber($this->urlAssembler, $this->requestContext);
-    $kernel = $this->getMock('Symfony\Component\HttpKernel\HttpKernelInterface');
+    $kernel = $this->getMock(HttpKernelInterface::class);
     $event = new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST);
 
     $dispatcher = new EventDispatcher();
@@ -230,7 +231,7 @@ public function testSanitizeDestinationForPost($input, $output) {
     $request->request->set('destination', $input);
 
     $listener = new RedirectResponseSubscriber($this->urlAssembler, $this->requestContext);
-    $kernel = $this->getMock('Symfony\Component\HttpKernel\HttpKernelInterface');
+    $kernel = $this->getMock(HttpKernelInterface::class);
     $event = new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST);
 
     $dispatcher = new EventDispatcher();
diff --git a/core/tests/Drupal/Tests/Core/EventSubscriber/SpecialAttributesRouteSubscriberTest.php b/core/tests/Drupal/Tests/Core/EventSubscriber/SpecialAttributesRouteSubscriberTest.php
index 01a6f36..90d6950 100644
--- a/core/tests/Drupal/Tests/Core/EventSubscriber/SpecialAttributesRouteSubscriberTest.php
+++ b/core/tests/Drupal/Tests/Core/EventSubscriber/SpecialAttributesRouteSubscriberTest.php
@@ -7,6 +7,7 @@
 use Drupal\Tests\UnitTestCase;
 use Symfony\Cmf\Component\Routing\RouteObjectInterface;
 use Symfony\Component\Routing\Route;
+use Symfony\Component\Routing\RouteCollection;
 
 /**
  * @coversDefaultClass \Drupal\Core\EventSubscriber\SpecialAttributesRouteSubscriber
@@ -74,7 +75,7 @@ public function providerTestOnRouteBuildingValidVariables() {
    * @covers ::onAlterRoutes
    */
   public function testOnRouteBuildingValidVariables(Route $route) {
-    $route_collection = $this->getMock('Symfony\Component\Routing\RouteCollection', NULL);
+    $route_collection = $this->getMock(RouteCollection::class, NULL);
     $route_collection->add('test', $route);
 
     $event = new RouteBuildEvent($route_collection, 'test');
@@ -92,7 +93,7 @@ public function testOnRouteBuildingValidVariables(Route $route) {
    * @covers ::onAlterRoutes
    */
   public function testOnRouteBuildingInvalidVariables(Route $route) {
-    $route_collection = $this->getMock('Symfony\Component\Routing\RouteCollection', NULL);
+    $route_collection = $this->getMock(RouteCollection::class, NULL);
     $route_collection->add('test', $route);
 
     $event = new RouteBuildEvent($route_collection, 'test');
diff --git a/core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php b/core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php
index 796a916..d9463e8 100644
--- a/core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php
+++ b/core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php
@@ -3,6 +3,7 @@
 namespace Drupal\Tests\Core\Extension;
 
 use Drupal\Core\Extension\InfoParser;
+use Drupal\Core\Extension\InfoParserException;
 use Drupal\Tests\UnitTestCase;
 use org\bovigo\vfs\vfsStream;
 
@@ -71,7 +72,7 @@ public function testInfoParserBroken() {
       ],
     ]);
     $filename = vfsStream::url('modules/fixtures/broken.info.txt');
-    $this->setExpectedException('\Drupal\Core\Extension\InfoParserException', 'broken.info.txt');
+    $this->setExpectedException(InfoParserException::class, 'broken.info.txt');
     $this->infoParser->parse($filename);
   }
 
@@ -96,7 +97,7 @@ public function testInfoParserMissingKeys() {
       ],
     ]);
     $filename = vfsStream::url('modules/fixtures/missing_keys.info.txt');
-    $this->setExpectedException('\Drupal\Core\Extension\InfoParserException', 'Missing required keys (type, core, name) in vfs://modules/fixtures/missing_keys.info.txt');
+    $this->setExpectedException(InfoParserException::class, 'Missing required keys (type, core, name) in vfs://modules/fixtures/missing_keys.info.txt');
     $this->infoParser->parse($filename);
   }
 
@@ -124,7 +125,7 @@ public function testInfoParserMissingKey() {
       ],
     ]);
     $filename = vfsStream::url('modules/fixtures/missing_key.info.txt');
-    $this->setExpectedException('\Drupal\Core\Extension\InfoParserException', 'Missing required keys (type) in vfs://modules/fixtures/missing_key.info.txt');
+    $this->setExpectedException(InfoParserException::class, 'Missing required keys (type) in vfs://modules/fixtures/missing_key.info.txt');
     $this->infoParser->parse($filename);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Extension/RequiredModuleUninstallValidatorTest.php b/core/tests/Drupal/Tests/Core/Extension/RequiredModuleUninstallValidatorTest.php
index 55d0aaa..c6e1cab 100644
--- a/core/tests/Drupal/Tests/Core/Extension/RequiredModuleUninstallValidatorTest.php
+++ b/core/tests/Drupal/Tests/Core/Extension/RequiredModuleUninstallValidatorTest.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\Tests\Core\Extension;
 
+use Drupal\Core\Extension\RequiredModuleUninstallValidator;
 use Drupal\simpletest\AssertHelperTrait;
 use Drupal\Tests\UnitTestCase;
 
@@ -23,7 +24,7 @@ class RequiredModuleUninstallValidatorTest extends UnitTestCase {
    */
   protected function setUp() {
     parent::setUp();
-    $this->uninstallValidator = $this->getMockBuilder('Drupal\Core\Extension\RequiredModuleUninstallValidator')
+    $this->uninstallValidator = $this->getMockBuilder(RequiredModuleUninstallValidator::class)
       ->disableOriginalConstructor()
       ->setMethods(['getModuleInfoByModule'])
       ->getMock();
diff --git a/core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php b/core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php
index 8c105f2..1e7224e 100644
--- a/core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php
+++ b/core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php
@@ -7,9 +7,13 @@
 
 namespace Drupal\Tests\Core\Extension;
 
+use Drupal\Core\Cache\CacheTagsInvalidatorInterface;
 use Drupal\Core\Cache\MemoryBackend;
 use Drupal\Core\Extension\Extension;
+use Drupal\Core\Extension\ExtensionDiscovery;
 use Drupal\Core\Extension\InfoParser;
+use Drupal\Core\Extension\InfoParserInterface;
+use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Extension\ThemeHandler;
 use Drupal\Core\KeyValueStore\KeyValueMemoryFactory;
 use Drupal\Core\Lock\NullLockBackend;
@@ -79,15 +83,15 @@ protected function setUp() {
         ],
       ],
     ]);
-    $this->moduleHandler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface');
+    $this->moduleHandler = $this->getMock(ModuleHandlerInterface::class);
     $this->state = new State(new KeyValueMemoryFactory(), new MemoryBackend('test'), new NullLockBackend());
-    $this->infoParser = $this->getMock('Drupal\Core\Extension\InfoParserInterface');
-    $this->extensionDiscovery = $this->getMockBuilder('Drupal\Core\Extension\ExtensionDiscovery')
+    $this->infoParser = $this->getMock(InfoParserInterface::class);
+    $this->extensionDiscovery = $this->getMockBuilder(ExtensionDiscovery::class)
       ->disableOriginalConstructor()
       ->getMock();
     $this->themeHandler = new StubThemeHandler($this->root, $this->configFactory, $this->moduleHandler, $this->state, $this->infoParser, $this->extensionDiscovery);
 
-    $cache_tags_invalidator = $this->getMock('Drupal\Core\Cache\CacheTagsInvalidatorInterface');
+    $cache_tags_invalidator = $this->getMock(CacheTagsInvalidatorInterface::class);
     $this->getContainerWithCacheTagsInvalidator($cache_tags_invalidator);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Field/FieldItemListTest.php b/core/tests/Drupal/Tests/Core/Field/FieldItemListTest.php
index 8927597..e3987dc 100644
--- a/core/tests/Drupal/Tests/Core/Field/FieldItemListTest.php
+++ b/core/tests/Drupal/Tests/Core/Field/FieldItemListTest.php
@@ -4,8 +4,11 @@
 
 use Drupal\Core\DependencyInjection\ContainerBuilder;
 use Drupal\Core\Field\FieldDefinitionInterface;
+use Drupal\Core\Field\FieldItemBase;
 use Drupal\Core\Field\FieldItemInterface;
 use Drupal\Core\Field\FieldItemList;
+use Drupal\Core\Field\FieldStorageDefinitionInterface;
+use Drupal\Core\Field\FieldTypePluginManagerInterface;
 use Drupal\Core\Form\FormState;
 use Drupal\Tests\UnitTestCase;
 
@@ -23,16 +26,16 @@ class FieldItemListTest extends UnitTestCase {
   public function testEquals($expected, FieldItemInterface $first_field_item = NULL, FieldItemInterface $second_field_item = NULL) {
 
     // Mock the field type manager and place it in the container.
-    $field_type_manager = $this->getMock('Drupal\Core\Field\FieldTypePluginManagerInterface');
+    $field_type_manager = $this->getMock(FieldTypePluginManagerInterface::class);
     $container = new ContainerBuilder();
     $container->set('plugin.manager.field.field_type', $field_type_manager);
     \Drupal::setContainer($container);
 
-    $field_storage_definition = $this->getMock('Drupal\Core\Field\FieldStorageDefinitionInterface');
+    $field_storage_definition = $this->getMock(FieldStorageDefinitionInterface::class);
     $field_storage_definition->expects($this->any())
       ->method('getColumns')
       ->willReturn([0 => '0', 1 => '1']);
-    $field_definition = $this->getMock('Drupal\Core\Field\FieldDefinitionInterface');
+    $field_definition = $this->getMock(FieldDefinitionInterface::class);
     $field_definition->expects($this->any())
       ->method('getFieldStorageDefinition')
       ->willReturn($field_storage_definition);
@@ -64,7 +67,7 @@ public function providerTestEquals() {
     $datasets[] = [TRUE];
 
     /** @var \Drupal\Core\Field\FieldItemBase  $field_item_a */
-    $field_item_a = $this->getMockForAbstractClass('Drupal\Core\Field\FieldItemBase', [], '', FALSE);
+    $field_item_a = $this->getMockForAbstractClass(FieldItemBase::class, [], '', FALSE);
     $field_item_a->setValue([1]);
     // Tests field item lists where one has a value and one does not.
     $datasets[] = [FALSE, $field_item_a];
@@ -73,22 +76,22 @@ public function providerTestEquals() {
     $datasets[] = [TRUE, $field_item_a, $field_item_a];
 
     /** @var \Drupal\Core\Field\FieldItemBase  $fv */
-    $field_item_b = $this->getMockForAbstractClass('Drupal\Core\Field\FieldItemBase', [], '', FALSE);
+    $field_item_b = $this->getMockForAbstractClass(FieldItemBase::class, [], '', FALSE);
     $field_item_b->setValue([2]);
     // Tests field item lists where both have the different values.
     $datasets[] = [FALSE, $field_item_a, $field_item_b];
 
     /** @var \Drupal\Core\Field\FieldItemBase  $fv */
-    $field_item_c = $this->getMockForAbstractClass('Drupal\Core\Field\FieldItemBase', [], '', FALSE);
+    $field_item_c = $this->getMockForAbstractClass(FieldItemBase::class, [], '', FALSE);
     $field_item_c->setValue(['0' => 1, '1' => 2]);
-    $field_item_d = $this->getMockForAbstractClass('Drupal\Core\Field\FieldItemBase', [], '', FALSE);
+    $field_item_d = $this->getMockForAbstractClass(FieldItemBase::class, [], '', FALSE);
     $field_item_d->setValue(['1' => 2, '0' => 1]);
 
     // Tests field item lists where both have the differently ordered values.
     $datasets[] = [TRUE, $field_item_c, $field_item_d];
 
     /** @var \Drupal\Core\Field\FieldItemBase  $field_item_e */
-    $field_item_e = $this->getMockForAbstractClass('Drupal\Core\Field\FieldItemBase', [], '', FALSE);
+    $field_item_e = $this->getMockForAbstractClass(FieldItemBase::class, [], '', FALSE);
     $field_item_e->setValue(['2']);
 
     // Tests field item lists where both have same values but different data
@@ -103,22 +106,22 @@ public function providerTestEquals() {
    */
   public function testEqualsEmptyItems() {
     /** @var \Drupal\Core\Field\FieldItemBase  $fv */
-    $first_field_item = $this->getMockForAbstractClass('Drupal\Core\Field\FieldItemBase', [], '', FALSE);
+    $first_field_item = $this->getMockForAbstractClass(FieldItemBase::class, [], '', FALSE);
     $first_field_item->setValue(['0' => 1, '1' => 2]);
-    $second_field_item = $this->getMockForAbstractClass('Drupal\Core\Field\FieldItemBase', [], '', FALSE);
+    $second_field_item = $this->getMockForAbstractClass(FieldItemBase::class, [], '', FALSE);
     $second_field_item->setValue(['1' => 2, '0' => 1]);
-    $empty_field_item = $this->getMockForAbstractClass('Drupal\Core\Field\FieldItemBase', [], '', FALSE);
+    $empty_field_item = $this->getMockForAbstractClass(FieldItemBase::class, [], '', FALSE);
     // Mock the field type manager and place it in the container.
-    $field_type_manager = $this->getMock('Drupal\Core\Field\FieldTypePluginManagerInterface');
+    $field_type_manager = $this->getMock(FieldTypePluginManagerInterface::class);
     $container = new ContainerBuilder();
     $container->set('plugin.manager.field.field_type', $field_type_manager);
     \Drupal::setContainer($container);
 
-    $field_storage_definition = $this->getMock('Drupal\Core\Field\FieldStorageDefinitionInterface');
+    $field_storage_definition = $this->getMock(FieldStorageDefinitionInterface::class);
     $field_storage_definition->expects($this->any())
       ->method('getColumns')
       ->willReturn([0 => '0', 1 => '1']);
-    $field_definition = $this->getMock('Drupal\Core\Field\FieldDefinitionInterface');
+    $field_definition = $this->getMock(FieldDefinitionInterface::class);
     $field_definition->expects($this->any())
       ->method('getFieldStorageDefinition')
       ->willReturn($field_storage_definition);
diff --git a/core/tests/Drupal/Tests/Core/File/FileSystemTest.php b/core/tests/Drupal/Tests/Core/File/FileSystemTest.php
index 645daf4..064ca4e 100644
--- a/core/tests/Drupal/Tests/Core/File/FileSystemTest.php
+++ b/core/tests/Drupal/Tests/Core/File/FileSystemTest.php
@@ -4,8 +4,10 @@
 
 use Drupal\Core\File\FileSystem;
 use Drupal\Core\Site\Settings;
+use Drupal\Core\StreamWrapper\StreamWrapperManagerInterface;
 use Drupal\Tests\UnitTestCase;
 use org\bovigo\vfs\vfsStream;
+use Psr\Log\LoggerInterface;
 
 /**
  * @coversDefaultClass \Drupal\Core\File\FileSystem
@@ -33,8 +35,8 @@ protected function setUp() {
     parent::setUp();
 
     $settings = new Settings([]);
-    $stream_wrapper_manager = $this->getMock('Drupal\Core\StreamWrapper\StreamWrapperManagerInterface');
-    $this->logger = $this->getMock('Psr\Log\LoggerInterface');
+    $stream_wrapper_manager = $this->getMock(StreamWrapperManagerInterface::class);
+    $this->logger = $this->getMock(LoggerInterface::class);
     $this->fileSystem = new FileSystem($stream_wrapper_manager, $settings, $this->logger);
   }
 
@@ -84,7 +86,7 @@ public function testUnlink() {
     vfsStream::create(['test.txt' => 'asdf']);
     $uri = 'vfs://dir/test.txt';
 
-    $this->fileSystem = $this->getMockBuilder('Drupal\Core\File\FileSystem')
+    $this->fileSystem = $this->getMockBuilder(FileSystem::class)
       ->disableOriginalConstructor()
       ->setMethods(['validScheme'])
       ->getMock();
diff --git a/core/tests/Drupal/Tests/Core/Form/ConfigFormBaseTraitTest.php b/core/tests/Drupal/Tests/Core/Form/ConfigFormBaseTraitTest.php
index 14e03cb..60593af 100644
--- a/core/tests/Drupal/Tests/Core/Form/ConfigFormBaseTraitTest.php
+++ b/core/tests/Drupal/Tests/Core/Form/ConfigFormBaseTraitTest.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\Tests\Core\Form;
 
+use Drupal\Core\Form\ConfigFormBaseTrait;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -15,7 +16,7 @@ class ConfigFormBaseTraitTest extends UnitTestCase {
    */
   public function testConfig() {
 
-    $trait = $this->getMockForTrait('Drupal\Core\Form\ConfigFormBaseTrait');
+    $trait = $this->getMockForTrait(ConfigFormBaseTrait::class);
     // Set up some configuration in a mocked config factory.
     $trait->configFactory = $this->getConfigFactoryStub([
       'editable.config' => [],
@@ -43,7 +44,7 @@ public function testConfig() {
    * @covers ::config
    */
   public function testConfigFactoryException() {
-    $trait = $this->getMockForTrait('Drupal\Core\Form\ConfigFormBaseTrait');
+    $trait = $this->getMockForTrait(ConfigFormBaseTrait::class);
     $config_method = new \ReflectionMethod($trait, 'config');
     $config_method->setAccessible(TRUE);
 
@@ -56,7 +57,7 @@ public function testConfigFactoryException() {
    * @covers ::config
    */
   public function testConfigFactoryExceptionInvalidProperty() {
-    $trait = $this->getMockForTrait('Drupal\Core\Form\ConfigFormBaseTrait');
+    $trait = $this->getMockForTrait(ConfigFormBaseTrait::class);
     $trait->configFactory = TRUE;
     $config_method = new \ReflectionMethod($trait, 'config');
     $config_method->setAccessible(TRUE);
diff --git a/core/tests/Drupal/Tests/Core/Form/ConfirmFormHelperTest.php b/core/tests/Drupal/Tests/Core/Form/ConfirmFormHelperTest.php
index 15f52a6..72ef0a2 100644
--- a/core/tests/Drupal/Tests/Core/Form/ConfirmFormHelperTest.php
+++ b/core/tests/Drupal/Tests/Core/Form/ConfirmFormHelperTest.php
@@ -3,6 +3,8 @@
 namespace Drupal\Tests\Core\Form;
 
 use Drupal\Core\Form\ConfirmFormHelper;
+use Drupal\Core\Form\ConfirmFormInterface;
+use Drupal\Core\Path\PathValidatorInterface;
 use Drupal\Core\Url;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -21,7 +23,7 @@ class ConfirmFormHelperTest extends UnitTestCase {
    */
   public function testCancelLinkTitle() {
     $cancel_text = 'Cancel text';
-    $form = $this->getMock('Drupal\Core\Form\ConfirmFormInterface');
+    $form = $this->getMock(ConfirmFormInterface::class);
     $form->expects($this->any())
       ->method('getCancelText')
       ->will($this->returnValue($cancel_text));
@@ -39,7 +41,7 @@ public function testCancelLinkTitle() {
   public function testCancelLinkRoute() {
     $route_name = 'foo_bar';
     $cancel_route = new Url($route_name);
-    $form = $this->getMock('Drupal\Core\Form\ConfirmFormInterface');
+    $form = $this->getMock(ConfirmFormInterface::class);
     $form->expects($this->any())
       ->method('getCancelUrl')
       ->will($this->returnValue($cancel_route));
@@ -55,7 +57,7 @@ public function testCancelLinkRoute() {
    */
   public function testCancelLinkRouteWithParams() {
     $expected = Url::fromRoute('foo_bar.baz', ['baz' => 'banana'], ['absolute' => TRUE]);
-    $form = $this->getMock('Drupal\Core\Form\ConfirmFormInterface');
+    $form = $this->getMock(ConfirmFormInterface::class);
     $form->expects($this->any())
       ->method('getCancelUrl')
       ->will($this->returnValue($expected));
@@ -78,7 +80,7 @@ public function testCancelLinkRouteWithUrl() {
         'absolute' => TRUE,
       ]
     );
-    $form = $this->getMock('Drupal\Core\Form\ConfirmFormInterface');
+    $form = $this->getMock(ConfirmFormInterface::class);
     $form->expects($this->any())
       ->method('getCancelUrl')
       ->will($this->returnValue($cancel_route));
@@ -96,9 +98,9 @@ public function testCancelLinkRouteWithUrl() {
    */
   public function testCancelLinkDestination($destination) {
     $query = ['destination' => $destination];
-    $form = $this->getMock('Drupal\Core\Form\ConfirmFormInterface');
+    $form = $this->getMock(ConfirmFormInterface::class);
 
-    $path_validator = $this->getMock('Drupal\Core\Path\PathValidatorInterface');
+    $path_validator = $this->getMock(PathValidatorInterface::class);
     $container_builder = new ContainerBuilder();
     $container_builder->set('path.validator', $path_validator);
     \Drupal::setContainer($container_builder);
diff --git a/core/tests/Drupal/Tests/Core/Form/EventSubscriber/FormAjaxSubscriberTest.php b/core/tests/Drupal/Tests/Core/Form/EventSubscriber/FormAjaxSubscriberTest.php
index 050d745..e080354 100644
--- a/core/tests/Drupal/Tests/Core/Form/EventSubscriber/FormAjaxSubscriberTest.php
+++ b/core/tests/Drupal/Tests/Core/Form/EventSubscriber/FormAjaxSubscriberTest.php
@@ -6,8 +6,10 @@
 use Drupal\Core\Form\EventSubscriber\FormAjaxSubscriber;
 use Drupal\Core\Form\Exception\BrokenPostRequestException;
 use Drupal\Core\Form\FormAjaxException;
+use Drupal\Core\Form\FormAjaxResponseBuilderInterface;
 use Drupal\Core\Form\FormBuilderInterface;
 use Drupal\Core\Form\FormState;
+use Drupal\Core\Render\RendererInterface;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpFoundation\Response;
@@ -49,8 +51,8 @@ class FormAjaxSubscriberTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $this->httpKernel = $this->getMock('Symfony\Component\HttpKernel\HttpKernelInterface');
-    $this->formAjaxResponseBuilder = $this->getMock('Drupal\Core\Form\FormAjaxResponseBuilderInterface');
+    $this->httpKernel = $this->getMock(HttpKernelInterface::class);
+    $this->formAjaxResponseBuilder = $this->getMock(FormAjaxResponseBuilderInterface::class);
     $this->stringTranslation = $this->getStringTranslationStub();
     $this->subscriber = new FormAjaxSubscriber($this->formAjaxResponseBuilder, $this->stringTranslation);
   }
@@ -145,7 +147,7 @@ public function testOnExceptionResponseBuilderException() {
   public function testOnExceptionBrokenPostRequest() {
     $this->formAjaxResponseBuilder->expects($this->never())
       ->method('buildResponse');
-    $this->subscriber = $this->getMockBuilder('\Drupal\Core\Form\EventSubscriber\FormAjaxSubscriber')
+    $this->subscriber = $this->getMockBuilder(FormAjaxSubscriber::class)
       ->setConstructorArgs([$this->formAjaxResponseBuilder, $this->getStringTranslationStub()])
       ->setMethods(['drupalSetMessage', 'formatSize'])
       ->getMock();
@@ -159,7 +161,7 @@ public function testOnExceptionBrokenPostRequest() {
     $rendered_output = 'the rendered output';
     // CommandWithAttachedAssetsTrait::getRenderedContent() will call the
     // renderer service via the container.
-    $renderer = $this->getMock('Drupal\Core\Render\RendererInterface');
+    $renderer = $this->getMock(RendererInterface::class);
     $renderer->expects($this->once())
       ->method('renderRoot')
       ->with()
diff --git a/core/tests/Drupal/Tests/Core/Form/FormAjaxResponseBuilderTest.php b/core/tests/Drupal/Tests/Core/Form/FormAjaxResponseBuilderTest.php
index 177504c..7f3d59a 100644
--- a/core/tests/Drupal/Tests/Core/Form/FormAjaxResponseBuilderTest.php
+++ b/core/tests/Drupal/Tests/Core/Form/FormAjaxResponseBuilderTest.php
@@ -7,6 +7,8 @@
 use Drupal\Core\Form\FormAjaxResponseBuilder;
 use Drupal\Core\Form\FormState;
 use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\Render\MainContent\MainContentRendererInterface;
+use Drupal\Core\Routing\RouteMatchInterface;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpKernel\Exception\HttpException;
@@ -37,8 +39,8 @@ class FormAjaxResponseBuilderTest extends UnitTestCase {
    */
   protected function setUp() {
     parent::setUp();
-    $this->renderer = $this->getMock('Drupal\Core\Render\MainContent\MainContentRendererInterface');
-    $this->routeMatch = $this->getMock('Drupal\Core\Routing\RouteMatchInterface');
+    $this->renderer = $this->getMock(MainContentRendererInterface::class);
+    $this->routeMatch = $this->getMock(RouteMatchInterface::class);
     $this->formAjaxResponseBuilder = new FormAjaxResponseBuilder($this->renderer, $this->routeMatch);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php b/core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php
index aa3739c..2d98666 100644
--- a/core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php
+++ b/core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php
@@ -12,6 +12,7 @@
 use Drupal\Core\Access\AccessResult;
 use Drupal\Core\Cache\Context\CacheContextsManager;
 use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
+use Drupal\Core\Form\BaseFormIdInterface;
 use Drupal\Core\Form\EnforcedResponseException;
 use Drupal\Core\Form\Exception\BrokenPostRequestException;
 use Drupal\Core\Form\FormBuilder;
@@ -23,8 +24,10 @@
 use Drupal\Core\Session\AccountProxyInterface;
 use Symfony\Component\DependencyInjection\ContainerBuilder;
 use Symfony\Component\DependencyInjection\ContainerInterface;
+use Symfony\Component\HttpFoundation\RedirectResponse;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpFoundation\RequestStack;
+use Symfony\Component\HttpFoundation\Response;
 
 /**
  * @coversDefaultClass \Drupal\Core\Form\FormBuilder
@@ -78,7 +81,7 @@ public function testGetFormIdWithClassName() {
    * Tests the getFormId() method with an injected class name form ID.
    */
   public function testGetFormIdWithInjectedClassName() {
-    $container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
+    $container = $this->getMock(ContainerInterface::class);
     \Drupal::setContainer($container);
 
     $form_arg = 'Drupal\Tests\Core\Form\TestFormInjected';
@@ -112,7 +115,7 @@ public function testGetFormIdWithBaseForm() {
     $expected_form_id = 'my_module_form_id';
     $base_form_id = 'my_module';
 
-    $form_arg = $this->getMock('Drupal\Core\Form\BaseFormIdInterface');
+    $form_arg = $this->getMock(BaseFormIdInterface::class);
     $form_arg->expects($this->once())
       ->method('getFormId')
       ->will($this->returnValue($expected_form_id));
@@ -179,12 +182,12 @@ public function testHandleRedirectWithResponse() {
     $expected_form = $form_id();
 
     // Set up a response that will be used.
-    $response = $this->getMockBuilder('Symfony\Component\HttpFoundation\Response')
+    $response = $this->getMockBuilder(Response::class)
       ->disableOriginalConstructor()
       ->getMock();
 
     // Set up a redirect that will not be called.
-    $redirect = $this->getMockBuilder('Symfony\Component\HttpFoundation\RedirectResponse')
+    $redirect = $this->getMockBuilder(RedirectResponse::class)
       ->disableOriginalConstructor()
       ->getMock();
 
@@ -343,7 +346,7 @@ public function testRebuildForm() {
     $expected_form = $form_id();
 
     // The form will be built four times.
-    $form_arg = $this->getMock('Drupal\Core\Form\FormInterface');
+    $form_arg = $this->getMock(FormInterface::class);
     $form_arg->expects($this->exactly(2))
       ->method('getFormId')
       ->will($this->returnValue($form_id));
@@ -383,7 +386,7 @@ public function testRebuildFormOnGetRequest() {
     $expected_form = $form_id();
 
     // The form will be built four times.
-    $form_arg = $this->getMock('Drupal\Core\Form\FormInterface');
+    $form_arg = $this->getMock(FormInterface::class);
     $form_arg->expects($this->exactly(2))
       ->method('getFormId')
       ->will($this->returnValue($form_id));
@@ -423,7 +426,7 @@ public function testGetCache() {
 
     // FormBuilder::buildForm() will be called twice, but the form object will
     // only be called once due to caching.
-    $form_arg = $this->getMock('Drupal\Core\Form\FormInterface');
+    $form_arg = $this->getMock(FormInterface::class);
     $form_arg->expects($this->exactly(2))
       ->method('getFormId')
       ->will($this->returnValue($form_id));
@@ -465,7 +468,7 @@ public function testUniqueHtmlId() {
     $expected_form['test']['#required'] = TRUE;
 
     // Mock a form object that will be built two times.
-    $form_arg = $this->getMock('Drupal\Core\Form\FormInterface');
+    $form_arg = $this->getMock(FormInterface::class);
     $form_arg->expects($this->exactly(2))
       ->method('getFormId')
       ->will($this->returnValue($form_id));
@@ -534,7 +537,7 @@ public function testExceededFileSize() {
     $request = new Request([FormBuilderInterface::AJAX_FORM_REQUEST => TRUE]);
     $request_stack = new RequestStack();
     $request_stack->push($request);
-    $this->formBuilder = $this->getMockBuilder('\Drupal\Core\Form\FormBuilder')
+    $this->formBuilder = $this->getMockBuilder(FormBuilder::class)
       ->setConstructorArgs([$this->formValidator, $this->formSubmitter, $this->formCache, $this->moduleHandler, $this->eventDispatcher, $request_stack, $this->classResolver, $this->elementInfo, $this->themeManager, $this->csrfToken])
       ->setMethods(['getFileUploadMaxSize'])
       ->getMock();
@@ -836,7 +839,7 @@ public function testFormTokenCacheability($token, $is_authenticated, $expected_f
       $form['#token'] = $token;
     }
 
-    $form_arg = $this->getMock('Drupal\Core\Form\FormInterface');
+    $form_arg = $this->getMock(FormInterface::class);
     $form_arg->expects($this->once())
       ->method('getFormId')
       ->will($this->returnValue($form_id));
diff --git a/core/tests/Drupal/Tests/Core/Form/FormCacheTest.php b/core/tests/Drupal/Tests/Core/Form/FormCacheTest.php
index 8b2734d..849643c 100644
--- a/core/tests/Drupal/Tests/Core/Form/FormCacheTest.php
+++ b/core/tests/Drupal/Tests/Core/Form/FormCacheTest.php
@@ -2,9 +2,17 @@
 
 namespace Drupal\Tests\Core\Form;
 
+use Drupal\Core\Access\CsrfTokenGenerator;
+use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Form\FormCache;
 use Drupal\Core\Form\FormState;
+use Drupal\Core\KeyValueStore\KeyValueExpirableFactoryInterface;
+use Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface;
+use Drupal\Core\PageCache\RequestPolicyInterface;
+use Drupal\Core\Session\AccountInterface;
 use Drupal\Tests\UnitTestCase;
+use Psr\Log\LoggerInterface;
+use Symfony\Component\HttpFoundation\RequestStack;
 
 /**
  * @coversDefaultClass \Drupal\Core\Form\FormCache
@@ -98,11 +106,11 @@ class FormCacheTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $this->moduleHandler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface');
+    $this->moduleHandler = $this->getMock(ModuleHandlerInterface::class);
 
-    $this->formCacheStore = $this->getMock('Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface');
-    $this->formStateCacheStore = $this->getMock('Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface');
-    $this->keyValueExpirableFactory = $this->getMock('Drupal\Core\KeyValueStore\KeyValueExpirableFactoryInterface');
+    $this->formCacheStore = $this->getMock(KeyValueStoreExpirableInterface::class);
+    $this->formStateCacheStore = $this->getMock(KeyValueStoreExpirableInterface::class);
+    $this->keyValueExpirableFactory = $this->getMock(KeyValueExpirableFactoryInterface::class);
     $this->keyValueExpirableFactory->expects($this->any())
       ->method('get')
       ->will($this->returnValueMap([
@@ -110,14 +118,14 @@ protected function setUp() {
         ['form_state', $this->formStateCacheStore],
       ]));
 
-    $this->csrfToken = $this->getMockBuilder('Drupal\Core\Access\CsrfTokenGenerator')
+    $this->csrfToken = $this->getMockBuilder(CsrfTokenGenerator::class)
       ->disableOriginalConstructor()
       ->getMock();
-    $this->account = $this->getMock('Drupal\Core\Session\AccountInterface');
+    $this->account = $this->getMock(AccountInterface::class);
 
-    $this->logger = $this->getMock('Psr\Log\LoggerInterface');
-    $this->requestStack = $this->getMock('\Symfony\Component\HttpFoundation\RequestStack');
-    $this->requestPolicy = $this->getMock('\Drupal\Core\PageCache\RequestPolicyInterface');
+    $this->logger = $this->getMock(LoggerInterface::class);
+    $this->requestStack = $this->getMock(RequestStack::class);
+    $this->requestPolicy = $this->getMock(RequestPolicyInterface::class);
 
     $this->formCache = new FormCache($this->root, $this->keyValueExpirableFactory, $this->moduleHandler, $this->account, $this->csrfToken, $this->logger, $this->requestStack, $this->requestPolicy);
   }
diff --git a/core/tests/Drupal/Tests/Core/Form/FormErrorHandlerTest.php b/core/tests/Drupal/Tests/Core/Form/FormErrorHandlerTest.php
index 8e2fc0d..0caa5e4 100644
--- a/core/tests/Drupal/Tests/Core/Form/FormErrorHandlerTest.php
+++ b/core/tests/Drupal/Tests/Core/Form/FormErrorHandlerTest.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\Tests\Core\Form;
 
+use Drupal\Core\Form\FormErrorHandler;
 use Drupal\Core\Form\FormState;
 use Drupal\Tests\UnitTestCase;
 
@@ -16,7 +17,7 @@ class FormErrorHandlerTest extends UnitTestCase {
    * @covers ::displayErrorMessages
    */
   public function testDisplayErrorMessages() {
-    $form_error_handler = $this->getMockBuilder('Drupal\Core\Form\FormErrorHandler')
+    $form_error_handler = $this->getMockBuilder(FormErrorHandler::class)
       ->setMethods(['drupalSetMessage'])
       ->getMock();
 
@@ -97,7 +98,7 @@ public function testDisplayErrorMessages() {
    * @covers ::setElementErrorsFromFormState
    */
   public function testSetElementErrorsFromFormState() {
-    $form_error_handler = $this->getMockBuilder('Drupal\Core\Form\FormErrorHandler')
+    $form_error_handler = $this->getMockBuilder(FormErrorHandler::class)
       ->setMethods(['drupalSetMessage'])
       ->getMock();
 
diff --git a/core/tests/Drupal/Tests/Core/Form/FormStateTest.php b/core/tests/Drupal/Tests/Core/Form/FormStateTest.php
index 4017904..7e21137 100644
--- a/core/tests/Drupal/Tests/Core/Form/FormStateTest.php
+++ b/core/tests/Drupal/Tests/Core/Form/FormStateTest.php
@@ -179,7 +179,7 @@ public function testLoadInclude() {
     $type = 'some_type';
     $module = 'some_module';
     $name = 'some_name';
-    $form_state = $this->getMockBuilder('Drupal\Core\Form\FormState')
+    $form_state = $this->getMockBuilder(FormState::class)
       ->setMethods(['moduleLoadInclude'])
       ->getMock();
     $form_state->expects($this->once())
@@ -195,7 +195,7 @@ public function testLoadInclude() {
   public function testLoadIncludeNoName() {
     $type = 'some_type';
     $module = 'some_module';
-    $form_state = $this->getMockBuilder('Drupal\Core\Form\FormState')
+    $form_state = $this->getMockBuilder(FormState::class)
       ->setMethods(['moduleLoadInclude'])
       ->getMock();
     $form_state->expects($this->once())
@@ -211,7 +211,7 @@ public function testLoadIncludeNoName() {
   public function testLoadIncludeNotFound() {
     $type = 'some_type';
     $module = 'some_module';
-    $form_state = $this->getMockBuilder('Drupal\Core\Form\FormState')
+    $form_state = $this->getMockBuilder(FormState::class)
       ->setMethods(['moduleLoadInclude'])
       ->getMock();
     $form_state->expects($this->once())
@@ -228,7 +228,7 @@ public function testLoadIncludeAlreadyLoaded() {
     $type = 'some_type';
     $module = 'some_module';
     $name = 'some_name';
-    $form_state = $this->getMockBuilder('Drupal\Core\Form\FormState')
+    $form_state = $this->getMockBuilder(FormState::class)
       ->setMethods(['moduleLoadInclude'])
       ->getMock();
 
diff --git a/core/tests/Drupal/Tests/Core/Form/FormSubmitterTest.php b/core/tests/Drupal/Tests/Core/Form/FormSubmitterTest.php
index 15df6f6..ed5c288 100644
--- a/core/tests/Drupal/Tests/Core/Form/FormSubmitterTest.php
+++ b/core/tests/Drupal/Tests/Core/Form/FormSubmitterTest.php
@@ -3,7 +3,10 @@
 namespace Drupal\Tests\Core\Form;
 
 use Drupal\Core\DependencyInjection\ContainerBuilder;
+use Drupal\Core\Form\FormBase;
 use Drupal\Core\Form\FormState;
+use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\Form\FormSubmitter;
 use Drupal\Core\Routing\UrlGeneratorInterface;
 use Drupal\Core\Url;
 use Drupal\Core\Utility\UnroutedUrlAssemblerInterface;
@@ -108,7 +111,7 @@ public function providerTestHandleFormSubmissionWithResponses() {
   public function testRedirectWithNull() {
     $form_submitter = $this->getFormSubmitter();
 
-    $form_state = $this->getMock('Drupal\Core\Form\FormStateInterface');
+    $form_state = $this->getMock(FormStateInterface::class);
     $form_state->expects($this->once())
       ->method('getRedirect')
       ->willReturn(NULL);
@@ -144,7 +147,7 @@ public function testRedirectWithUrl(Url $redirect_value, $result, $status = 303)
         ])
       );
 
-    $form_state = $this->getMock('Drupal\Core\Form\FormStateInterface');
+    $form_state = $this->getMock(FormStateInterface::class);
     $form_state->expects($this->once())
       ->method('getRedirect')
       ->willReturn($redirect_value);
@@ -174,7 +177,7 @@ public function providerTestRedirectWithUrl() {
   public function testRedirectWithResponseObject() {
     $form_submitter = $this->getFormSubmitter();
     $redirect = new RedirectResponse('/example');
-    $form_state = $this->getMock('Drupal\Core\Form\FormStateInterface');
+    $form_state = $this->getMock(FormStateInterface::class);
     $form_state->expects($this->once())
       ->method('getRedirect')
       ->willReturn($redirect);
@@ -199,7 +202,7 @@ public function testRedirectWithoutResult() {
     $container->set('url_generator', $this->urlGenerator);
     $container->set('unrouted_url_assembler', $this->unroutedUrlAssembler);
     \Drupal::setContainer($container);
-    $form_state = $this->getMock('Drupal\Core\Form\FormStateInterface');
+    $form_state = $this->getMock(FormStateInterface::class);
     $form_state->expects($this->once())
       ->method('getRedirect')
       ->willReturn(FALSE);
@@ -212,7 +215,7 @@ public function testRedirectWithoutResult() {
    */
   public function testExecuteSubmitHandlers() {
     $form_submitter = $this->getFormSubmitter();
-    $mock = $this->getMockForAbstractClass('Drupal\Core\Form\FormBase', [], '', TRUE, TRUE, TRUE, ['submit_handler', 'hash_submit', 'simple_string_submit']);
+    $mock = $this->getMockForAbstractClass(FormBase::class, [], '', TRUE, TRUE, TRUE, ['submit_handler', 'hash_submit', 'simple_string_submit']);
     $mock->expects($this->once())
       ->method('submit_handler')
       ->with($this->isType('array'), $this->isInstanceOf('Drupal\Core\Form\FormStateInterface'));
@@ -247,7 +250,7 @@ public function testExecuteSubmitHandlers() {
   protected function getFormSubmitter() {
     $request_stack = new RequestStack();
     $request_stack->push(Request::create('/test-path'));
-    return $this->getMockBuilder('Drupal\Core\Form\FormSubmitter')
+    return $this->getMockBuilder(FormSubmitter::class)
       ->setConstructorArgs([$request_stack, $this->urlGenerator])
       ->setMethods(['batchGet', 'drupalInstallationAttempted'])
       ->getMock();
diff --git a/core/tests/Drupal/Tests/Core/Form/FormValidatorTest.php b/core/tests/Drupal/Tests/Core/Form/FormValidatorTest.php
index 18f0be2..e889d57 100644
--- a/core/tests/Drupal/Tests/Core/Form/FormValidatorTest.php
+++ b/core/tests/Drupal/Tests/Core/Form/FormValidatorTest.php
@@ -2,8 +2,12 @@
 
 namespace Drupal\Tests\Core\Form;
 
+use Drupal\Core\Access\CsrfTokenGenerator;
+use Drupal\Core\Form\FormErrorHandlerInterface;
 use Drupal\Core\Form\FormState;
+use Drupal\Core\Form\FormValidator;
 use Drupal\Tests\UnitTestCase;
+use Psr\Log\LoggerInterface;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpFoundation\RequestStack;
 
@@ -39,11 +43,11 @@ class FormValidatorTest extends UnitTestCase {
    */
   protected function setUp() {
     parent::setUp();
-    $this->logger = $this->getMock('Psr\Log\LoggerInterface');
-    $this->csrfToken = $this->getMockBuilder('Drupal\Core\Access\CsrfTokenGenerator')
+    $this->logger = $this->getMock(LoggerInterface::class);
+    $this->csrfToken = $this->getMockBuilder(CsrfTokenGenerator::class)
       ->disableOriginalConstructor()
       ->getMock();
-    $this->formErrorHandler = $this->getMock('Drupal\Core\Form\FormErrorHandlerInterface');
+    $this->formErrorHandler = $this->getMock(FormErrorHandlerInterface::class);
   }
 
   /**
@@ -53,7 +57,7 @@ protected function setUp() {
    * @covers ::finalizeValidation
    */
   public function testValidationComplete() {
-    $form_validator = $this->getMockBuilder('Drupal\Core\Form\FormValidator')
+    $form_validator = $this->getMockBuilder(FormValidator::class)
       ->setConstructorArgs([new RequestStack(), $this->getStringTranslationStub(), $this->csrfToken, $this->logger, $this->formErrorHandler])
       ->setMethods(NULL)
       ->getMock();
@@ -71,7 +75,7 @@ public function testValidationComplete() {
    * @covers ::validateForm
    */
   public function testPreventDuplicateValidation() {
-    $form_validator = $this->getMockBuilder('Drupal\Core\Form\FormValidator')
+    $form_validator = $this->getMockBuilder(FormValidator::class)
       ->setConstructorArgs([new RequestStack(), $this->getStringTranslationStub(), $this->csrfToken, $this->logger, $this->formErrorHandler])
       ->setMethods(['doValidateForm'])
       ->getMock();
@@ -91,7 +95,7 @@ public function testPreventDuplicateValidation() {
    * @covers ::validateForm
    */
   public function testMustValidate() {
-    $form_validator = $this->getMockBuilder('Drupal\Core\Form\FormValidator')
+    $form_validator = $this->getMockBuilder(FormValidator::class)
       ->setConstructorArgs([new RequestStack(), $this->getStringTranslationStub(), $this->csrfToken, $this->logger, $this->formErrorHandler])
       ->setMethods(['doValidateForm'])
       ->getMock();
@@ -118,7 +122,7 @@ public function testValidateInvalidFormToken() {
       ->method('validate')
       ->will($this->returnValue(FALSE));
 
-    $form_validator = $this->getMockBuilder('Drupal\Core\Form\FormValidator')
+    $form_validator = $this->getMockBuilder(FormValidator::class)
       ->setConstructorArgs([$request_stack, $this->getStringTranslationStub(), $this->csrfToken, $this->logger, $this->formErrorHandler])
       ->setMethods(['doValidateForm'])
       ->getMock();
@@ -126,7 +130,7 @@ public function testValidateInvalidFormToken() {
       ->method('doValidateForm');
 
     $form['#token'] = 'test_form_id';
-    $form_state = $this->getMockBuilder('Drupal\Core\Form\FormState')
+    $form_state = $this->getMockBuilder(FormState::class)
       ->setMethods(['setErrorByName'])
       ->getMock();
     $form_state->expects($this->once())
@@ -146,7 +150,7 @@ public function testValidateValidFormToken() {
       ->method('validate')
       ->will($this->returnValue(TRUE));
 
-    $form_validator = $this->getMockBuilder('Drupal\Core\Form\FormValidator')
+    $form_validator = $this->getMockBuilder(FormValidator::class)
       ->setConstructorArgs([$request_stack, $this->getStringTranslationStub(), $this->csrfToken, $this->logger, $this->formErrorHandler])
       ->setMethods(['doValidateForm'])
       ->getMock();
@@ -154,7 +158,7 @@ public function testValidateValidFormToken() {
       ->method('doValidateForm');
 
     $form['#token'] = 'test_form_id';
-    $form_state = $this->getMockBuilder('Drupal\Core\Form\FormState')
+    $form_state = $this->getMockBuilder(FormState::class)
       ->setMethods(['setErrorByName'])
       ->getMock();
     $form_state->expects($this->never())
@@ -170,7 +174,7 @@ public function testValidateValidFormToken() {
    * @dataProvider providerTestHandleErrorsWithLimitedValidation
    */
   public function testHandleErrorsWithLimitedValidation($sections, $triggering_element, $values, $expected) {
-    $form_validator = $this->getMockBuilder('Drupal\Core\Form\FormValidator')
+    $form_validator = $this->getMockBuilder(FormValidator::class)
       ->setConstructorArgs([new RequestStack(), $this->getStringTranslationStub(), $this->csrfToken, $this->logger, $this->formErrorHandler])
       ->setMethods(NULL)
       ->getMock();
@@ -266,11 +270,11 @@ public function providerTestHandleErrorsWithLimitedValidation() {
    * @covers ::executeValidateHandlers
    */
   public function testExecuteValidateHandlers() {
-    $form_validator = $this->getMockBuilder('Drupal\Core\Form\FormValidator')
+    $form_validator = $this->getMockBuilder(FormValidator::class)
       ->setConstructorArgs([new RequestStack(), $this->getStringTranslationStub(), $this->csrfToken, $this->logger, $this->formErrorHandler])
       ->setMethods(NULL)
       ->getMock();
-    $mock = $this->getMock('stdClass', ['validate_handler', 'hash_validate']);
+    $mock = $this->getMock(\stdClass::class, ['validate_handler', 'hash_validate']);
     $mock->expects($this->once())
       ->method('validate_handler')
       ->with($this->isType('array'), $this->isInstanceOf('Drupal\Core\Form\FormStateInterface'));
@@ -297,7 +301,7 @@ public function testExecuteValidateHandlers() {
    * @dataProvider providerTestRequiredErrorMessage
    */
   public function testRequiredErrorMessage($element, $expected_message) {
-    $form_validator = $this->getMockBuilder('Drupal\Core\Form\FormValidator')
+    $form_validator = $this->getMockBuilder(FormValidator::class)
       ->setConstructorArgs([new RequestStack(), $this->getStringTranslationStub(), $this->csrfToken, $this->logger, $this->formErrorHandler])
       ->setMethods(['executeValidateHandlers'])
       ->getMock();
@@ -312,7 +316,7 @@ public function testRequiredErrorMessage($element, $expected_message) {
       '#required' => TRUE,
       '#parents' => ['test'],
     ];
-    $form_state = $this->getMockBuilder('Drupal\Core\Form\FormState')
+    $form_state = $this->getMockBuilder(FormState::class)
       ->setMethods(['setError'])
       ->getMock();
     $form_state->expects($this->once())
@@ -345,13 +349,13 @@ public function providerTestRequiredErrorMessage() {
    * @covers ::doValidateForm
    */
   public function testElementValidate() {
-    $form_validator = $this->getMockBuilder('Drupal\Core\Form\FormValidator')
+    $form_validator = $this->getMockBuilder(FormValidator::class)
       ->setConstructorArgs([new RequestStack(), $this->getStringTranslationStub(), $this->csrfToken, $this->logger, $this->formErrorHandler])
       ->setMethods(['executeValidateHandlers'])
       ->getMock();
     $form_validator->expects($this->once())
       ->method('executeValidateHandlers');
-    $mock = $this->getMock('stdClass', ['element_validate']);
+    $mock = $this->getMock(\stdClass::class, ['element_validate']);
     $mock->expects($this->once())
       ->method('element_validate')
       ->with($this->isType('array'), $this->isInstanceOf('Drupal\Core\Form\FormStateInterface'), NULL);
@@ -373,7 +377,7 @@ public function testElementValidate() {
    * @dataProvider providerTestPerformRequiredValidation
    */
   public function testPerformRequiredValidation($element, $expected_message, $call_watchdog) {
-    $form_validator = $this->getMockBuilder('Drupal\Core\Form\FormValidator')
+    $form_validator = $this->getMockBuilder(FormValidator::class)
       ->setConstructorArgs([new RequestStack(), $this->getStringTranslationStub(), $this->csrfToken, $this->logger, $this->formErrorHandler])
       ->setMethods(['setError'])
       ->getMock();
@@ -391,7 +395,7 @@ public function testPerformRequiredValidation($element, $expected_message, $call
       '#required' => FALSE,
       '#parents' => ['test'],
     ];
-    $form_state = $this->getMockBuilder('Drupal\Core\Form\FormState')
+    $form_state = $this->getMockBuilder(FormState::class)
       ->setMethods(['setError'])
       ->getMock();
     $form_state->expects($this->once())
diff --git a/core/tests/Drupal/Tests/Core/Http/ClientFactoryTest.php b/core/tests/Drupal/Tests/Core/Http/ClientFactoryTest.php
index 60308dd..92298d2 100644
--- a/core/tests/Drupal/Tests/Core/Http/ClientFactoryTest.php
+++ b/core/tests/Drupal/Tests/Core/Http/ClientFactoryTest.php
@@ -5,6 +5,7 @@
 use Drupal\Core\Http\ClientFactory;
 use Drupal\Core\Site\Settings;
 use Drupal\Tests\UnitTestCase;
+use GuzzleHttp\HandlerStack;
 
 /**
  * @coversDefaultClass \Drupal\Core\Http\ClientFactory
@@ -23,7 +24,7 @@ class ClientFactoryTest extends UnitTestCase {
    * {@inheritdoc}
    */
   protected function setUp() {
-    $stack = $this->getMockBuilder('GuzzleHttp\HandlerStack')
+    $stack = $this->getMockBuilder(HandlerStack::class)
       ->disableOriginalConstructor()
       ->getMock();
     $this->factory = new ClientFactory($stack);
diff --git a/core/tests/Drupal/Tests/Core/Image/ImageTest.php b/core/tests/Drupal/Tests/Core/Image/ImageTest.php
index 6b35f86..0c88455 100644
--- a/core/tests/Drupal/Tests/Core/Image/ImageTest.php
+++ b/core/tests/Drupal/Tests/Core/Image/ImageTest.php
@@ -4,7 +4,9 @@
 
 use Drupal\Core\Image\Image;
 use Drupal\Core\ImageToolkit\ImageToolkitInterface;
+use Drupal\system\Plugin\ImageToolkit\GDToolkit;
 use Drupal\Tests\UnitTestCase;
+use Psr\Log\LoggerInterface;
 
 /**
  * Tests the image class.
@@ -59,7 +61,7 @@ protected function setUp() {
    * @return \PHPUnit_Framework_MockObject_MockObject
    */
   protected function getToolkitMock(array $stubs = []) {
-    $mock_builder = $this->getMockBuilder('Drupal\system\Plugin\ImageToolkit\GDToolkit');
+    $mock_builder = $this->getMockBuilder(GDToolkit::class);
     $stubs = array_merge(['getPluginId', 'save'], $stubs);
     return $mock_builder
       ->disableOriginalConstructor()
@@ -79,7 +81,7 @@ protected function getToolkitMock(array $stubs = []) {
    */
   protected function getToolkitOperationMock($class_name, ImageToolkitInterface $toolkit) {
     $mock_builder = $this->getMockBuilder('Drupal\system\Plugin\ImageToolkit\Operation\gd\\' . $class_name);
-    $logger = $this->getMock('Psr\Log\LoggerInterface');
+    $logger = $this->getMock(LoggerInterface::class);
     return $mock_builder
       ->setMethods(['execute'])
       ->setConstructorArgs([[], '', [], $toolkit, $logger])
@@ -209,7 +211,7 @@ public function testSave() {
       ->method('save')
       ->will($this->returnValue(TRUE));
 
-    $image = $this->getMock('Drupal\Core\Image\Image', ['chmod'], [$toolkit, $this->image->getSource()]);
+    $image = $this->getMock(Image::class, ['chmod'], [$toolkit, $this->image->getSource()]);
     $image->expects($this->any())
       ->method('chmod')
       ->will($this->returnValue(TRUE));
@@ -241,7 +243,7 @@ public function testChmodFails() {
       ->method('save')
       ->will($this->returnValue(TRUE));
 
-    $image = $this->getMock('Drupal\Core\Image\Image', ['chmod'], [$toolkit, $this->image->getSource()]);
+    $image = $this->getMock(Image::class, ['chmod'], [$toolkit, $this->image->getSource()]);
     $image->expects($this->any())
       ->method('chmod')
       ->will($this->returnValue(FALSE));
diff --git a/core/tests/Drupal/Tests/Core/Language/LanguageUnitTest.php b/core/tests/Drupal/Tests/Core/Language/LanguageUnitTest.php
index aefcbb0..cbde848 100644
--- a/core/tests/Drupal/Tests/Core/Language/LanguageUnitTest.php
+++ b/core/tests/Drupal/Tests/Core/Language/LanguageUnitTest.php
@@ -3,8 +3,10 @@
 namespace Drupal\Tests\Core\Language;
 
 use Drupal\Core\Language\Language;
+use Drupal\Core\Language\LanguageDefault;
 use Drupal\Core\Language\LanguageInterface;
 use Drupal\Tests\UnitTestCase;
+use Symfony\Component\DependencyInjection\ContainerInterface;
 
 /**
  * @coversDefaultClass \Drupal\Core\Language\Language
@@ -58,8 +60,8 @@ public function testGetDirection() {
    * @covers ::isDefault
    */
   public function testIsDefault() {
-    $language_default = $this->getMockBuilder('Drupal\Core\Language\LanguageDefault')->disableOriginalConstructor()->getMock();
-    $container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
+    $language_default = $this->getMockBuilder(LanguageDefault::class)->disableOriginalConstructor()->getMock();
+    $container = $this->getMock(ContainerInterface::class);
     $container->expects($this->any())
       ->method('get')
       ->with('language.default')
diff --git a/core/tests/Drupal/Tests/Core/Lock/LockBackendAbstractTest.php b/core/tests/Drupal/Tests/Core/Lock/LockBackendAbstractTest.php
index 242a4ca..b89b029 100644
--- a/core/tests/Drupal/Tests/Core/Lock/LockBackendAbstractTest.php
+++ b/core/tests/Drupal/Tests/Core/Lock/LockBackendAbstractTest.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\Tests\Core\Lock;
 
+use Drupal\Core\Lock\LockBackendAbstract;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -18,7 +19,7 @@ class LockBackendAbstractTest extends UnitTestCase {
   protected $lock;
 
   protected function setUp() {
-    $this->lock = $this->getMockForAbstractClass('Drupal\Core\Lock\LockBackendAbstract');
+    $this->lock = $this->getMockForAbstractClass(LockBackendAbstract::class);
   }
 
   /**
diff --git a/core/tests/Drupal/Tests/Core/Logger/LoggerChannelFactoryTest.php b/core/tests/Drupal/Tests/Core/Logger/LoggerChannelFactoryTest.php
index 7fb9e2f..bb427fe 100644
--- a/core/tests/Drupal/Tests/Core/Logger/LoggerChannelFactoryTest.php
+++ b/core/tests/Drupal/Tests/Core/Logger/LoggerChannelFactoryTest.php
@@ -4,6 +4,7 @@
 
 use Drupal\Core\Logger\LoggerChannelFactory;
 use Drupal\Tests\UnitTestCase;
+use Symfony\Component\DependencyInjection\ContainerInterface;
 
 /**
  * @coversDefaultClass \Drupal\Core\Logger\LoggerChannelFactory
@@ -18,7 +19,7 @@ class LoggerChannelFactoryTest extends UnitTestCase {
    */
   public function testGet() {
     $factory = new LoggerChannelFactory();
-    $factory->setContainer($this->getMock('Symfony\Component\DependencyInjection\ContainerInterface'));
+    $factory->setContainer($this->getMock(ContainerInterface::class));
 
     // Ensure that when called with the same argument, always the same instance
     // will be returned.
diff --git a/core/tests/Drupal/Tests/Core/Logger/LoggerChannelTest.php b/core/tests/Drupal/Tests/Core/Logger/LoggerChannelTest.php
index d2b283a..49c6853 100644
--- a/core/tests/Drupal/Tests/Core/Logger/LoggerChannelTest.php
+++ b/core/tests/Drupal/Tests/Core/Logger/LoggerChannelTest.php
@@ -10,6 +10,7 @@
 use Drupal\Core\Logger\LoggerChannel;
 use Drupal\Core\Session\AccountInterface;
 use Drupal\Tests\UnitTestCase;
+use Symfony\Component\HttpFoundation\ParameterBag;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpFoundation\RequestStack;
 use Psr\Log\LoggerInterface;
@@ -40,7 +41,7 @@ class LoggerChannelTest extends UnitTestCase {
   public function testLog(callable $expected, Request $request = NULL, AccountInterface $current_user = NULL) {
     $channel = new LoggerChannel('test');
     $message = $this->randomMachineName();
-    $logger = $this->getMock('Psr\Log\LoggerInterface');
+    $logger = $this->getMock(LoggerInterface::class);
     $logger->expects($this->once())
       ->method('log')
       ->with($this->anything(), $message, $this->callback($expected));
@@ -63,7 +64,7 @@ public function testLog(callable $expected, Request $request = NULL, AccountInte
    */
   public function testLogRecursionProtection() {
     $channel = new LoggerChannel('test');
-    $logger = $this->getMock('Psr\Log\LoggerInterface');
+    $logger = $this->getMock(LoggerInterface::class);
     $logger->expects($this->exactly(LoggerChannel::MAX_CALL_DEPTH))
       ->method('log');
     $channel->addLogger($logger);
@@ -81,7 +82,7 @@ public function testSortLoggers() {
     $channel = new LoggerChannel($this->randomMachineName());
     $index_order = '';
     for ($i = 0; $i < 4; $i++) {
-      $logger = $this->getMock('Psr\Log\LoggerInterface');
+      $logger = $this->getMock(LoggerInterface::class);
       $logger->expects($this->once())
         ->method('log')
         ->will($this->returnCallback(function () use ($i, &$index_order) {
@@ -101,16 +102,16 @@ public function testSortLoggers() {
    * Data provider for self::testLog().
    */
   public function providerTestLog() {
-    $account_mock = $this->getMock('Drupal\Core\Session\AccountInterface');
+    $account_mock = $this->getMock(AccountInterface::class);
     $account_mock->expects($this->exactly(2))
       ->method('id')
       ->will($this->returnValue(1));
 
-    $request_mock = $this->getMock('Symfony\Component\HttpFoundation\Request');
+    $request_mock = $this->getMock(Request::class);
     $request_mock->expects($this->exactly(2))
       ->method('getClientIp')
       ->will($this->returnValue('127.0.0.1'));
-    $request_mock->headers = $this->getMock('Symfony\Component\HttpFoundation\ParameterBag');
+    $request_mock->headers = $this->getMock(ParameterBag::class);
 
     // No request or account.
     $cases [] = [
diff --git a/core/tests/Drupal/Tests/Core/Mail/MailManagerTest.php b/core/tests/Drupal/Tests/Core/Mail/MailManagerTest.php
index 9ba2fb5..ecd1bdc 100644
--- a/core/tests/Drupal/Tests/Core/Mail/MailManagerTest.php
+++ b/core/tests/Drupal/Tests/Core/Mail/MailManagerTest.php
@@ -7,6 +7,9 @@
 
 namespace Drupal\Tests\Core\Mail;
 
+use Drupal\Core\Cache\CacheBackendInterface;
+use Drupal\Core\Extension\ModuleHandlerInterface;
+use Drupal\Core\Logger\LoggerChannelFactoryInterface;
 use Drupal\Core\Render\RenderContext;
 use Drupal\Core\Render\RendererInterface;
 use Drupal\Tests\UnitTestCase;
@@ -83,12 +86,12 @@ class MailManagerTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
     // Prepare the default constructor arguments required by MailManager.
-    $this->cache = $this->getMock('Drupal\Core\Cache\CacheBackendInterface');
+    $this->cache = $this->getMock(CacheBackendInterface::class);
 
-    $this->moduleHandler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface');
+    $this->moduleHandler = $this->getMock(ModuleHandlerInterface::class);
 
     // Mock a Discovery object to replace AnnotationClassDiscovery.
-    $this->discovery = $this->getMock('Drupal\Component\Plugin\Discovery\DiscoveryInterface');
+    $this->discovery = $this->getMock(DiscoveryInterface::class);
     $this->discovery->expects($this->any())
       ->method('getDefinitions')
       ->will($this->returnValue($this->definitions));
@@ -104,7 +107,7 @@ protected function setUpMailManager($interface = []) {
         'interface' => $interface,
       ],
     ]);
-    $logger_factory = $this->getMock('\Drupal\Core\Logger\LoggerChannelFactoryInterface');
+    $logger_factory = $this->getMock(LoggerChannelFactoryInterface::class);
     $string_translation = $this->getStringTranslationStub();
     $this->renderer = $this->getMock(RendererInterface::class);
     // Construct the manager object and override its discovery.
diff --git a/core/tests/Drupal/Tests/Core/Menu/ContextualLinkDefaultTest.php b/core/tests/Drupal/Tests/Core/Menu/ContextualLinkDefaultTest.php
index a956d83..4016e44 100644
--- a/core/tests/Drupal/Tests/Core/Menu/ContextualLinkDefaultTest.php
+++ b/core/tests/Drupal/Tests/Core/Menu/ContextualLinkDefaultTest.php
@@ -4,6 +4,7 @@
 
 use Drupal\Core\Menu\ContextualLinkDefault;
 use Drupal\Core\StringTranslation\TranslatableMarkup;
+use Drupal\Core\StringTranslation\TranslationInterface;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\HttpFoundation\Request;
 
@@ -53,7 +54,7 @@ class ContextualLinkDefaultTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $this->stringTranslation = $this->getMock('Drupal\Core\StringTranslation\TranslationInterface');
+    $this->stringTranslation = $this->getMock(TranslationInterface::class);
   }
 
   protected function setupContextualLinkDefault() {
diff --git a/core/tests/Drupal/Tests/Core/Menu/ContextualLinkManagerTest.php b/core/tests/Drupal/Tests/Core/Menu/ContextualLinkManagerTest.php
index bebc935..0f416a0 100644
--- a/core/tests/Drupal/Tests/Core/Menu/ContextualLinkManagerTest.php
+++ b/core/tests/Drupal/Tests/Core/Menu/ContextualLinkManagerTest.php
@@ -2,12 +2,22 @@
 
 namespace Drupal\Tests\Core\Menu;
 
+use Drupal\Component\Plugin\Discovery\DiscoveryInterface;
 use Drupal\Component\Plugin\Exception\PluginException;
+use Drupal\Component\Plugin\Factory\FactoryInterface;
+use Drupal\Core\Access\AccessManagerInterface;
 use Drupal\Core\Access\AccessResult;
+use Drupal\Core\Cache\CacheBackendInterface;
+use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Language\Language;
+use Drupal\Core\Language\LanguageManagerInterface;
 use Drupal\Core\Menu\ContextualLinkDefault;
+use Drupal\Core\Menu\ContextualLinkInterface;
+use Drupal\Core\Menu\ContextualLinkManager;
+use Drupal\Core\Session\AccountInterface;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\HttpFoundation\RequestStack;
+use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface;
 
 /**
  * @coversDefaultClass \Drupal\Core\Menu\ContextualLinkManager
@@ -73,18 +83,18 @@ class ContextualLinkManagerTest extends UnitTestCase {
 
   protected function setUp() {
     $this->contextualLinkManager = $this
-      ->getMockBuilder('Drupal\Core\Menu\ContextualLinkManager')
+      ->getMockBuilder(ContextualLinkManager::class)
       ->disableOriginalConstructor()
       ->setMethods(NULL)
       ->getMock();
 
-    $this->controllerResolver = $this->getMock('Symfony\Component\HttpKernel\Controller\ControllerResolverInterface');
-    $this->pluginDiscovery = $this->getMock('Drupal\Component\Plugin\Discovery\DiscoveryInterface');
-    $this->factory = $this->getMock('Drupal\Component\Plugin\Factory\FactoryInterface');
-    $this->cacheBackend = $this->getMock('Drupal\Core\Cache\CacheBackendInterface');
-    $this->moduleHandler = $this->getMock('\Drupal\Core\Extension\ModuleHandlerInterface');
-    $this->accessManager = $this->getMock('Drupal\Core\Access\AccessManagerInterface');
-    $this->account = $this->getMock('Drupal\Core\Session\AccountInterface');
+    $this->controllerResolver = $this->getMock(ControllerResolverInterface::class);
+    $this->pluginDiscovery = $this->getMock(DiscoveryInterface::class);
+    $this->factory = $this->getMock(FactoryInterface::class);
+    $this->cacheBackend = $this->getMock(CacheBackendInterface::class);
+    $this->moduleHandler = $this->getMock(ModuleHandlerInterface::class);
+    $this->accessManager = $this->getMock(AccessManagerInterface::class);
+    $this->account = $this->getMock(AccountInterface::class);
 
     $property = new \ReflectionProperty('Drupal\Core\Menu\ContextualLinkManager', 'controllerResolver');
     $property->setAccessible(TRUE);
@@ -110,7 +120,7 @@ protected function setUp() {
     $property->setAccessible(TRUE);
     $property->setValue($this->contextualLinkManager, $this->moduleHandler);
 
-    $language_manager = $this->getMock('Drupal\Core\Language\LanguageManagerInterface');
+    $language_manager = $this->getMock(LanguageManagerInterface::class);
     $language_manager->expects($this->any())
       ->method('getCurrentLanguage')
       ->will($this->returnValue(new Language(['id' => 'en'])));
@@ -278,7 +288,7 @@ public function testGetContextualLinksArrayByGroup() {
     // Set up mocking of the plugin factory.
     $map = [];
     foreach ($definitions as $plugin_id => $definition) {
-      $plugin = $this->getMock('Drupal\Core\Menu\ContextualLinkInterface');
+      $plugin = $this->getMock(ContextualLinkInterface::class);
       $plugin->expects($this->any())
         ->method('getRouteName')
         ->will($this->returnValue($definition['route_name']));
@@ -352,7 +362,7 @@ public function testGetContextualLinksArrayByGroupAccessCheck() {
     // Set up mocking of the plugin factory.
     $map = [];
     foreach ($definitions as $plugin_id => $definition) {
-      $plugin = $this->getMock('Drupal\Core\Menu\ContextualLinkInterface');
+      $plugin = $this->getMock(ContextualLinkInterface::class);
       $plugin->expects($this->any())
         ->method('getRouteName')
         ->will($this->returnValue($definition['route_name']));
diff --git a/core/tests/Drupal/Tests/Core/Menu/DefaultMenuLinkTreeManipulatorsTest.php b/core/tests/Drupal/Tests/Core/Menu/DefaultMenuLinkTreeManipulatorsTest.php
index beb7828..ab72f1b 100644
--- a/core/tests/Drupal/Tests/Core/Menu/DefaultMenuLinkTreeManipulatorsTest.php
+++ b/core/tests/Drupal/Tests/Core/Menu/DefaultMenuLinkTreeManipulatorsTest.php
@@ -2,13 +2,16 @@
 
 namespace Drupal\Tests\Core\Menu;
 
+use Drupal\Core\Access\AccessManagerInterface;
 use Drupal\Core\Access\AccessResult;
 use Drupal\Core\Cache\Context\CacheContextsManager;
 use Drupal\Core\DependencyInjection\Container;
 use Drupal\Core\Entity\EntityStorageInterface;
 use Drupal\Core\Entity\EntityTypeManagerInterface;
+use Drupal\Core\Entity\Query\QueryInterface;
 use Drupal\Core\Menu\DefaultMenuLinkTreeManipulators;
 use Drupal\Core\Menu\MenuLinkTreeElement;
+use Drupal\Core\Session\AccountInterface;
 use Drupal\Tests\UnitTestCase;
 use Drupal\node\NodeInterface;
 
@@ -69,8 +72,8 @@ class DefaultMenuLinkTreeManipulatorsTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $this->accessManager = $this->getMock('\Drupal\Core\Access\AccessManagerInterface');
-    $this->currentUser = $this->getMock('Drupal\Core\Session\AccountInterface');
+    $this->accessManager = $this->getMock(AccessManagerInterface::class);
+    $this->currentUser = $this->getMock(AccountInterface::class);
     $this->currentUser->method('isAuthenticated')
       ->willReturn(TRUE);
     $this->entityTypeManager = $this->getMock(EntityTypeManagerInterface::class);
@@ -290,7 +293,7 @@ public function testCheckNodeAccess() {
       6 => new MenuLinkTreeElement($links[6], FALSE, 2, FALSE, []),
     ]);
 
-    $query = $this->getMock('Drupal\Core\Entity\Query\QueryInterface');
+    $query = $this->getMock(QueryInterface::class);
     $query->expects($this->at(0))
       ->method('condition')
       ->with('nid', [1, 2, 3, 4]);
diff --git a/core/tests/Drupal/Tests/Core/Menu/LocalActionDefaultTest.php b/core/tests/Drupal/Tests/Core/Menu/LocalActionDefaultTest.php
index b026fb0..8b84c31 100644
--- a/core/tests/Drupal/Tests/Core/Menu/LocalActionDefaultTest.php
+++ b/core/tests/Drupal/Tests/Core/Menu/LocalActionDefaultTest.php
@@ -3,7 +3,9 @@
 namespace Drupal\Tests\Core\Menu;
 
 use Drupal\Core\Menu\LocalActionDefault;
+use Drupal\Core\Routing\RouteProviderInterface;
 use Drupal\Core\StringTranslation\TranslatableMarkup;
+use Drupal\Core\StringTranslation\TranslationInterface;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\HttpFoundation\Request;
 
@@ -60,8 +62,8 @@ class LocalActionDefaultTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $this->stringTranslation = $this->getMock('Drupal\Core\StringTranslation\TranslationInterface');
-    $this->routeProvider = $this->getMock('Drupal\Core\Routing\RouteProviderInterface');
+    $this->stringTranslation = $this->getMock(TranslationInterface::class);
+    $this->routeProvider = $this->getMock(RouteProviderInterface::class);
   }
 
   /**
diff --git a/core/tests/Drupal/Tests/Core/Menu/LocalActionManagerTest.php b/core/tests/Drupal/Tests/Core/Menu/LocalActionManagerTest.php
index 0f1f848..3daa41b 100644
--- a/core/tests/Drupal/Tests/Core/Menu/LocalActionManagerTest.php
+++ b/core/tests/Drupal/Tests/Core/Menu/LocalActionManagerTest.php
@@ -13,7 +13,9 @@
 use Drupal\Core\Access\AccessResult;
 use Drupal\Core\Access\AccessResultForbidden;
 use Drupal\Core\Cache\CacheBackendInterface;
+use Drupal\Core\Controller\ControllerResolverInterface;
 use Drupal\Core\Extension\ModuleHandlerInterface;
+use Drupal\Core\Menu\LocalActionInterface;
 use Drupal\Core\Menu\LocalActionManager;
 use Drupal\Core\Routing\RouteMatchInterface;
 use Drupal\Core\Routing\RouteProviderInterface;
@@ -104,21 +106,21 @@ class LocalActionManagerTest extends UnitTestCase {
    * {@inheritdoc}
    */
   protected function setUp() {
-    $this->controllerResolver = $this->getMock('Drupal\Core\Controller\ControllerResolverInterface');
-    $this->request = $this->getMock('Symfony\Component\HttpFoundation\Request');
-    $this->routeProvider = $this->getMock('Drupal\Core\Routing\RouteProviderInterface');
-    $this->moduleHandler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface');
-    $this->cacheBackend = $this->getMock('Drupal\Core\Cache\CacheBackendInterface');
+    $this->controllerResolver = $this->getMock(ControllerResolverInterface::class);
+    $this->request = $this->getMock(Request::class);
+    $this->routeProvider = $this->getMock(RouteProviderInterface::class);
+    $this->moduleHandler = $this->getMock(ModuleHandlerInterface::class);
+    $this->cacheBackend = $this->getMock(CacheBackendInterface::class);
 
     $access_result = new AccessResultForbidden();
-    $this->accessManager = $this->getMock('Drupal\Core\Access\AccessManagerInterface');
+    $this->accessManager = $this->getMock(AccessManagerInterface::class);
     $this->accessManager->expects($this->any())
       ->method('checkNamedRoute')
       ->willReturn($access_result);
-    $this->account = $this->getMock('Drupal\Core\Session\AccountInterface');
-    $this->discovery = $this->getMock('Drupal\Component\Plugin\Discovery\DiscoveryInterface');
-    $this->factory = $this->getMock('Drupal\Component\Plugin\Factory\FactoryInterface');
-    $route_match = $this->getMock('Drupal\Core\Routing\RouteMatchInterface');
+    $this->account = $this->getMock(AccountInterface::class);
+    $this->discovery = $this->getMock(DiscoveryInterface::class);
+    $this->factory = $this->getMock(FactoryInterface::class);
+    $route_match = $this->getMock(RouteMatchInterface::class);
 
     $this->localActionManager = new TestLocalActionManager($this->controllerResolver, $this->request, $route_match, $this->routeProvider, $this->moduleHandler, $this->cacheBackend, $this->accessManager, $this->account, $this->discovery, $this->factory);
   }
@@ -127,7 +129,7 @@ protected function setUp() {
    * @covers ::getTitle
    */
   public function testGetTitle() {
-    $local_action = $this->getMock('Drupal\Core\Menu\LocalActionInterface');
+    $local_action = $this->getMock(LocalActionInterface::class);
     $local_action->expects($this->once())
       ->method('getTitle')
       ->with('test');
@@ -151,7 +153,7 @@ public function testGetActionsForRoute($route_appears, array $plugin_definitions
       ->will($this->returnValue($plugin_definitions));
     $map = [];
     foreach ($plugin_definitions as $plugin_id => $plugin_definition) {
-      $plugin = $this->getMock('Drupal\Core\Menu\LocalActionInterface');
+      $plugin = $this->getMock(LocalActionInterface::class);
       $plugin->expects($this->any())
         ->method('getRouteName')
         ->will($this->returnValue($plugin_definition['route_name']));
diff --git a/core/tests/Drupal/Tests/Core/Menu/LocalTaskDefaultTest.php b/core/tests/Drupal/Tests/Core/Menu/LocalTaskDefaultTest.php
index 84b91af..aee9d5c 100644
--- a/core/tests/Drupal/Tests/Core/Menu/LocalTaskDefaultTest.php
+++ b/core/tests/Drupal/Tests/Core/Menu/LocalTaskDefaultTest.php
@@ -11,6 +11,7 @@
 use Drupal\Core\Routing\RouteMatch;
 use Drupal\Core\Routing\RouteProviderInterface;
 use Drupal\Core\StringTranslation\TranslatableMarkup;
+use Drupal\Core\StringTranslation\TranslationInterface;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\Routing\Route;
 
@@ -67,8 +68,8 @@ class LocalTaskDefaultTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $this->stringTranslation = $this->getMock('Drupal\Core\StringTranslation\TranslationInterface');
-    $this->routeProvider = $this->getMock('Drupal\Core\Routing\RouteProviderInterface');
+    $this->stringTranslation = $this->getMock(TranslationInterface::class);
+    $this->routeProvider = $this->getMock(RouteProviderInterface::class);
   }
 
   /**
diff --git a/core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php b/core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php
index 3d3d501..c9330a6 100644
--- a/core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php
+++ b/core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php
@@ -2,15 +2,25 @@
 
 namespace Drupal\Tests\Core\Menu;
 
+use Drupal\Component\Plugin\Discovery\DiscoveryInterface;
+use Drupal\Component\Plugin\Factory\FactoryInterface;
+use Drupal\Core\Access\AccessManagerInterface;
 use Drupal\Core\Access\AccessResult;
 use Drupal\Core\Cache\Cache;
 use Drupal\Core\Cache\CacheableDependencyInterface;
 use Drupal\Core\Cache\CacheableMetadata;
+use Drupal\Core\Cache\CacheBackendInterface;
 use Drupal\Core\Cache\Context\CacheContextsManager;
+use Drupal\Core\Controller\ControllerResolverInterface;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
+use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Language\Language;
+use Drupal\Core\Language\LanguageManagerInterface;
 use Drupal\Core\Menu\LocalTaskInterface;
 use Drupal\Core\Menu\LocalTaskManager;
+use Drupal\Core\Routing\RouteMatchInterface;
+use Drupal\Core\Routing\RouteProviderInterface;
+use Drupal\Core\Session\AccountInterface;
 use Drupal\Tests\UnitTestCase;
 use Prophecy\Argument;
 use Symfony\Component\HttpFoundation\ParameterBag;
@@ -99,15 +109,15 @@ class LocalTaskManagerTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $this->controllerResolver = $this->getMock('Drupal\Core\Controller\ControllerResolverInterface');
+    $this->controllerResolver = $this->getMock(ControllerResolverInterface::class);
     $this->request = new Request();
-    $this->routeProvider = $this->getMock('Drupal\Core\Routing\RouteProviderInterface');
-    $this->pluginDiscovery = $this->getMock('Drupal\Component\Plugin\Discovery\DiscoveryInterface');
-    $this->factory = $this->getMock('Drupal\Component\Plugin\Factory\FactoryInterface');
-    $this->cacheBackend = $this->getMock('Drupal\Core\Cache\CacheBackendInterface');
-    $this->accessManager = $this->getMock('Drupal\Core\Access\AccessManagerInterface');
-    $this->routeMatch = $this->getMock('Drupal\Core\Routing\RouteMatchInterface');
-    $this->account = $this->getMock('Drupal\Core\Session\AccountInterface');
+    $this->routeProvider = $this->getMock(RouteProviderInterface::class);
+    $this->pluginDiscovery = $this->getMock(DiscoveryInterface::class);
+    $this->factory = $this->getMock(FactoryInterface::class);
+    $this->cacheBackend = $this->getMock(CacheBackendInterface::class);
+    $this->accessManager = $this->getMock(AccessManagerInterface::class);
+    $this->routeMatch = $this->getMock(RouteMatchInterface::class);
+    $this->account = $this->getMock(AccountInterface::class);
 
     $this->setupLocalTaskManager();
     $this->setupNullCacheabilityMetadataValidation();
@@ -125,7 +135,7 @@ public function testGetLocalTasksForRouteSingleLevelTitle() {
       ->method('getDefinitions')
       ->will($this->returnValue($definitions));
 
-    $mock_plugin = $this->getMock('Drupal\Core\Menu\LocalTaskInterface');
+    $mock_plugin = $this->getMock(LocalTaskInterface::class);
 
     $this->setupFactory($mock_plugin);
     $this->setupLocalTaskManager();
@@ -149,7 +159,7 @@ public function testGetLocalTasksForRouteForChild() {
       ->method('getDefinitions')
       ->will($this->returnValue($definitions));
 
-    $mock_plugin = $this->getMock('Drupal\Core\Menu\LocalTaskInterface');
+    $mock_plugin = $this->getMock(LocalTaskInterface::class);
 
     $this->setupFactory($mock_plugin);
     $this->setupLocalTaskManager();
@@ -171,7 +181,7 @@ public function testGetLocalTaskForRouteWithEmptyCache() {
       ->method('getDefinitions')
       ->will($this->returnValue($definitions));
 
-    $mock_plugin = $this->getMock('Drupal\Core\Menu\LocalTaskInterface');
+    $mock_plugin = $this->getMock(LocalTaskInterface::class);
     $this->setupFactory($mock_plugin);
 
     $this->setupLocalTaskManager();
@@ -207,7 +217,7 @@ public function testGetLocalTaskForRouteWithFilledCache() {
     $this->pluginDiscovery->expects($this->never())
       ->method('getDefinitions');
 
-    $mock_plugin = $this->getMock('Drupal\Core\Menu\LocalTaskInterface');
+    $mock_plugin = $this->getMock(LocalTaskInterface::class);
     $this->setupFactory($mock_plugin);
 
     $this->setupLocalTaskManager();
@@ -233,7 +243,7 @@ public function testGetLocalTaskForRouteWithFilledCache() {
    * @see \Drupal\system\Plugin\Type\MenuLocalTaskManager::getTitle()
    */
   public function testGetTitle() {
-    $menu_local_task = $this->getMock('Drupal\Core\Menu\LocalTaskInterface');
+    $menu_local_task = $this->getMock(LocalTaskInterface::class);
     $menu_local_task->expects($this->once())
       ->method('getTitle');
 
@@ -251,11 +261,11 @@ public function testGetTitle() {
   protected function setupLocalTaskManager() {
     $request_stack = new RequestStack();
     $request_stack->push($this->request);
-    $module_handler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface');
+    $module_handler = $this->getMock(ModuleHandlerInterface::class);
     $module_handler->expects($this->any())
       ->method('getModuleDirectories')
       ->willReturn([]);
-    $language_manager = $this->getMock('Drupal\Core\Language\LanguageManagerInterface');
+    $language_manager = $this->getMock(LanguageManagerInterface::class);
     $language_manager->expects($this->any())
       ->method('getCurrentLanguage')
       ->will($this->returnValue(new Language(['id' => 'en'])));
diff --git a/core/tests/Drupal/Tests/Core/Menu/MenuActiveTrailTest.php b/core/tests/Drupal/Tests/Core/Menu/MenuActiveTrailTest.php
index c763938..cd82fe9 100644
--- a/core/tests/Drupal/Tests/Core/Menu/MenuActiveTrailTest.php
+++ b/core/tests/Drupal/Tests/Core/Menu/MenuActiveTrailTest.php
@@ -2,7 +2,11 @@
 
 namespace Drupal\Tests\Core\Menu;
 
+use Drupal\Core\Cache\CacheBackendInterface;
+use Drupal\Core\Cache\CacheTagsInvalidatorInterface;
+use Drupal\Core\Lock\LockBackendInterface;
 use Drupal\Core\Menu\MenuActiveTrail;
+use Drupal\Core\Menu\MenuLinkManagerInterface;
 use Drupal\Core\Routing\CurrentRouteMatch;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Cmf\Component\Routing\RouteObjectInterface;
@@ -71,14 +75,14 @@ protected function setUp() {
 
     $this->requestStack = new RequestStack();
     $this->currentRouteMatch = new CurrentRouteMatch($this->requestStack);
-    $this->menuLinkManager = $this->getMock('Drupal\Core\Menu\MenuLinkManagerInterface');
-    $this->cache = $this->getMock('\Drupal\Core\Cache\CacheBackendInterface');
-    $this->lock = $this->getMock('\Drupal\Core\Lock\LockBackendInterface');
+    $this->menuLinkManager = $this->getMock(MenuLinkManagerInterface::class);
+    $this->cache = $this->getMock(CacheBackendInterface::class);
+    $this->lock = $this->getMock(LockBackendInterface::class);
 
     $this->menuActiveTrail = new MenuActiveTrail($this->menuLinkManager, $this->currentRouteMatch, $this->cache, $this->lock);
 
     $container = new Container();
-    $container->set('cache_tags.invalidator', $this->getMock('\Drupal\Core\Cache\CacheTagsInvalidatorInterface'));
+    $container->set('cache_tags.invalidator', $this->getMock(CacheTagsInvalidatorInterface::class));
     \Drupal::setContainer($container);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Menu/StaticMenuLinkOverridesTest.php b/core/tests/Drupal/Tests/Core/Menu/StaticMenuLinkOverridesTest.php
index 98a122c..176bdba 100644
--- a/core/tests/Drupal/Tests/Core/Menu/StaticMenuLinkOverridesTest.php
+++ b/core/tests/Drupal/Tests/Core/Menu/StaticMenuLinkOverridesTest.php
@@ -2,6 +2,8 @@
 
 namespace Drupal\Tests\Core\Menu;
 
+use Drupal\Core\Config\Config;
+use Drupal\Core\Config\ConfigFactoryInterface;
 use Drupal\Core\Menu\StaticMenuLinkOverrides;
 use Drupal\Tests\UnitTestCase;
 
@@ -29,7 +31,7 @@ public function testConstruct() {
    * @covers ::reload
    */
   public function testReload() {
-    $config_factory = $this->getMock('Drupal\Core\Config\ConfigFactoryInterface');
+    $config_factory = $this->getMock(ConfigFactoryInterface::class);
     $config_factory->expects($this->at(0))
       ->method('reset')
       ->with('core.menu.static_menu_link_overrides');
@@ -97,7 +99,7 @@ public function testLoadMultipleOverrides() {
    * @covers ::getConfig
    */
   public function testSaveOverride() {
-    $config = $this->getMockBuilder('Drupal\Core\Config\Config')
+    $config = $this->getMockBuilder(Config::class)
       ->disableOriginalConstructor()
       ->getMock();
     $config->expects($this->at(0))
@@ -141,7 +143,7 @@ public function testSaveOverride() {
     $config->expects($this->at(7))
       ->method('save');
 
-    $config_factory = $this->getMock('Drupal\Core\Config\ConfigFactoryInterface');
+    $config_factory = $this->getMock(ConfigFactoryInterface::class);
     $config_factory->expects($this->once())
       ->method('getEditable')
       ->will($this->returnValue($config));
@@ -165,7 +167,7 @@ public function testSaveOverride() {
    * @dataProvider providerTestDeleteOverrides
    */
   public function testDeleteOverrides($ids, array $old_definitions, array $new_definitions) {
-    $config = $this->getMockBuilder('Drupal\Core\Config\Config')
+    $config = $this->getMockBuilder(Config::class)
       ->disableOriginalConstructor()
       ->getMock();
     $config->expects($this->at(0))
@@ -183,7 +185,7 @@ public function testDeleteOverrides($ids, array $old_definitions, array $new_def
         ->method('save');
     }
 
-    $config_factory = $this->getMock('Drupal\Core\Config\ConfigFactoryInterface');
+    $config_factory = $this->getMock(ConfigFactoryInterface::class);
     $config_factory->expects($this->once())
       ->method('getEditable')
       ->will($this->returnValue($config));
diff --git a/core/tests/Drupal/Tests/Core/PageCache/ChainRequestPolicyTest.php b/core/tests/Drupal/Tests/Core/PageCache/ChainRequestPolicyTest.php
index 67e99de..cf144c9 100644
--- a/core/tests/Drupal/Tests/Core/PageCache/ChainRequestPolicyTest.php
+++ b/core/tests/Drupal/Tests/Core/PageCache/ChainRequestPolicyTest.php
@@ -48,7 +48,7 @@ public function testEmptyChain() {
    * @covers ::check
    */
   public function testNullRuleChain() {
-    $rule = $this->getMock('Drupal\Core\PageCache\RequestPolicyInterface');
+    $rule = $this->getMock(RequestPolicyInterface::class);
     $rule->expects($this->once())
       ->method('check')
       ->with($this->request)
@@ -67,7 +67,7 @@ public function testNullRuleChain() {
    * @covers ::check
    */
   public function testChainExceptionOnInvalidReturnValue($return_value) {
-    $rule = $this->getMock('Drupal\Core\PageCache\RequestPolicyInterface');
+    $rule = $this->getMock(RequestPolicyInterface::class);
     $rule->expects($this->once())
       ->method('check')
       ->with($this->request)
@@ -104,7 +104,7 @@ public function providerChainExceptionOnInvalidReturnValue() {
    */
   public function testAllowIfAnyRuleReturnedAllow($return_values) {
     foreach ($return_values as $return_value) {
-      $rule = $this->getMock('Drupal\Core\PageCache\RequestPolicyInterface');
+      $rule = $this->getMock(RequestPolicyInterface::class);
       $rule->expects($this->once())
         ->method('check')
         ->with($this->request)
@@ -134,21 +134,21 @@ public function providerAllowIfAnyRuleReturnedAllow() {
    * Asserts that check() returns immediately when a rule returned DENY.
    */
   public function testStopChainOnFirstDeny() {
-    $rule1 = $this->getMock('Drupal\Core\PageCache\RequestPolicyInterface');
+    $rule1 = $this->getMock(RequestPolicyInterface::class);
     $rule1->expects($this->once())
       ->method('check')
       ->with($this->request)
       ->will($this->returnValue(RequestPolicyInterface::ALLOW));
     $this->policy->addPolicy($rule1);
 
-    $deny_rule = $this->getMock('Drupal\Core\PageCache\RequestPolicyInterface');
+    $deny_rule = $this->getMock(RequestPolicyInterface::class);
     $deny_rule->expects($this->once())
       ->method('check')
       ->with($this->request)
       ->will($this->returnValue(RequestPolicyInterface::DENY));
     $this->policy->addPolicy($deny_rule);
 
-    $ignored_rule = $this->getMock('Drupal\Core\PageCache\RequestPolicyInterface');
+    $ignored_rule = $this->getMock(RequestPolicyInterface::class);
     $ignored_rule->expects($this->never())
       ->method('check');
     $this->policy->addPolicy($ignored_rule);
diff --git a/core/tests/Drupal/Tests/Core/PageCache/ChainResponsePolicyTest.php b/core/tests/Drupal/Tests/Core/PageCache/ChainResponsePolicyTest.php
index 8de3a5c..3f94fc2 100644
--- a/core/tests/Drupal/Tests/Core/PageCache/ChainResponsePolicyTest.php
+++ b/core/tests/Drupal/Tests/Core/PageCache/ChainResponsePolicyTest.php
@@ -57,7 +57,7 @@ public function testEmptyChain() {
    * @covers ::check
    */
   public function testNullRuleChain() {
-    $rule = $this->getMock('Drupal\Core\PageCache\ResponsePolicyInterface');
+    $rule = $this->getMock(ResponsePolicyInterface::class);
     $rule->expects($this->once())
       ->method('check')
       ->with($this->response, $this->request)
@@ -76,7 +76,7 @@ public function testNullRuleChain() {
    * @covers ::check
    */
   public function testChainExceptionOnInvalidReturnValue($return_value) {
-    $rule = $this->getMock('Drupal\Core\PageCache\ResponsePolicyInterface');
+    $rule = $this->getMock(ResponsePolicyInterface::class);
     $rule->expects($this->once())
       ->method('check')
       ->with($this->response, $this->request)
@@ -109,20 +109,20 @@ public function providerChainExceptionOnInvalidReturnValue() {
    * Asserts that check() returns immediately when a rule returned DENY.
    */
   public function testStopChainOnFirstDeny() {
-    $rule1 = $this->getMock('Drupal\Core\PageCache\ResponsePolicyInterface');
+    $rule1 = $this->getMock(ResponsePolicyInterface::class);
     $rule1->expects($this->once())
       ->method('check')
       ->with($this->response, $this->request);
     $this->policy->addPolicy($rule1);
 
-    $deny_rule = $this->getMock('Drupal\Core\PageCache\ResponsePolicyInterface');
+    $deny_rule = $this->getMock(ResponsePolicyInterface::class);
     $deny_rule->expects($this->once())
       ->method('check')
       ->with($this->response, $this->request)
       ->will($this->returnValue(ResponsePolicyInterface::DENY));
     $this->policy->addPolicy($deny_rule);
 
-    $ignored_rule = $this->getMock('Drupal\Core\PageCache\ResponsePolicyInterface');
+    $ignored_rule = $this->getMock(ResponsePolicyInterface::class);
     $ignored_rule->expects($this->never())
       ->method('check');
     $this->policy->addPolicy($ignored_rule);
diff --git a/core/tests/Drupal/Tests/Core/PageCache/CommandLineOrUnsafeMethodTest.php b/core/tests/Drupal/Tests/Core/PageCache/CommandLineOrUnsafeMethodTest.php
index 46f78c6..6b8c22f 100644
--- a/core/tests/Drupal/Tests/Core/PageCache/CommandLineOrUnsafeMethodTest.php
+++ b/core/tests/Drupal/Tests/Core/PageCache/CommandLineOrUnsafeMethodTest.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\Tests\Core\PageCache;
 
+use Drupal\Core\PageCache\RequestPolicy\CommandLineOrUnsafeMethod;
 use Drupal\Core\PageCache\RequestPolicyInterface;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\HttpFoundation\Request;
@@ -22,7 +23,7 @@ class CommandLineOrUnsafeMethodTest extends UnitTestCase {
   protected function setUp() {
     // Note that it is necessary to partially mock the class under test in
     // order to disable the isCli-check.
-    $this->policy = $this->getMock('Drupal\Core\PageCache\RequestPolicy\CommandLineOrUnsafeMethod', ['isCli']);
+    $this->policy = $this->getMock(CommandLineOrUnsafeMethod::class, ['isCli']);
   }
 
   /**
diff --git a/core/tests/Drupal/Tests/Core/PageCache/NoSessionOpenTest.php b/core/tests/Drupal/Tests/Core/PageCache/NoSessionOpenTest.php
index f4ae1c9..161f981 100644
--- a/core/tests/Drupal/Tests/Core/PageCache/NoSessionOpenTest.php
+++ b/core/tests/Drupal/Tests/Core/PageCache/NoSessionOpenTest.php
@@ -4,6 +4,7 @@
 
 use Drupal\Core\PageCache\RequestPolicy\NoSessionOpen;
 use Drupal\Core\PageCache\RequestPolicyInterface;
+use Drupal\Core\Session\SessionConfigurationInterface;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\HttpFoundation\Request;
 
@@ -28,7 +29,7 @@ class NoSessionOpenTest extends UnitTestCase {
   protected $policy;
 
   protected function setUp() {
-    $this->sessionConfiguration = $this->getMock('Drupal\Core\Session\SessionConfigurationInterface');
+    $this->sessionConfiguration = $this->getMock(SessionConfigurationInterface::class);
     $this->policy = new NoSessionOpen($this->sessionConfiguration);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/ParamConverter/EntityConverterTest.php b/core/tests/Drupal/Tests/Core/ParamConverter/EntityConverterTest.php
index 67decbe..571f93d 100644
--- a/core/tests/Drupal/Tests/Core/ParamConverter/EntityConverterTest.php
+++ b/core/tests/Drupal/Tests/Core/ParamConverter/EntityConverterTest.php
@@ -3,6 +3,8 @@
 namespace Drupal\Tests\Core\ParamConverter;
 
 use Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException;
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Entity\EntityStorageInterface;
 use Drupal\Core\ParamConverter\EntityConverter;
 use Drupal\Core\ParamConverter\ParamNotConvertedException;
 use Drupal\Tests\UnitTestCase;
@@ -35,7 +37,7 @@ class EntityConverterTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $this->entityManager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
+    $this->entityManager = $this->getMock(EntityManagerInterface::class);
 
     $this->entityConverter = new EntityConverter($this->entityManager);
   }
@@ -79,7 +81,7 @@ public function providerTestApplies() {
    * @covers ::convert
    */
   public function testConvert($value, array $definition, array $defaults, $expected_result) {
-    $entity_storage = $this->getMock('Drupal\Core\Entity\EntityStorageInterface');
+    $entity_storage = $this->getMock(EntityStorageInterface::class);
     $this->entityManager->expects($this->once())
       ->method('getStorage')
       ->with('entity_test')
diff --git a/core/tests/Drupal/Tests/Core/ParamConverter/ParamConverterManagerTest.php b/core/tests/Drupal/Tests/Core/ParamConverter/ParamConverterManagerTest.php
index 6d60e1d..f44d0b0 100644
--- a/core/tests/Drupal/Tests/Core/ParamConverter/ParamConverterManagerTest.php
+++ b/core/tests/Drupal/Tests/Core/ParamConverter/ParamConverterManagerTest.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\Tests\Core\ParamConverter;
 
+use Drupal\Core\ParamConverter\ParamConverterInterface;
 use Drupal\Core\ParamConverter\ParamConverterManager;
 use Drupal\Core\ParamConverter\ParamNotConvertedException;
 use Drupal\Tests\UnitTestCase;
@@ -37,7 +38,7 @@ protected function setUp() {
    * @covers ::getConverter
    */
   public function testGetConverter($name, $class) {
-    $converter = $this->getMockBuilder('Drupal\Core\ParamConverter\ParamConverterInterface')
+    $converter = $this->getMockBuilder(ParamConverterInterface::class)
       ->setMockClassName($class)
       ->getMock();
 
@@ -128,7 +129,7 @@ public function providerTestGetConverter() {
    * @dataProvider providerTestSetRouteParameterConverters
    */
   public function testSetRouteParameterConverters($path, $parameters = NULL, $expected = NULL) {
-    $converter = $this->getMock('Drupal\Core\ParamConverter\ParamConverterInterface');
+    $converter = $this->getMock(ParamConverterInterface::class);
     $converter->expects($this->any())
       ->method('applies')
       ->with($this->anything(), 'id', $this->anything())
@@ -190,7 +191,7 @@ public function testConvert() {
     $expected = $defaults;
     $expected['id'] = 'something_better!';
 
-    $converter = $this->getMock('Drupal\Core\ParamConverter\ParamConverterInterface');
+    $converter = $this->getMock(ParamConverterInterface::class);
     $converter->expects($this->any())
       ->method('convert')
       ->with(1, $this->isType('array'), 'id', $this->isType('array'))
@@ -236,7 +237,7 @@ public function testConvertMissingParam() {
       'id' => 1,
     ];
 
-    $converter = $this->getMock('Drupal\Core\ParamConverter\ParamConverterInterface');
+    $converter = $this->getMock(ParamConverterInterface::class);
     $converter->expects($this->any())
       ->method('convert')
       ->with(1, $this->isType('array'), 'id', $this->isType('array'))
diff --git a/core/tests/Drupal/Tests/Core/Path/AliasManagerTest.php b/core/tests/Drupal/Tests/Core/Path/AliasManagerTest.php
index ffd52dc..bf8016e 100644
--- a/core/tests/Drupal/Tests/Core/Path/AliasManagerTest.php
+++ b/core/tests/Drupal/Tests/Core/Path/AliasManagerTest.php
@@ -2,9 +2,13 @@
 
 namespace Drupal\Tests\Core\Path;
 
+use Drupal\Core\Cache\CacheBackendInterface;
 use Drupal\Core\Language\Language;
 use Drupal\Core\Language\LanguageInterface;
+use Drupal\Core\Language\LanguageManagerInterface;
 use Drupal\Core\Path\AliasManager;
+use Drupal\Core\Path\AliasStorageInterface;
+use Drupal\Core\Path\AliasWhitelistInterface;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -68,10 +72,10 @@ class AliasManagerTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $this->aliasStorage = $this->getMock('Drupal\Core\Path\AliasStorageInterface');
-    $this->aliasWhitelist = $this->getMock('Drupal\Core\Path\AliasWhitelistInterface');
-    $this->languageManager = $this->getMock('Drupal\Core\Language\LanguageManagerInterface');
-    $this->cache = $this->getMock('Drupal\Core\Cache\CacheBackendInterface');
+    $this->aliasStorage = $this->getMock(AliasStorageInterface::class);
+    $this->aliasWhitelist = $this->getMock(AliasWhitelistInterface::class);
+    $this->languageManager = $this->getMock(LanguageManagerInterface::class);
+    $this->cache = $this->getMock(CacheBackendInterface::class);
 
     $this->aliasManager = new AliasManager($this->aliasStorage, $this->aliasWhitelist, $this->languageManager, $this->cache);
 
diff --git a/core/tests/Drupal/Tests/Core/Path/PathMatcherTest.php b/core/tests/Drupal/Tests/Core/Path/PathMatcherTest.php
index 7089121..7bbf20a 100644
--- a/core/tests/Drupal/Tests/Core/Path/PathMatcherTest.php
+++ b/core/tests/Drupal/Tests/Core/Path/PathMatcherTest.php
@@ -3,6 +3,7 @@
 namespace Drupal\Tests\Core\Path;
 
 use Drupal\Core\Path\PathMatcher;
+use Drupal\Core\Routing\RouteMatchInterface;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -31,7 +32,7 @@ protected function setUp() {
         ],
       ]
     );
-    $route_match = $this->getMock('Drupal\Core\Routing\RouteMatchInterface');
+    $route_match = $this->getMock(RouteMatchInterface::class);
     $this->pathMatcher = new PathMatcher($config_factory_stub, $route_match);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Path/PathValidatorTest.php b/core/tests/Drupal/Tests/Core/Path/PathValidatorTest.php
index 2bfb1c9..f54124b 100644
--- a/core/tests/Drupal/Tests/Core/Path/PathValidatorTest.php
+++ b/core/tests/Drupal/Tests/Core/Path/PathValidatorTest.php
@@ -4,12 +4,16 @@
 
 use Drupal\Core\ParamConverter\ParamNotConvertedException;
 use Drupal\Core\Path\PathValidator;
+use Drupal\Core\PathProcessor\InboundPathProcessorInterface;
+use Drupal\Core\Routing\AccessAwareRouterInterface;
+use Drupal\Core\Session\AccountInterface;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Cmf\Component\Routing\RouteObjectInterface;
 use Symfony\Component\HttpFoundation\ParameterBag;
 use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
 use Symfony\Component\Routing\Exception\MethodNotAllowedException;
 use Symfony\Component\Routing\Exception\ResourceNotFoundException;
+use Symfony\Component\Routing\Matcher\UrlMatcherInterface;
 
 /**
  * @coversDefaultClass \Drupal\Core\Path\PathValidator
@@ -57,10 +61,10 @@ class PathValidatorTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $this->accessAwareRouter = $this->getMock('Drupal\Core\Routing\AccessAwareRouterInterface');
-    $this->accessUnawareRouter = $this->getMock('Symfony\Component\Routing\Matcher\UrlMatcherInterface');
-    $this->account = $this->getMock('Drupal\Core\Session\AccountInterface');
-    $this->pathProcessor = $this->getMock('Drupal\Core\PathProcessor\InboundPathProcessorInterface');
+    $this->accessAwareRouter = $this->getMock(AccessAwareRouterInterface::class);
+    $this->accessUnawareRouter = $this->getMock(UrlMatcherInterface::class);
+    $this->account = $this->getMock(AccountInterface::class);
+    $this->pathProcessor = $this->getMock(InboundPathProcessorInterface::class);
     $this->pathValidator = new PathValidator($this->accessAwareRouter, $this->accessUnawareRouter, $this->account, $this->pathProcessor);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorAliasTest.php b/core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorAliasTest.php
index 0473d79..a4318a8 100644
--- a/core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorAliasTest.php
+++ b/core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorAliasTest.php
@@ -3,6 +3,7 @@
 namespace Drupal\Tests\Core\PathProcessor;
 
 use Drupal\Core\Cache\Cache;
+use Drupal\Core\Path\AliasManagerInterface;
 use Drupal\Core\PathProcessor\PathProcessorAlias;
 use Drupal\Core\Render\BubbleableMetadata;
 use Drupal\Tests\UnitTestCase;
@@ -29,7 +30,7 @@ class PathProcessorAliasTest extends UnitTestCase {
   protected $pathProcessor;
 
   protected function setUp() {
-    $this->aliasManager = $this->getMock('Drupal\Core\Path\AliasManagerInterface');
+    $this->aliasManager = $this->getMock(AliasManagerInterface::class);
     $this->pathProcessor = new PathProcessorAlias($this->aliasManager);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorTest.php b/core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorTest.php
index 57dfbfa..2231644 100644
--- a/core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorTest.php
+++ b/core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorTest.php
@@ -4,10 +4,15 @@
 
 use Drupal\Core\Language\Language;
 use Drupal\Core\Language\LanguageInterface;
+use Drupal\Core\Path\AliasManager;
 use Drupal\Core\PathProcessor\PathProcessorAlias;
 use Drupal\Core\PathProcessor\PathProcessorDecode;
 use Drupal\Core\PathProcessor\PathProcessorFront;
 use Drupal\Core\PathProcessor\PathProcessorManager;
+use Drupal\Core\Session\AccountInterface;
+use Drupal\language\ConfigurableLanguageManagerInterface;
+use Drupal\language\EventSubscriber\ConfigSubscriber;
+use Drupal\language\LanguageNegotiatorInterface;
 use Drupal\language\HttpKernel\PathProcessorLanguage;
 use Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUrl;
 use Symfony\Component\HttpFoundation\Request;
@@ -65,7 +70,7 @@ protected function setUp() {
     $method_instance = new LanguageNegotiationUrl($config);
 
     // Create a language manager stub.
-    $language_manager = $this->getMockBuilder('Drupal\language\ConfigurableLanguageManagerInterface')
+    $language_manager = $this->getMockBuilder(ConfigurableLanguageManagerInterface::class)
       ->getMock();
     $language_manager->expects($this->any())
       ->method('getCurrentLanguage')
@@ -93,7 +98,7 @@ protected function setUp() {
   public function testProcessInbound() {
 
     // Create an alias manager stub.
-    $alias_manager = $this->getMockBuilder('Drupal\Core\Path\AliasManager')
+    $alias_manager = $this->getMockBuilder(AliasManager::class)
       ->disableOriginalConstructor()
       ->getMock();
 
@@ -127,7 +132,7 @@ public function testProcessInbound() {
     );
 
     // Create a language negotiator stub.
-    $negotiator = $this->getMockBuilder('Drupal\language\LanguageNegotiatorInterface')
+    $negotiator = $this->getMockBuilder(LanguageNegotiatorInterface::class)
       ->getMock();
     $negotiator->expects($this->any())
       ->method('getNegotiationMethods')
@@ -143,11 +148,11 @@ public function testProcessInbound() {
       ->will($this->returnValue($method));
 
     // Create a user stub.
-    $current_user = $this->getMockBuilder('Drupal\Core\Session\AccountInterface')
+    $current_user = $this->getMockBuilder(AccountInterface::class)
       ->getMock();
 
     // Create a config event subscriber stub.
-    $config_subscriber = $this->getMockBuilder('Drupal\language\EventSubscriber\ConfigSubscriber')
+    $config_subscriber = $this->getMockBuilder(ConfigSubscriber::class)
       ->disableOriginalConstructor()
       ->getMock();
 
diff --git a/core/tests/Drupal/Tests/Core/Plugin/CategorizingPluginManagerTraitTest.php b/core/tests/Drupal/Tests/Core/Plugin/CategorizingPluginManagerTraitTest.php
index db67ad7..9f57a5ec 100644
--- a/core/tests/Drupal/Tests/Core/Plugin/CategorizingPluginManagerTraitTest.php
+++ b/core/tests/Drupal/Tests/Core/Plugin/CategorizingPluginManagerTraitTest.php
@@ -30,7 +30,7 @@ class CategorizingPluginManagerTraitTest extends UnitTestCase {
    * {@inheritdoc}
    */
   protected function setUp() {
-    $module_handler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface');
+    $module_handler = $this->getMock(ModuleHandlerInterface::class);
     $module_handler->expects($this->any())
       ->method('getModuleList')
       ->willReturn(['node' => []]);
diff --git a/core/tests/Drupal/Tests/Core/Plugin/Context/ContextDefinitionTest.php b/core/tests/Drupal/Tests/Core/Plugin/Context/ContextDefinitionTest.php
index 6eda2e3..79253c0 100644
--- a/core/tests/Drupal/Tests/Core/Plugin/Context/ContextDefinitionTest.php
+++ b/core/tests/Drupal/Tests/Core/Plugin/Context/ContextDefinitionTest.php
@@ -3,6 +3,7 @@
 namespace Drupal\Tests\Core\Plugin\Context;
 
 use Drupal\Core\Plugin\Context\ContextDefinition;
+use Drupal\Core\TypedData\ListDataDefinitionInterface;
 use Drupal\Core\TypedData\TypedDataManagerInterface;
 use Drupal\Tests\UnitTestCase;
 
@@ -32,7 +33,7 @@ public function providerGetDataDefinition() {
    */
   public function testGetDataDefinition($is_multiple) {
     $data_type = 'valid';
-    $mock_data_definition = $this->getMockBuilder('\Drupal\Core\TypedData\ListDataDefinitionInterface')
+    $mock_data_definition = $this->getMockBuilder(ListDataDefinitionInterface::class)
       ->setMethods([
         'setLabel',
         'setDescription',
@@ -74,7 +75,7 @@ public function testGetDataDefinition($is_multiple) {
 
     // Mock a ContextDefinition object, setting up expectations for many of the
     // methods.
-    $mock_context_definition = $this->getMockBuilder('Drupal\Core\Plugin\Context\ContextDefinition')
+    $mock_context_definition = $this->getMockBuilder(ContextDefinition::class)
       ->disableOriginalConstructor()
       ->setMethods([
         'isMultiple',
@@ -116,7 +117,7 @@ public function testGetDataDefinitionInvalidType($is_multiple) {
     // Since we're trying to make getDataDefinition() throw an exception in
     // isolation, we use a data type which is not valid.
     $data_type = 'not_valid';
-    $mock_data_definition = $this->getMockBuilder('\Drupal\Core\TypedData\ListDataDefinitionInterface')
+    $mock_data_definition = $this->getMockBuilder(ListDataDefinitionInterface::class)
       ->getMockForAbstractClass();
 
     // Follow code paths for both multiple and non-multiple definitions.
@@ -136,7 +137,7 @@ public function testGetDataDefinitionInvalidType($is_multiple) {
 
     // Mock a ContextDefinition object with expectations for only the methods
     // that will be called before the expected exception.
-    $mock_context_definition = $this->getMockBuilder('Drupal\Core\Plugin\Context\ContextDefinition')
+    $mock_context_definition = $this->getMockBuilder(ContextDefinition::class)
       ->disableOriginalConstructor()
       ->setMethods([
         'isMultiple',
@@ -180,7 +181,7 @@ public function providerGetConstraint() {
    * @uses \Drupal
    */
   public function testGetConstraint($expected, $constraint_array, $constraint) {
-    $mock_context_definition = $this->getMockBuilder('Drupal\Core\Plugin\Context\ContextDefinition')
+    $mock_context_definition = $this->getMockBuilder(ContextDefinition::class)
       ->disableOriginalConstructor()
       ->setMethods([
         'getConstraints',
diff --git a/core/tests/Drupal/Tests/Core/Plugin/Context/ContextTest.php b/core/tests/Drupal/Tests/Core/Plugin/Context/ContextTest.php
index e9b5964..476f6c9 100644
--- a/core/tests/Drupal/Tests/Core/Plugin/Context/ContextTest.php
+++ b/core/tests/Drupal/Tests/Core/Plugin/Context/ContextTest.php
@@ -8,9 +8,13 @@
 namespace Drupal\Tests\Core\Plugin\Context;
 
 use Drupal\Core\Cache\CacheableDependencyInterface;
+use Drupal\Core\Cache\CacheContextsManager;
 use Drupal\Core\Plugin\Context\Context;
+use Drupal\Core\Plugin\Context\ContextDefinitionInterface;
+use Drupal\Core\TypedData\DataDefinitionInterface;
 use Drupal\Core\TypedData\TypedDataInterface;
 use Drupal\Core\TypedData\TypedDataManagerInterface;
+use Drupal\Tests\Core\Plugin\Context\TypedDataCacheableDependencyInterface;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\DependencyInjection\Container;
 
@@ -88,11 +92,11 @@ public function testNullDataValue() {
    */
   public function testSetContextValueTypedData() {
 
-    $this->contextDefinition = $this->getMockBuilder('Drupal\Core\Plugin\Context\ContextDefinitionInterface')
+    $this->contextDefinition = $this->getMockBuilder(ContextDefinitionInterface::class)
       ->setMethods(['getDefaultValue', 'getDataDefinition'])
       ->getMockForAbstractClass();
 
-    $typed_data = $this->getMock('Drupal\Core\TypedData\TypedDataInterface');
+    $typed_data = $this->getMock(TypedDataInterface::class);
     $context = new Context($this->contextDefinition, $typed_data);
     $this->assertSame($typed_data, $context->getContextData());
   }
@@ -102,7 +106,7 @@ public function testSetContextValueTypedData() {
    */
   public function testSetContextValueCacheableDependency() {
     $container = new Container();
-    $cache_context_manager = $this->getMockBuilder('Drupal\Core\Cache\CacheContextsManager')
+    $cache_context_manager = $this->getMockBuilder(CacheContextsManager::class)
       ->disableOriginalConstructor()
       ->getMock();
     $container->set('cache_contexts_manager', $cache_context_manager);
@@ -112,11 +116,11 @@ public function testSetContextValueCacheableDependency() {
       ->willReturn(['route']);
     \Drupal::setContainer($container);
 
-    $this->contextDefinition = $this->getMock('Drupal\Core\Plugin\Context\ContextDefinitionInterface');
+    $this->contextDefinition = $this->getMock(ContextDefinitionInterface::class);
 
     $context = new Context($this->contextDefinition);
     $context->setTypedDataManager($this->typedDataManager);
-    $cacheable_dependency = $this->getMock('Drupal\Tests\Core\Plugin\Context\TypedDataCacheableDependencyInterface');
+    $cacheable_dependency = $this->getMock(TypedDataCacheableDependencyInterface::class);
     $cacheable_dependency->expects($this->once())
       ->method('getCacheTags')
       ->willReturn(['node:1']);
@@ -141,9 +145,9 @@ public function testSetContextValueCacheableDependency() {
    *   The default value to assign to the mock context definition.
    */
   protected function setUpDefaultValue($default_value = NULL) {
-    $mock_data_definition = $this->getMock('Drupal\Core\TypedData\DataDefinitionInterface');
+    $mock_data_definition = $this->getMock(DataDefinitionInterface::class);
 
-    $this->contextDefinition = $this->getMockBuilder('Drupal\Core\Plugin\Context\ContextDefinitionInterface')
+    $this->contextDefinition = $this->getMockBuilder(ContextDefinitionInterface::class)
       ->setMethods(['getDefaultValue', 'getDataDefinition'])
       ->getMockForAbstractClass();
 
@@ -155,7 +159,7 @@ protected function setUpDefaultValue($default_value = NULL) {
       ->method('getDataDefinition')
       ->willReturn($mock_data_definition);
 
-    $this->typedData = $this->getMock('Drupal\Core\TypedData\TypedDataInterface');
+    $this->typedData = $this->getMock(TypedDataInterface::class);
 
     $this->typedDataManager->expects($this->once())
       ->method('create')
diff --git a/core/tests/Drupal/Tests/Core/Plugin/Context/LazyContextRepositoryTest.php b/core/tests/Drupal/Tests/Core/Plugin/Context/LazyContextRepositoryTest.php
index 6fe21c1..48298b7 100644
--- a/core/tests/Drupal/Tests/Core/Plugin/Context/LazyContextRepositoryTest.php
+++ b/core/tests/Drupal/Tests/Core/Plugin/Context/LazyContextRepositoryTest.php
@@ -4,6 +4,7 @@
 
 use Drupal\Core\Plugin\Context\Context;
 use Drupal\Core\Plugin\Context\ContextDefinition;
+use Drupal\Core\Plugin\Context\ContextProviderInterface;
 use Drupal\Core\Plugin\Context\LazyContextRepository;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -80,7 +81,7 @@ public function testGetRuntimeStaticCache() {
     $context0 = new Context(new ContextDefinition('example'));
     $context1 = new Context(new ContextDefinition('example'));
 
-    $context_provider = $this->prophesize('\Drupal\Core\Plugin\Context\ContextProviderInterface');
+    $context_provider = $this->prophesize(ContextProviderInterface::class);
     $context_provider->getRuntimeContexts(['test_context0', 'test_context1'])
       ->shouldBeCalledTimes(1)
       ->willReturn(['test_context0' => $context0, 'test_context1' => $context1]);
@@ -132,7 +133,7 @@ protected function setupContextAndProvider($service_id, array $unqualified_conte
 
     $expected_unqualified_context_ids = $expected_unqualified_context_ids ?: $unqualified_context_ids;
 
-    $context_provider = $this->prophesize('\Drupal\Core\Plugin\Context\ContextProviderInterface');
+    $context_provider = $this->prophesize(ContextProviderInterface::class);
     $context_provider->getRuntimeContexts($expected_unqualified_context_ids)
       ->willReturn(array_combine($unqualified_context_ids, $contexts));
     $context_provider->getAvailableContexts()
diff --git a/core/tests/Drupal/Tests/Core/Plugin/ContextHandlerTest.php b/core/tests/Drupal/Tests/Core/Plugin/ContextHandlerTest.php
index 4ed5e6e..026bd13 100644
--- a/core/tests/Drupal/Tests/Core/Plugin/ContextHandlerTest.php
+++ b/core/tests/Drupal/Tests/Core/Plugin/ContextHandlerTest.php
@@ -10,10 +10,13 @@
 use Drupal\Component\Plugin\ConfigurablePluginInterface;
 use Drupal\Component\Plugin\Exception\ContextException;
 use Drupal\Core\Plugin\Context\ContextDefinition;
+use Drupal\Core\Plugin\Context\ContextDefinitionInterface;
 use Drupal\Core\Plugin\Context\ContextHandler;
+use Drupal\Core\Plugin\Context\ContextInterface;
 use Drupal\Core\Plugin\ContextAwarePluginInterface;
 use Drupal\Core\TypedData\DataDefinition;
 use Drupal\Core\TypedData\Plugin\DataType\StringData;
+use Drupal\Tests\Core\Plugin\TestConfigurableContextAwarePluginInterface;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -57,7 +60,7 @@ public function providerTestCheckRequirements() {
     $requirement_any = new ContextDefinition();
     $requirement_any->setRequired(TRUE);
 
-    $context_any = $this->getMock('Drupal\Core\Plugin\Context\ContextInterface');
+    $context_any = $this->getMock(ContextInterface::class);
     $context_any->expects($this->atLeastOnce())
       ->method('getContextDefinition')
       ->will($this->returnValue(new ContextDefinition('empty')));
@@ -65,18 +68,18 @@ public function providerTestCheckRequirements() {
     $requirement_specific = new ContextDefinition('specific');
     $requirement_specific->setConstraints(['bar' => 'baz']);
 
-    $context_constraint_mismatch = $this->getMock('Drupal\Core\Plugin\Context\ContextInterface');
+    $context_constraint_mismatch = $this->getMock(ContextInterface::class);
     $context_constraint_mismatch->expects($this->atLeastOnce())
       ->method('getContextDefinition')
       ->will($this->returnValue(new ContextDefinition('foo')));
-    $context_datatype_mismatch = $this->getMock('Drupal\Core\Plugin\Context\ContextInterface');
+    $context_datatype_mismatch = $this->getMock(ContextInterface::class);
     $context_datatype_mismatch->expects($this->atLeastOnce())
       ->method('getContextDefinition')
       ->will($this->returnValue(new ContextDefinition('fuzzy')));
 
     $context_definition_specific = new ContextDefinition('specific');
     $context_definition_specific->setConstraints(['bar' => 'baz']);
-    $context_specific = $this->getMock('Drupal\Core\Plugin\Context\ContextInterface');
+    $context_specific = $this->getMock(ContextInterface::class);
     $context_specific->expects($this->atLeastOnce())
       ->method('getContextDefinition')
       ->will($this->returnValue($context_definition_specific));
@@ -115,21 +118,21 @@ public function providerTestGetMatchingContexts() {
     $requirement_specific = new ContextDefinition('specific');
     $requirement_specific->setConstraints(['bar' => 'baz']);
 
-    $context_any = $this->getMock('Drupal\Core\Plugin\Context\ContextInterface');
+    $context_any = $this->getMock(ContextInterface::class);
     $context_any->expects($this->atLeastOnce())
       ->method('getContextDefinition')
       ->will($this->returnValue(new ContextDefinition('empty')));
-    $context_constraint_mismatch = $this->getMock('Drupal\Core\Plugin\Context\ContextInterface');
+    $context_constraint_mismatch = $this->getMock(ContextInterface::class);
     $context_constraint_mismatch->expects($this->atLeastOnce())
       ->method('getContextDefinition')
       ->will($this->returnValue(new ContextDefinition('foo')));
-    $context_datatype_mismatch = $this->getMock('Drupal\Core\Plugin\Context\ContextInterface');
+    $context_datatype_mismatch = $this->getMock(ContextInterface::class);
     $context_datatype_mismatch->expects($this->atLeastOnce())
       ->method('getContextDefinition')
       ->will($this->returnValue(new ContextDefinition('fuzzy')));
     $context_definition_specific = new ContextDefinition('specific');
     $context_definition_specific->setConstraints(['bar' => 'baz']);
-    $context_specific = $this->getMock('Drupal\Core\Plugin\Context\ContextInterface');
+    $context_specific = $this->getMock(ContextInterface::class);
     $context_specific->expects($this->atLeastOnce())
       ->method('getContextDefinition')
       ->will($this->returnValue($context_definition_specific));
@@ -157,7 +160,7 @@ public function providerTestGetMatchingContexts() {
    */
   public function testFilterPluginDefinitionsByContexts($has_context, $definitions, $expected) {
     if ($has_context) {
-      $context = $this->getMock('Drupal\Core\Plugin\Context\ContextInterface');
+      $context = $this->getMock(ContextInterface::class);
       $expected_context_definition = (new ContextDefinition('expected_data_type'))->setConstraints(['expected_constraint_name' => 'expected_constraint_value']);
       $context->expects($this->atLeastOnce())
         ->method('getContextDefinition')
@@ -234,7 +237,7 @@ public function providerTestFilterPluginDefinitionsByContexts() {
   public function testApplyContextMapping() {
     $context_hit_data = StringData::createInstance(DataDefinition::create('string'));
     $context_hit_data->setValue('foo');
-    $context_hit = $this->getMock('Drupal\Core\Plugin\Context\ContextInterface');
+    $context_hit = $this->getMock(ContextInterface::class);
     $context_hit->expects($this->atLeastOnce())
       ->method('getContextData')
       ->will($this->returnValue($context_hit_data));
@@ -243,7 +246,7 @@ public function testApplyContextMapping() {
     $context_hit->expects($this->atLeastOnce())
       ->method('hasContextValue')
       ->willReturn(TRUE);
-    $context_miss = $this->getMock('Drupal\Core\Plugin\Context\ContextInterface');
+    $context_miss = $this->getMock(ContextInterface::class);
     $context_miss->expects($this->never())
       ->method('getContextData');
 
@@ -252,9 +255,9 @@ public function testApplyContextMapping() {
       'miss' => $context_miss,
     ];
 
-    $context_definition = $this->getMock('Drupal\Core\Plugin\Context\ContextDefinitionInterface');
+    $context_definition = $this->getMock(ContextDefinitionInterface::class);
 
-    $plugin = $this->getMock('Drupal\Core\Plugin\ContextAwarePluginInterface');
+    $plugin = $this->getMock(ContextAwarePluginInterface::class);
     $plugin->expects($this->once())
       ->method('getContextMapping')
       ->willReturn([]);
@@ -266,7 +269,7 @@ public function testApplyContextMapping() {
       ->with('hit', $context_hit_data);
 
     // Make sure that the cacheability metadata is passed to the plugin context.
-    $plugin_context = $this->getMock('Drupal\Core\Plugin\Context\ContextInterface');
+    $plugin_context = $this->getMock(ContextInterface::class);
     $plugin_context->expects($this->once())
       ->method('addCacheableDependency')
       ->with($context_hit);
@@ -282,7 +285,7 @@ public function testApplyContextMapping() {
    * @covers ::applyContextMapping
    */
   public function testApplyContextMappingMissingRequired() {
-    $context = $this->getMock('Drupal\Core\Plugin\Context\ContextInterface');
+    $context = $this->getMock(ContextInterface::class);
     $context->expects($this->never())
       ->method('getContextValue');
 
@@ -290,12 +293,12 @@ public function testApplyContextMappingMissingRequired() {
       'name' => $context,
     ];
 
-    $context_definition = $this->getMock('Drupal\Core\Plugin\Context\ContextDefinitionInterface');
+    $context_definition = $this->getMock(ContextDefinitionInterface::class);
     $context_definition->expects($this->atLeastOnce())
       ->method('isRequired')
       ->willReturn(TRUE);
 
-    $plugin = $this->getMock('Drupal\Tests\Core\Plugin\TestConfigurableContextAwarePluginInterface');
+    $plugin = $this->getMock(TestConfigurableContextAwarePluginInterface::class);
     $plugin->expects($this->once())
       ->method('getContextMapping')
       ->willReturn([]);
@@ -317,7 +320,7 @@ public function testApplyContextMappingMissingRequired() {
    * @covers ::applyContextMapping
    */
   public function testApplyContextMappingMissingNotRequired() {
-    $context = $this->getMock('Drupal\Core\Plugin\Context\ContextInterface');
+    $context = $this->getMock(ContextInterface::class);
     $context->expects($this->never())
       ->method('getContextValue');
 
@@ -325,12 +328,12 @@ public function testApplyContextMappingMissingNotRequired() {
       'name' => $context,
     ];
 
-    $context_definition = $this->getMock('Drupal\Core\Plugin\Context\ContextDefinitionInterface');
+    $context_definition = $this->getMock(ContextDefinitionInterface::class);
     $context_definition->expects($this->atLeastOnce())
       ->method('isRequired')
       ->willReturn(FALSE);
 
-    $plugin = $this->getMock('Drupal\Tests\Core\Plugin\TestConfigurableContextAwarePluginInterface');
+    $plugin = $this->getMock(TestConfigurableContextAwarePluginInterface::class);
     $plugin->expects($this->once())
       ->method('getContextMapping')
       ->willReturn(['optional' => 'missing']);
@@ -351,7 +354,7 @@ public function testApplyContextMappingMissingNotRequired() {
    * @covers ::applyContextMapping
    */
   public function testApplyContextMappingNoValueRequired() {
-    $context = $this->getMock('Drupal\Core\Plugin\Context\ContextInterface');
+    $context = $this->getMock(ContextInterface::class);
     $context->expects($this->never())
       ->method('getContextValue');
     $context->expects($this->atLeastOnce())
@@ -362,12 +365,12 @@ public function testApplyContextMappingNoValueRequired() {
       'hit' => $context,
     ];
 
-    $context_definition = $this->getMock('Drupal\Core\Plugin\Context\ContextDefinitionInterface');
+    $context_definition = $this->getMock(ContextDefinitionInterface::class);
     $context_definition->expects($this->atLeastOnce())
       ->method('isRequired')
       ->willReturn(TRUE);
 
-    $plugin = $this->getMock('Drupal\Tests\Core\Plugin\TestConfigurableContextAwarePluginInterface');
+    $plugin = $this->getMock(TestConfigurableContextAwarePluginInterface::class);
     $plugin->expects($this->once())
       ->method('getContextMapping')
       ->willReturn([]);
@@ -386,7 +389,7 @@ public function testApplyContextMappingNoValueRequired() {
    * @covers ::applyContextMapping
    */
   public function testApplyContextMappingNoValueNonRequired() {
-    $context = $this->getMock('Drupal\Core\Plugin\Context\ContextInterface');
+    $context = $this->getMock(ContextInterface::class);
     $context->expects($this->never())
       ->method('getContextValue');
     $context->expects($this->atLeastOnce())
@@ -397,12 +400,12 @@ public function testApplyContextMappingNoValueNonRequired() {
       'hit' => $context,
     ];
 
-    $context_definition = $this->getMock('Drupal\Core\Plugin\Context\ContextDefinitionInterface');
+    $context_definition = $this->getMock(ContextDefinitionInterface::class);
     $context_definition->expects($this->atLeastOnce())
       ->method('isRequired')
       ->willReturn(FALSE);
 
-    $plugin = $this->getMock('Drupal\Tests\Core\Plugin\TestConfigurableContextAwarePluginInterface');
+    $plugin = $this->getMock(TestConfigurableContextAwarePluginInterface::class);
     $plugin->expects($this->once())
       ->method('getContextMapping')
       ->willReturn([]);
@@ -421,7 +424,7 @@ public function testApplyContextMappingNoValueNonRequired() {
   public function testApplyContextMappingConfigurableAssigned() {
     $context_data = StringData::createInstance(DataDefinition::create('string'));
     $context_data->setValue('foo');
-    $context = $this->getMock('Drupal\Core\Plugin\Context\ContextInterface');
+    $context = $this->getMock(ContextInterface::class);
     $context->expects($this->atLeastOnce())
       ->method('getContextData')
       ->will($this->returnValue($context_data));
@@ -433,9 +436,9 @@ public function testApplyContextMappingConfigurableAssigned() {
       'name' => $context,
     ];
 
-    $context_definition = $this->getMock('Drupal\Core\Plugin\Context\ContextDefinitionInterface');
+    $context_definition = $this->getMock(ContextDefinitionInterface::class);
 
-    $plugin = $this->getMock('Drupal\Tests\Core\Plugin\TestConfigurableContextAwarePluginInterface');
+    $plugin = $this->getMock(TestConfigurableContextAwarePluginInterface::class);
     $plugin->expects($this->once())
       ->method('getContextMapping')
       ->willReturn([]);
@@ -447,7 +450,7 @@ public function testApplyContextMappingConfigurableAssigned() {
       ->with('hit', $context_data);
 
     // Make sure that the cacheability metadata is passed to the plugin context.
-    $plugin_context = $this->getMock('Drupal\Core\Plugin\Context\ContextInterface');
+    $plugin_context = $this->getMock(ContextInterface::class);
     $plugin_context->expects($this->once())
       ->method('addCacheableDependency')
       ->with($context);
@@ -463,7 +466,7 @@ public function testApplyContextMappingConfigurableAssigned() {
    * @covers ::applyContextMapping
    */
   public function testApplyContextMappingConfigurableAssignedMiss() {
-    $context = $this->getMock('Drupal\Core\Plugin\Context\ContextInterface');
+    $context = $this->getMock(ContextInterface::class);
     $context->expects($this->never())
       ->method('getContextValue');
 
@@ -471,9 +474,9 @@ public function testApplyContextMappingConfigurableAssignedMiss() {
       'name' => $context,
     ];
 
-    $context_definition = $this->getMock('Drupal\Core\Plugin\Context\ContextDefinitionInterface');
+    $context_definition = $this->getMock(ContextDefinitionInterface::class);
 
-    $plugin = $this->getMock('Drupal\Tests\Core\Plugin\TestConfigurableContextAwarePluginInterface');
+    $plugin = $this->getMock(TestConfigurableContextAwarePluginInterface::class);
     $plugin->expects($this->once())
       ->method('getContextMapping')
       ->willReturn([]);
diff --git a/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php b/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php
index c65de35..e1449c8 100644
--- a/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php
+++ b/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php
@@ -4,9 +4,14 @@
 
 use Drupal\Component\Plugin\Definition\PluginDefinition;
 use Drupal\Component\Plugin\Exception\PluginException;
+use Drupal\Core\Cache\CacheBackendInterface;
+use Drupal\Core\Cache\CacheTagsInvalidatorInterface;
+use Drupal\Core\Cache\MemoryBackend;
+use Drupal\Core\Extension\ModuleHandler;
 use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Plugin\PluginFormInterface;
+use Drupal\Tests\Core\Plugin\TestPluginForm;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -75,7 +80,7 @@ public function testDefaultPluginManagerWithPluginExtendingNonInstalledClass() {
       'provider' => 'plugin_test',
     ];
 
-    $module_handler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface');
+    $module_handler = $this->getMock(ModuleHandlerInterface::class);
     $plugin_manager = new TestPluginManager($this->namespaces, $definitions, $module_handler, 'test_alter_hook', '\Drupal\plugin_test\Plugin\plugin_test\fruit\FruitInterface');
     $plugin_manager->getDefinition('plugin_test', FALSE);
     $this->assertTrue(TRUE, 'No PHP fatal error occurred when retrieving the definitions of a module with plugins that depend on a non-installed module class should not cause a PHP fatal.');
@@ -94,7 +99,7 @@ public function testDefaultPluginManagerWithDisabledModule() {
       'provider' => 'disabled_module',
     ];
 
-    $module_handler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface');
+    $module_handler = $this->getMock(ModuleHandlerInterface::class);
 
     $module_handler->expects($this->once())
       ->method('moduleExists')
@@ -119,7 +124,7 @@ public function testDefaultPluginManagerWithObjects() {
       'provider' => 'disabled_module',
     ];
 
-    $module_handler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface');
+    $module_handler = $this->getMock(ModuleHandlerInterface::class);
 
     $module_handler->expects($this->once())
       ->method('moduleExists')
@@ -144,7 +149,7 @@ public function testDefaultPluginManager() {
    * Tests the plugin manager with no cache and altering.
    */
   public function testDefaultPluginManagerWithAlter() {
-    $module_handler = $this->getMockBuilder('Drupal\Core\Extension\ModuleHandler')
+    $module_handler = $this->getMockBuilder(ModuleHandler::class)
       ->disableOriginalConstructor()
       ->getMock();
 
@@ -165,7 +170,7 @@ public function testDefaultPluginManagerWithAlter() {
    */
   public function testDefaultPluginManagerWithEmptyCache() {
     $cid = $this->randomMachineName();
-    $cache_backend = $this->getMockBuilder('Drupal\Core\Cache\MemoryBackend')
+    $cache_backend = $this->getMockBuilder(MemoryBackend::class)
       ->disableOriginalConstructor()
       ->getMock();
     $cache_backend
@@ -190,7 +195,7 @@ public function testDefaultPluginManagerWithEmptyCache() {
    */
   public function testDefaultPluginManagerWithFilledCache() {
     $cid = $this->randomMachineName();
-    $cache_backend = $this->getMockBuilder('Drupal\Core\Cache\MemoryBackend')
+    $cache_backend = $this->getMockBuilder(MemoryBackend::class)
       ->disableOriginalConstructor()
       ->getMock();
     $cache_backend
@@ -215,7 +220,7 @@ public function testDefaultPluginManagerNoCache() {
     $plugin_manager = new TestPluginManager($this->namespaces, $this->expectedDefinitions, NULL, NULL, '\Drupal\plugin_test\Plugin\plugin_test\fruit\FruitInterface');
 
     $cid = $this->randomMachineName();
-    $cache_backend = $this->getMockBuilder('Drupal\Core\Cache\MemoryBackend')
+    $cache_backend = $this->getMockBuilder(MemoryBackend::class)
       ->disableOriginalConstructor()
       ->getMock();
     $cache_backend
@@ -237,8 +242,8 @@ public function testDefaultPluginManagerNoCache() {
    */
   public function testCacheClearWithTags() {
     $cid = $this->randomMachineName();
-    $cache_backend = $this->getMock('Drupal\Core\Cache\CacheBackendInterface');
-    $cache_tags_invalidator = $this->getMock('Drupal\Core\Cache\CacheTagsInvalidatorInterface');
+    $cache_backend = $this->getMock(CacheBackendInterface::class);
+    $cache_tags_invalidator = $this->getMock(CacheTagsInvalidatorInterface::class);
     $cache_tags_invalidator
       ->expects($this->once())
       ->method('invalidateTags')
@@ -274,7 +279,7 @@ public function testCreateInstanceWithJustValidInterfaces() {
    * @covers ::createInstance
    */
   public function testCreateInstanceWithInvalidInterfaces() {
-    $module_handler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface');
+    $module_handler = $this->getMock(ModuleHandlerInterface::class);
 
     $module_handler->expects($this->any())
       ->method('moduleExists')
@@ -302,7 +307,7 @@ public function testCreateInstanceWithInvalidInterfaces() {
    * @covers ::getDefinitions
    */
   public function testGetDefinitionsWithoutRequiredInterface() {
-    $module_handler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface');
+    $module_handler = $this->getMock(ModuleHandlerInterface::class);
 
     $module_handler->expects($this->any())
       ->method('moduleExists')
@@ -446,8 +451,8 @@ public function providerTestProcessDefinition() {
       'foo' => ['bar' => ['baz']],
     ];
 
-    $data['object_with_class_with_slashes'][] = (new PluginDefinition())->setClass('\Drupal\Tests\Core\Plugin\TestPluginForm');
-    $data['object_with_class_with_slashes'][] = (new PluginDefinition())->setClass('Drupal\Tests\Core\Plugin\TestPluginForm');
+    $data['object_with_class_with_slashes'][] = (new PluginDefinition())->setClass(TestPluginForm::class);
+    $data['object_with_class_with_slashes'][] = (new PluginDefinition())->setClass(TestPluginForm::class);
     return $data;
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Plugin/Discovery/ContainerDerivativeDiscoveryDecoratorTest.php b/core/tests/Drupal/Tests/Core/Plugin/Discovery/ContainerDerivativeDiscoveryDecoratorTest.php
index 508fdc6..4bb1977 100644
--- a/core/tests/Drupal/Tests/Core/Plugin/Discovery/ContainerDerivativeDiscoveryDecoratorTest.php
+++ b/core/tests/Drupal/Tests/Core/Plugin/Discovery/ContainerDerivativeDiscoveryDecoratorTest.php
@@ -2,8 +2,11 @@
 
 namespace Drupal\Tests\Core\Plugin\Discovery;
 
+use Drupal\Component\Plugin\Discovery\DiscoveryInterface;
 use Drupal\Core\Plugin\Discovery\ContainerDerivativeDiscoveryDecorator;
 use Drupal\Tests\UnitTestCase;
+use Symfony\Component\DependencyInjection\ContainerBuilder;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 
 /**
  * @coversDefaultClass \Drupal\Core\Plugin\Discovery\ContainerDerivativeDiscoveryDecorator
@@ -15,8 +18,8 @@ class ContainerDerivativeDiscoveryDecoratorTest extends UnitTestCase {
    * @covers ::getDefinitions
    */
   public function testGetDefinitions() {
-    $example_service = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
-    $example_container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')
+    $example_service = $this->getMock(EventDispatcherInterface::class);
+    $example_container = $this->getMockBuilder(ContainerBuilder::class)
       ->setMethods(['get'])
       ->getMock();
     $example_container->expects($this->once())
@@ -36,7 +39,7 @@ public function testGetDefinitions() {
       'deriver' => '\Drupal\Tests\Core\Plugin\Discovery\TestDerivativeDiscovery',
     ];
 
-    $discovery_main = $this->getMock('Drupal\Component\Plugin\Discovery\DiscoveryInterface');
+    $discovery_main = $this->getMock(DiscoveryInterface::class);
     $discovery_main->expects($this->any())
       ->method('getDefinitions')
       ->will($this->returnValue($definitions));
diff --git a/core/tests/Drupal/Tests/Core/Plugin/Discovery/DerivativeDiscoveryDecoratorTest.php b/core/tests/Drupal/Tests/Core/Plugin/Discovery/DerivativeDiscoveryDecoratorTest.php
index e4ea645..bcaa2ab 100644
--- a/core/tests/Drupal/Tests/Core/Plugin/Discovery/DerivativeDiscoveryDecoratorTest.php
+++ b/core/tests/Drupal/Tests/Core/Plugin/Discovery/DerivativeDiscoveryDecoratorTest.php
@@ -4,6 +4,7 @@
 
 use Drupal\Component\Plugin\Definition\DerivablePluginDefinitionInterface;
 use Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator;
+use Drupal\Component\Plugin\Discovery\DiscoveryInterface;
 use Drupal\Component\Plugin\Exception\InvalidDeriverException;
 use Drupal\Tests\UnitTestCase;
 
@@ -27,7 +28,7 @@ class DerivativeDiscoveryDecoratorTest extends UnitTestCase {
    * {@inheritdoc}
    */
   protected function setUp() {
-    $this->discoveryMain = $discovery_main = $this->getMock('Drupal\Component\Plugin\Discovery\DiscoveryInterface');
+    $this->discoveryMain = $discovery_main = $this->getMock(DiscoveryInterface::class);
   }
 
   /**
diff --git a/core/tests/Drupal/Tests/Core/Plugin/Discovery/HookDiscoveryTest.php b/core/tests/Drupal/Tests/Core/Plugin/Discovery/HookDiscoveryTest.php
index 9f4eb95..dd86d5d 100644
--- a/core/tests/Drupal/Tests/Core/Plugin/Discovery/HookDiscoveryTest.php
+++ b/core/tests/Drupal/Tests/Core/Plugin/Discovery/HookDiscoveryTest.php
@@ -3,6 +3,7 @@
 namespace Drupal\Tests\Core\Plugin\Discovery;
 
 use Drupal\Component\Plugin\Exception\PluginNotFoundException;
+use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Plugin\Discovery\HookDiscovery;
 use Drupal\Tests\UnitTestCase;
 
@@ -30,7 +31,7 @@ class HookDiscoveryTest extends UnitTestCase {
    * {@inheritdoc}
    */
   protected function setUp() {
-    $this->moduleHandler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface');
+    $this->moduleHandler = $this->getMock(ModuleHandlerInterface::class);
     $this->hookDiscovery = new HookDiscovery($this->moduleHandler, 'test_plugin');
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Plugin/Discovery/YamlDiscoveryDecoratorTest.php b/core/tests/Drupal/Tests/Core/Plugin/Discovery/YamlDiscoveryDecoratorTest.php
index ea19368..a46717b 100644
--- a/core/tests/Drupal/Tests/Core/Plugin/Discovery/YamlDiscoveryDecoratorTest.php
+++ b/core/tests/Drupal/Tests/Core/Plugin/Discovery/YamlDiscoveryDecoratorTest.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\Tests\Core\Plugin\Discovery;
 
+use Drupal\Component\Plugin\Discovery\DiscoveryInterface;
 use Drupal\Tests\UnitTestCase;
 use Drupal\Core\Plugin\Discovery\YamlDiscoveryDecorator;
 
@@ -56,7 +57,7 @@ protected function setUp() {
       ],
     ];
 
-    $decorated = $this->getMock('Drupal\Component\Plugin\Discovery\DiscoveryInterface');
+    $decorated = $this->getMock(DiscoveryInterface::class);
     $decorated->expects($this->once())
       ->method('getDefinitions')
       ->will($this->returnValue($definitions));
diff --git a/core/tests/Drupal/Tests/Core/PrivateKeyTest.php b/core/tests/Drupal/Tests/Core/PrivateKeyTest.php
index fd72dac..c784e14 100644
--- a/core/tests/Drupal/Tests/Core/PrivateKeyTest.php
+++ b/core/tests/Drupal/Tests/Core/PrivateKeyTest.php
@@ -3,6 +3,7 @@
 namespace Drupal\Tests\Core;
 
 use Drupal\Core\PrivateKey;
+use Drupal\Core\State\StateInterface;
 use Drupal\Tests\UnitTestCase;
 use Drupal\Component\Utility\Crypt;
 
@@ -41,7 +42,7 @@ protected function setUp() {
     parent::setUp();
     $this->key = Crypt::randomBytesBase64(55);
 
-    $this->state = $this->getMock('Drupal\Core\State\StateInterface');
+    $this->state = $this->getMock(StateInterface::class);
 
     $this->privateKey = new PrivateKey($this->state);
   }
diff --git a/core/tests/Drupal/Tests/Core/Render/BubbleableMetadataTest.php b/core/tests/Drupal/Tests/Core/Render/BubbleableMetadataTest.php
index 7188a51..18b19dc 100644
--- a/core/tests/Drupal/Tests/Core/Render/BubbleableMetadataTest.php
+++ b/core/tests/Drupal/Tests/Core/Render/BubbleableMetadataTest.php
@@ -4,7 +4,9 @@
 
 use Drupal\Core\Cache\Cache;
 use Drupal\Core\Cache\CacheableMetadata;
+use Drupal\Core\Cache\Context\CacheContextsManager;
 use Drupal\Core\Render\BubbleableMetadata;
+use Drupal\Core\Render\Renderer;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\DependencyInjection\ContainerBuilder;
 
@@ -36,7 +38,7 @@ public function testMerge(BubbleableMetadata $a, CacheableMetadata $b, Bubbleabl
     // BubbleableMetadata object, that BubbleableMetadata::merge() doesn't
     // attempt to merge assets.
     if (!$b instanceof BubbleableMetadata) {
-      $renderer = $this->getMockBuilder('Drupal\Core\Render\Renderer')
+      $renderer = $this->getMockBuilder(Renderer::class)
         ->disableOriginalConstructor()
         ->getMock();
       $renderer->expects($this->never())
@@ -44,13 +46,13 @@ public function testMerge(BubbleableMetadata $a, CacheableMetadata $b, Bubbleabl
     }
     // Otherwise, let the original ::mergeAttachments() method be executed.
     else {
-      $renderer = $this->getMockBuilder('Drupal\Core\Render\Renderer')
+      $renderer = $this->getMockBuilder(Renderer::class)
         ->disableOriginalConstructor()
         ->setMethods(NULL)
         ->getMock();
     }
 
-    $cache_contexts_manager = $this->getMockBuilder('Drupal\Core\Cache\Context\CacheContextsManager')
+    $cache_contexts_manager = $this->getMockBuilder(CacheContextsManager::class)
       ->disableOriginalConstructor()
       ->getMock();
     $cache_contexts_manager->method('assertValidTokens')->willReturn(TRUE);
@@ -655,7 +657,7 @@ public function providerTestMergeAttachmentsHttpHeaderMerging() {
    * @see \Drupal\Tests\Core\Cache\CacheContextsTest
    */
   public function testAddCacheableDependency(BubbleableMetadata $a, $b, BubbleableMetadata $expected) {
-    $cache_contexts_manager = $this->getMockBuilder('Drupal\Core\Cache\Context\CacheContextsManager')
+    $cache_contexts_manager = $this->getMockBuilder(CacheContextsManager::class)
       ->disableOriginalConstructor()
       ->getMock();
     $cache_contexts_manager->method('assertValidTokens')->willReturn(TRUE);
diff --git a/core/tests/Drupal/Tests/Core/Render/Element/RenderElementTest.php b/core/tests/Drupal/Tests/Core/Render/Element/RenderElementTest.php
index 3b52f9a..14d1dea 100644
--- a/core/tests/Drupal/Tests/Core/Render/Element/RenderElementTest.php
+++ b/core/tests/Drupal/Tests/Core/Render/Element/RenderElementTest.php
@@ -6,6 +6,7 @@
 use Drupal\Core\Form\FormBuilderInterface;
 use Drupal\Core\GeneratedUrl;
 use Drupal\Core\Render\Element\RenderElement;
+use Drupal\Core\Routing\UrlGeneratorInterface;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpFoundation\RequestStack;
@@ -50,7 +51,7 @@ public function testPreRenderAjaxForm() {
     $request->query->set('foo', 'bar');
     $this->requestStack->push($request);
 
-    $prophecy = $this->prophesize('Drupal\Core\Routing\UrlGeneratorInterface');
+    $prophecy = $this->prophesize(UrlGeneratorInterface::class);
     $url = '/test?foo=bar&ajax_form=1';
     $prophecy->generateFromRoute('<current>', [], ['query' => ['foo' => 'bar', FormBuilderInterface::AJAX_FORM_REQUEST => TRUE]], TRUE)
       ->willReturn((new GeneratedUrl())->setCacheContexts(['route'])->setGeneratedUrl($url));
@@ -81,7 +82,7 @@ public function testPreRenderAjaxFormWithQueryOptions() {
     $request->query->set('foo', 'bar');
     $this->requestStack->push($request);
 
-    $prophecy = $this->prophesize('Drupal\Core\Routing\UrlGeneratorInterface');
+    $prophecy = $this->prophesize(UrlGeneratorInterface::class);
     $url = '/test?foo=bar&other=query&ajax_form=1';
     $prophecy->generateFromRoute('<current>', [], ['query' => ['foo' => 'bar', 'other' => 'query', FormBuilderInterface::AJAX_FORM_REQUEST => TRUE]], TRUE)
       ->willReturn((new GeneratedUrl())->setCacheContexts(['route'])->setGeneratedUrl($url));
diff --git a/core/tests/Drupal/Tests/Core/Render/ElementInfoManagerTest.php b/core/tests/Drupal/Tests/Core/Render/ElementInfoManagerTest.php
index c305830..35fb746 100644
--- a/core/tests/Drupal/Tests/Core/Render/ElementInfoManagerTest.php
+++ b/core/tests/Drupal/Tests/Core/Render/ElementInfoManagerTest.php
@@ -7,8 +7,12 @@
 
 namespace Drupal\Tests\Core\Render;
 
+use Drupal\Core\Cache\CacheBackendInterface;
+use Drupal\Core\Cache\CacheTagsInvalidatorInterface;
+use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Render\ElementInfoManager;
 use Drupal\Core\Theme\ActiveTheme;
+use Drupal\Core\Theme\ThemeManagerInterface;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -60,10 +64,10 @@ class ElementInfoManagerTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $this->cache = $this->getMock('Drupal\Core\Cache\CacheBackendInterface');
-    $this->cacheTagsInvalidator = $this->getMock('Drupal\Core\Cache\CacheTagsInvalidatorInterface');
-    $this->moduleHandler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface');
-    $this->themeManager = $this->getMock('Drupal\Core\Theme\ThemeManagerInterface');
+    $this->cache = $this->getMock(CacheBackendInterface::class);
+    $this->cacheTagsInvalidator = $this->getMock(CacheTagsInvalidatorInterface::class);
+    $this->moduleHandler = $this->getMock(ModuleHandlerInterface::class);
+    $this->themeManager = $this->getMock(ThemeManagerInterface::class);
 
     $this->elementInfo = new ElementInfoManager(new \ArrayObject(), $this->cache, $this->cacheTagsInvalidator, $this->moduleHandler, $this->themeManager);
   }
@@ -89,7 +93,7 @@ public function testGetInfoElementPlugin($plugin_class, $expected_info) {
         '#theme' => 'page',
       ]);
 
-    $element_info = $this->getMockBuilder('Drupal\Core\Render\ElementInfoManager')
+    $element_info = $this->getMockBuilder(ElementInfoManager::class)
       ->setConstructorArgs([new \ArrayObject(), $this->cache, $this->cacheTagsInvalidator, $this->moduleHandler, $this->themeManager])
       ->setMethods(['getDefinitions', 'createInstance'])
       ->getMock();
diff --git a/core/tests/Drupal/Tests/Core/Render/MetadataBubblingUrlGeneratorTest.php b/core/tests/Drupal/Tests/Core/Render/MetadataBubblingUrlGeneratorTest.php
index 9524b0d9..d95bb92 100644
--- a/core/tests/Drupal/Tests/Core/Render/MetadataBubblingUrlGeneratorTest.php
+++ b/core/tests/Drupal/Tests/Core/Render/MetadataBubblingUrlGeneratorTest.php
@@ -3,6 +3,7 @@
 namespace Drupal\Tests\Core\Render;
 
 use Drupal\Core\Render\MetadataBubblingUrlGenerator;
+use Drupal\Core\Render\RendererInterface;
 use Drupal\Core\Url;
 use Drupal\Tests\Core\Routing\UrlGeneratorTest;
 
@@ -28,7 +29,7 @@ class MetadataBubblingUrlGeneratorTest extends UrlGeneratorTest {
   protected function setUp() {
     parent::setUp();
 
-    $this->renderer = $this->getMock('\Drupal\Core\Render\RendererInterface');
+    $this->renderer = $this->getMock(RendererInterface::class);
     $this->renderer->expects($this->any())
       ->method('hasRenderContext')
       ->willReturn(TRUE);
diff --git a/core/tests/Drupal/Tests/Core/Render/Placeholder/ChainedPlaceholderStrategyTest.php b/core/tests/Drupal/Tests/Core/Render/Placeholder/ChainedPlaceholderStrategyTest.php
index 776b794..1d4af78 100644
--- a/core/tests/Drupal/Tests/Core/Render/Placeholder/ChainedPlaceholderStrategyTest.php
+++ b/core/tests/Drupal/Tests/Core/Render/Placeholder/ChainedPlaceholderStrategyTest.php
@@ -3,6 +3,7 @@
 namespace Drupal\Tests\Core\Render\Placeholder;
 
 use Drupal\Core\Render\Placeholder\ChainedPlaceholderStrategy;
+use Drupal\Core\Render\Placeholder\PlaceholderStrategyInterface;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -43,7 +44,7 @@ public function providerProcessPlaceholders() {
       'remove-me' => ['#markup' => 'I-am-a-llama-that-will-be-removed-sad-face.'],
     ];
 
-    $prophecy = $this->prophesize('\Drupal\Core\Render\Placeholder\PlaceholderStrategyInterface');
+    $prophecy = $this->prophesize(PlaceholderStrategyInterface::class);
     $prophecy->processPlaceholders($placeholders)->willReturn([]);
     $dev_null_strategy = $prophecy->reveal();
 
@@ -54,7 +55,7 @@ public function providerProcessPlaceholders() {
       '67890' => ['#markup' => 'special-placeholder'],
     ];
 
-    $prophecy = $this->prophesize('\Drupal\Core\Render\Placeholder\PlaceholderStrategyInterface');
+    $prophecy = $this->prophesize(PlaceholderStrategyInterface::class);
     $prophecy->processPlaceholders($placeholders)->willReturn($placeholders);
     $single_flush_strategy = $prophecy->reveal();
 
@@ -68,18 +69,18 @@ public function providerProcessPlaceholders() {
       '12345' => ['#markup' => '<esi:include src="/fragment/12345" />'],
     ];
 
-    $prophecy = $this->prophesize('\Drupal\Core\Render\Placeholder\PlaceholderStrategyInterface');
+    $prophecy = $this->prophesize(PlaceholderStrategyInterface::class);
     $prophecy->processPlaceholders($placeholders)->willReturn($result);
     $esi_strategy = $prophecy->reveal();
 
     $data['fake esi strategy'] = [[$esi_strategy], $placeholders, $result];
 
     // ESI + SingleFlush strategy (ESI replaces all).
-    $prophecy = $this->prophesize('\Drupal\Core\Render\Placeholder\PlaceholderStrategyInterface');
+    $prophecy = $this->prophesize(PlaceholderStrategyInterface::class);
     $prophecy->processPlaceholders($placeholders)->willReturn($result);
     $esi_strategy = $prophecy->reveal();
 
-    $prophecy = $this->prophesize('\Drupal\Core\Render\Placeholder\PlaceholderStrategyInterface');
+    $prophecy = $this->prophesize(PlaceholderStrategyInterface::class);
     $prophecy->processPlaceholders($placeholders)->shouldNotBeCalled();
     $prophecy->processPlaceholders($result)->shouldNotBeCalled();
     $prophecy->processPlaceholders([])->shouldNotBeCalled();
@@ -105,11 +106,11 @@ public function providerProcessPlaceholders() {
 
     $result = $esi_result + $normal_result;
 
-    $prophecy = $this->prophesize('\Drupal\Core\Render\Placeholder\PlaceholderStrategyInterface');
+    $prophecy = $this->prophesize(PlaceholderStrategyInterface::class);
     $prophecy->processPlaceholders($placeholders)->willReturn($esi_result);
     $esi_strategy = $prophecy->reveal();
 
-    $prophecy = $this->prophesize('\Drupal\Core\Render\Placeholder\PlaceholderStrategyInterface');
+    $prophecy = $this->prophesize(PlaceholderStrategyInterface::class);
     $prophecy->processPlaceholders($normal_result)->willReturn($normal_result);
     $single_flush_strategy = $prophecy->reveal();
 
@@ -146,7 +147,7 @@ public function testProcessPlaceholdersWithRoguePlaceholderStrategy() {
       'new-placeholder' => ['#markup' => 'rogue llama'],
     ];
 
-    $prophecy = $this->prophesize('\Drupal\Core\Render\Placeholder\PlaceholderStrategyInterface');
+    $prophecy = $this->prophesize(PlaceholderStrategyInterface::class);
     $prophecy->processPlaceholders($placeholders)->willReturn($result);
     $rogue_strategy = $prophecy->reveal();
 
diff --git a/core/tests/Drupal/Tests/Core/RouteProcessor/RouteProcessorManagerTest.php b/core/tests/Drupal/Tests/Core/RouteProcessor/RouteProcessorManagerTest.php
index 1de1745..ecfea62 100644
--- a/core/tests/Drupal/Tests/Core/RouteProcessor/RouteProcessorManagerTest.php
+++ b/core/tests/Drupal/Tests/Core/RouteProcessor/RouteProcessorManagerTest.php
@@ -4,6 +4,7 @@
 
 use Drupal\Core\Cache\Cache;
 use Drupal\Core\Render\BubbleableMetadata;
+use Drupal\Core\RouteProcessor\OutboundRouteProcessorInterface;
 use Drupal\Core\RouteProcessor\RouteProcessorManager;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\Routing\Route;
@@ -63,7 +64,7 @@ public function testRouteProcessorManager() {
    * @return \Drupal\Core\RouteProcessor\OutboundRouteProcessorInterface|\PHPUnit_Framework_MockObject_MockObject
    */
   protected function getMockProcessor($route_name, $route, $parameters) {
-    $processor = $this->getMock('Drupal\Core\RouteProcessor\OutboundRouteProcessorInterface');
+    $processor = $this->getMock(OutboundRouteProcessorInterface::class);
     $processor->expects($this->once())
       ->method('processOutbound')
       ->with($route_name, $route, $parameters);
diff --git a/core/tests/Drupal/Tests/Core/Routing/AccessAwareRouterTest.php b/core/tests/Drupal/Tests/Core/Routing/AccessAwareRouterTest.php
index 53405f1..cd1032b 100644
--- a/core/tests/Drupal/Tests/Core/Routing/AccessAwareRouterTest.php
+++ b/core/tests/Drupal/Tests/Core/Routing/AccessAwareRouterTest.php
@@ -2,14 +2,18 @@
 
 namespace Drupal\Tests\Core\Routing;
 
+use Drupal\Core\Access\AccessManagerInterface;
 use Drupal\Core\Access\AccessResult;
 use Drupal\Core\Routing\AccessAwareRouter;
 use Drupal\Core\Routing\AccessAwareRouterInterface;
+use Drupal\Core\Session\AccountInterface;
 use Drupal\Tests\UnitTestCase;
+use Symfony\Cmf\Component\Routing\ChainRouter;
 use Symfony\Cmf\Component\Routing\RouteObjectInterface;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
 use Symfony\Component\Routing\Route;
+use Symfony\Component\Routing\RouterInterface;
 
 /**
  * @coversDefaultClass \Drupal\Core\Routing\AccessAwareRouter
@@ -48,15 +52,15 @@ class AccessAwareRouterTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
     $this->route = new Route('test');
-    $this->accessManager = $this->getMock('Drupal\Core\Access\AccessManagerInterface');
-    $this->currentUser = $this->getMock('Drupal\Core\Session\AccountInterface');
+    $this->accessManager = $this->getMock(AccessManagerInterface::class);
+    $this->currentUser = $this->getMock(AccountInterface::class);
   }
 
   /**
    * Sets up a chain router with matchRequest.
    */
   protected function setupRouter() {
-    $this->chainRouter = $this->getMockBuilder('Symfony\Cmf\Component\Routing\ChainRouter')
+    $this->chainRouter = $this->getMockBuilder(ChainRouter::class)
       ->disableOriginalConstructor()
       ->getMock();
     $this->chainRouter->expects($this->once())
@@ -122,9 +126,9 @@ public function testCheckAccessResultWithReason() {
    * @covers ::__call
    */
   public function testCall() {
-    $mock_router = $this->getMock('Symfony\Component\Routing\RouterInterface');
+    $mock_router = $this->getMock(RouterInterface::class);
 
-    $this->chainRouter = $this->getMockBuilder('Symfony\Cmf\Component\Routing\ChainRouter')
+    $this->chainRouter = $this->getMockBuilder(ChainRouter::class)
       ->disableOriginalConstructor()
       ->setMethods(['add'])
       ->getMock();
diff --git a/core/tests/Drupal/Tests/Core/Routing/RedirectDestinationTest.php b/core/tests/Drupal/Tests/Core/Routing/RedirectDestinationTest.php
index 2d733c3..1f5ec6b 100644
--- a/core/tests/Drupal/Tests/Core/Routing/RedirectDestinationTest.php
+++ b/core/tests/Drupal/Tests/Core/Routing/RedirectDestinationTest.php
@@ -4,6 +4,7 @@
 
 use Drupal\Component\Utility\UrlHelper;
 use Drupal\Core\Routing\RedirectDestination;
+use Drupal\Core\Routing\UrlGeneratorInterface;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpFoundation\RequestStack;
@@ -42,7 +43,7 @@ protected function setUp() {
     parent::setUp();
 
     $this->requestStack = new RequestStack();
-    $this->urlGenerator = $this->getMock('Drupal\Core\Routing\UrlGeneratorInterface');
+    $this->urlGenerator = $this->getMock(UrlGeneratorInterface::class);
     $this->redirectDestination = new RedirectDestination($this->requestStack, $this->urlGenerator);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Routing/RouteBuilderTest.php b/core/tests/Drupal/Tests/Core/Routing/RouteBuilderTest.php
index d075934..fe197ac 100644
--- a/core/tests/Drupal/Tests/Core/Routing/RouteBuilderTest.php
+++ b/core/tests/Drupal/Tests/Core/Routing/RouteBuilderTest.php
@@ -7,12 +7,18 @@
 
 namespace Drupal\Tests\Core\Routing;
 
+use Drupal\Core\Access\CheckProviderInterface;
+use Drupal\Core\Controller\ControllerResolverInterface;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
 use Drupal\Core\Discovery\YamlDiscovery;
+use Drupal\Core\Extension\ModuleHandlerInterface;
+use Drupal\Core\Lock\LockBackendInterface;
+use Drupal\Core\Routing\MatcherDumperInterface;
 use Drupal\Core\Routing\RouteBuilder;
 use Drupal\Core\Routing\RouteBuildEvent;
 use Drupal\Core\Routing\RoutingEvents;
 use Drupal\Tests\UnitTestCase;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 use Symfony\Component\Routing\Route;
 use Symfony\Component\Routing\RouteCollection;
 
@@ -77,15 +83,15 @@ class RouteBuilderTest extends UnitTestCase {
   protected $checkProvider;
 
   protected function setUp() {
-    $this->dumper = $this->getMock('Drupal\Core\Routing\MatcherDumperInterface');
-    $this->lock = $this->getMock('Drupal\Core\Lock\LockBackendInterface');
-    $this->dispatcher = $this->getMock('\Symfony\Component\EventDispatcher\EventDispatcherInterface');
-    $this->moduleHandler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface');
-    $this->controllerResolver = $this->getMock('Drupal\Core\Controller\ControllerResolverInterface');
-    $this->yamlDiscovery = $this->getMockBuilder('\Drupal\Core\Discovery\YamlDiscovery')
+    $this->dumper = $this->getMock(MatcherDumperInterface::class);
+    $this->lock = $this->getMock(LockBackendInterface::class);
+    $this->dispatcher = $this->getMock(EventDispatcherInterface::class);
+    $this->moduleHandler = $this->getMock(ModuleHandlerInterface::class);
+    $this->controllerResolver = $this->getMock(ControllerResolverInterface::class);
+    $this->yamlDiscovery = $this->getMockBuilder(YamlDiscovery::class)
       ->disableOriginalConstructor()
       ->getMock();
-    $this->checkProvider = $this->getMock('\Drupal\Core\Access\CheckProviderInterface');
+    $this->checkProvider = $this->getMock(CheckProviderInterface::class);
 
     $this->routeBuilder = new TestRouteBuilder($this->dumper, $this->lock, $this->dispatcher, $this->moduleHandler, $this->controllerResolver, $this->checkProvider);
     $this->routeBuilder->setYamlDiscovery($this->yamlDiscovery);
diff --git a/core/tests/Drupal/Tests/Core/Routing/RoutePreloaderTest.php b/core/tests/Drupal/Tests/Core/Routing/RoutePreloaderTest.php
index 90b4a9d..387e636 100644
--- a/core/tests/Drupal/Tests/Core/Routing/RoutePreloaderTest.php
+++ b/core/tests/Drupal/Tests/Core/Routing/RoutePreloaderTest.php
@@ -2,10 +2,15 @@
 
 namespace Drupal\Tests\Core\Routing;
 
+use Drupal\Core\Cache\CacheBackendInterface;
+use Drupal\Core\Routing\PreloadableRouteProviderInterface;
+use Drupal\Core\Routing\RouteBuildEvent;
 use Drupal\Core\Routing\RoutePreloader;
+use Drupal\Core\State\StateInterface;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\EventDispatcher\Event;
 use Symfony\Component\HttpFoundation\Request;
+use Symfony\Component\HttpKernel\Event\KernelEvent;
 use Symfony\Component\Routing\Route;
 use Symfony\Component\Routing\RouteCollection;
 
@@ -47,9 +52,9 @@ class RoutePreloaderTest extends UnitTestCase {
    * {@inheritdoc}
    */
   protected function setUp() {
-    $this->routeProvider = $this->getMock('Drupal\Core\Routing\PreloadableRouteProviderInterface');
-    $this->state = $this->getMock('\Drupal\Core\State\StateInterface');
-    $this->cache = $this->getMock('Drupal\Core\Cache\CacheBackendInterface');
+    $this->routeProvider = $this->getMock(PreloadableRouteProviderInterface::class);
+    $this->state = $this->getMock(StateInterface::class);
+    $this->cache = $this->getMock(CacheBackendInterface::class);
     $this->preloader = new RoutePreloader($this->routeProvider, $this->state, $this->cache);
   }
 
@@ -57,7 +62,7 @@ protected function setUp() {
    * Tests onAlterRoutes with just admin routes.
    */
   public function testOnAlterRoutesWithAdminRoutes() {
-    $event = $this->getMockBuilder('Drupal\Core\Routing\RouteBuildEvent')
+    $event = $this->getMockBuilder(RouteBuildEvent::class)
       ->disableOriginalConstructor()
       ->getMock();
     $route_collection = new RouteCollection();
@@ -78,7 +83,7 @@ public function testOnAlterRoutesWithAdminRoutes() {
    * Tests onAlterRoutes with "admin" appearing in the path.
    */
   public function testOnAlterRoutesWithAdminPathNoAdminRoute() {
-    $event = $this->getMockBuilder('Drupal\Core\Routing\RouteBuildEvent')
+    $event = $this->getMockBuilder(RouteBuildEvent::class)
       ->disableOriginalConstructor()
       ->getMock();
     $route_collection = new RouteCollection();
@@ -102,7 +107,7 @@ public function testOnAlterRoutesWithAdminPathNoAdminRoute() {
    * Tests onAlterRoutes with admin routes and non admin routes.
    */
   public function testOnAlterRoutesWithNonAdminRoutes() {
-    $event = $this->getMockBuilder('Drupal\Core\Routing\RouteBuildEvent')
+    $event = $this->getMockBuilder(RouteBuildEvent::class)
       ->disableOriginalConstructor()
       ->getMock();
     $route_collection = new RouteCollection();
@@ -125,7 +130,7 @@ public function testOnAlterRoutesWithNonAdminRoutes() {
    * Tests onRequest on a non html request.
    */
   public function testOnRequestNonHtml() {
-    $event = $this->getMockBuilder('\Symfony\Component\HttpKernel\Event\KernelEvent')
+    $event = $this->getMockBuilder(KernelEvent::class)
       ->disableOriginalConstructor()
       ->getMock();
     $request = new Request();
@@ -146,7 +151,7 @@ public function testOnRequestNonHtml() {
    * Tests onRequest on a html request.
    */
   public function testOnRequestOnHtml() {
-    $event = $this->getMockBuilder('\Symfony\Component\HttpKernel\Event\KernelEvent')
+    $event = $this->getMockBuilder(KernelEvent::class)
       ->disableOriginalConstructor()
       ->getMock();
     $request = new Request();
diff --git a/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php b/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php
index 6c6d768..7797780 100644
--- a/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php
+++ b/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php
@@ -3,12 +3,16 @@
 namespace Drupal\Tests\Core\Routing;
 
 use Drupal\Core\Cache\Cache;
+use Drupal\Core\Cache\Context\CacheContextsManager;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
+use Drupal\Core\Path\AliasManager;
 use Drupal\Core\PathProcessor\OutboundPathProcessorInterface;
 use Drupal\Core\PathProcessor\PathProcessorAlias;
 use Drupal\Core\PathProcessor\PathProcessorManager;
 use Drupal\Core\Render\BubbleableMetadata;
+use Drupal\Core\RouteProcessor\RouteProcessorManager;
 use Drupal\Core\Routing\RequestContext;
+use Drupal\Core\Routing\RouteProvider;
 use Drupal\Core\Routing\RouteProviderInterface;
 use Drupal\Core\Routing\UrlGenerator;
 use Drupal\Tests\UnitTestCase;
@@ -79,7 +83,7 @@ class UrlGeneratorTest extends UnitTestCase {
    * {@inheritdoc}
    */
   protected function setUp() {
-    $cache_contexts_manager = $this->getMockBuilder('Drupal\Core\Cache\Context\CacheContextsManager')
+    $cache_contexts_manager = $this->getMockBuilder(CacheContextsManager::class)
       ->disableOriginalConstructor()
       ->getMock();
     $cache_contexts_manager->method('assertValidTokens')->willReturn(TRUE);
@@ -101,7 +105,7 @@ protected function setUp() {
     $routes->add('<none>', $none_route);
 
     // Create a route provider stub.
-    $provider = $this->getMockBuilder('Drupal\Core\Routing\RouteProvider')
+    $provider = $this->getMockBuilder(RouteProvider::class)
       ->disableOriginalConstructor()
       ->getMock();
     // We need to set up return value maps for both the getRouteByName() and the
@@ -143,7 +147,7 @@ protected function setUp() {
       ->will($this->returnValueMap($routes_names_return_map));
 
     // Create an alias manager stub.
-    $alias_manager = $this->getMockBuilder('Drupal\Core\Path\AliasManager')
+    $alias_manager = $this->getMockBuilder(AliasManager::class)
       ->disableOriginalConstructor()
       ->getMock();
 
@@ -165,7 +169,7 @@ protected function setUp() {
     $processor_manager->addOutbound($processor, 1000);
     $this->processorManager = $processor_manager;
 
-    $this->routeProcessorManager = $this->getMockBuilder('Drupal\Core\RouteProcessor\RouteProcessorManager')
+    $this->routeProcessorManager = $this->getMockBuilder(RouteProcessorManager::class)
       ->disableOriginalConstructor()
       ->getMock();
 
diff --git a/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTraitTest.php b/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTraitTest.php
index 5fa503b..a6af2e2 100644
--- a/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTraitTest.php
+++ b/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTraitTest.php
@@ -2,6 +2,8 @@
 
 namespace Drupal\Tests\Core\Routing;
 
+use Drupal\Core\Routing\UrlGeneratorInterface;
+use Drupal\Core\Routing\UrlGeneratorTrait;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -15,9 +17,9 @@ class UrlGeneratorTraitTest extends UnitTestCase {
    * @covers ::getUrlGenerator
    */
   public function testGetUrlGenerator() {
-    $url_generator = $this->getMock('Drupal\Core\Routing\UrlGeneratorInterface');
+    $url_generator = $this->getMock(UrlGeneratorInterface::class);
 
-    $url_generator_trait_object = $this->getMockForTrait('Drupal\Core\Routing\UrlGeneratorTrait');
+    $url_generator_trait_object = $this->getMockForTrait(UrlGeneratorTrait::class);
     $url_generator_trait_object->setUrlGenerator($url_generator);
 
     $url_generator_method = new \ReflectionMethod($url_generator_trait_object, 'getUrlGenerator');
@@ -33,13 +35,13 @@ public function testRedirect() {
     $route_name = 'some_route_name';
     $generated_url = 'some/generated/url';
 
-    $url_generator = $this->getMock('Drupal\Core\Routing\UrlGeneratorInterface');
+    $url_generator = $this->getMock(UrlGeneratorInterface::class);
     $url_generator->expects($this->once())
       ->method('generateFromRoute')
       ->with($route_name, [], ['absolute' => TRUE])
       ->willReturn($generated_url);
 
-    $url_generator_trait_object = $this->getMockForTrait('Drupal\Core\Routing\UrlGeneratorTrait');
+    $url_generator_trait_object = $this->getMockForTrait(UrlGeneratorTrait::class);
     $url_generator_trait_object->setUrlGenerator($url_generator);
 
     $url_generator_method = new \ReflectionMethod($url_generator_trait_object, 'redirect');
diff --git a/core/tests/Drupal/Tests/Core/Serialization/YamlTest.php b/core/tests/Drupal/Tests/Core/Serialization/YamlTest.php
index 0d83d8d..3450252 100644
--- a/core/tests/Drupal/Tests/Core/Serialization/YamlTest.php
+++ b/core/tests/Drupal/Tests/Core/Serialization/YamlTest.php
@@ -24,7 +24,7 @@ public function testGetSeralization() {
 
     $this->assertEquals(YamlParserProxy::class, Settings::get('yaml_parser_class'));
 
-    $mock = $this->getMockBuilder('\stdClass')
+    $mock = $this->getMockBuilder(\stdClass::class)
       ->setMethods(['encode', 'decode', 'getFileExtension'])
       ->getMock();
     $mock
diff --git a/core/tests/Drupal/Tests/Core/Session/PermissionsHashGeneratorTest.php b/core/tests/Drupal/Tests/Core/Session/PermissionsHashGeneratorTest.php
index aa980f8..899507d 100644
--- a/core/tests/Drupal/Tests/Core/Session/PermissionsHashGeneratorTest.php
+++ b/core/tests/Drupal/Tests/Core/Session/PermissionsHashGeneratorTest.php
@@ -3,9 +3,12 @@
 namespace Drupal\Tests\Core\Session;
 
 use Drupal\Component\Utility\Crypt;
+use Drupal\Core\Cache\CacheBackendInterface;
+use Drupal\Core\PrivateKey;
 use Drupal\Core\Session\PermissionsHashGenerator;
 use Drupal\Core\Site\Settings;
 use Drupal\Tests\UnitTestCase;
+use Drupal\user\Entity\User;
 
 /**
  * @coversDefaultClass \Drupal\Core\Session\PermissionsHashGenerator
@@ -78,7 +81,7 @@ protected function setUp() {
     new Settings(['hash_salt' => 'test']);
 
     // The mocked super user account, with the same roles as Account 2.
-    $this->account1 = $this->getMockBuilder('Drupal\user\Entity\User')
+    $this->account1 = $this->getMockBuilder(User::class)
       ->disableOriginalConstructor()
       ->setMethods(['getRoles', 'id'])
       ->getMock();
@@ -90,7 +93,7 @@ protected function setUp() {
 
     // Account 2: 'administrator' and 'authenticated' roles.
     $roles_1 = ['administrator', 'authenticated'];
-    $this->account2 = $this->getMockBuilder('Drupal\user\Entity\User')
+    $this->account2 = $this->getMockBuilder(User::class)
       ->disableOriginalConstructor()
       ->setMethods(['getRoles', 'id'])
       ->getMock();
@@ -103,7 +106,7 @@ protected function setUp() {
 
     // Account 3: 'authenticated' and 'administrator' roles (different order).
     $roles_3 = ['authenticated', 'administrator'];
-    $this->account3 = $this->getMockBuilder('Drupal\user\Entity\User')
+    $this->account3 = $this->getMockBuilder(User::class)
       ->disableOriginalConstructor()
       ->setMethods(['getRoles', 'id'])
       ->getMock();
@@ -116,7 +119,7 @@ protected function setUp() {
 
     // Updated account 2: now also 'editor' role.
     $roles_2_updated = ['editor', 'administrator', 'authenticated'];
-    $this->account2Updated = $this->getMockBuilder('Drupal\user\Entity\User')
+    $this->account2Updated = $this->getMockBuilder(User::class)
       ->disableOriginalConstructor()
       ->setMethods(['getRoles', 'id'])
       ->getMock();
@@ -129,17 +132,17 @@ protected function setUp() {
 
     // Mocked private key + cache services.
     $random = Crypt::randomBytesBase64(55);
-    $this->privateKey = $this->getMockBuilder('Drupal\Core\PrivateKey')
+    $this->privateKey = $this->getMockBuilder(PrivateKey::class)
       ->disableOriginalConstructor()
       ->setMethods(['get'])
       ->getMock();
     $this->privateKey->expects($this->any())
       ->method('get')
       ->will($this->returnValue($random));
-    $this->cache = $this->getMockBuilder('Drupal\Core\Cache\CacheBackendInterface')
+    $this->cache = $this->getMockBuilder(CacheBackendInterface::class)
       ->disableOriginalConstructor()
       ->getMock();
-    $this->staticCache = $this->getMockBuilder('Drupal\Core\Cache\CacheBackendInterface')
+    $this->staticCache = $this->getMockBuilder(CacheBackendInterface::class)
       ->disableOriginalConstructor()
       ->getMock();
 
diff --git a/core/tests/Drupal/Tests/Core/Session/SessionConfigurationTest.php b/core/tests/Drupal/Tests/Core/Session/SessionConfigurationTest.php
index 38ee14f..621dfb6 100644
--- a/core/tests/Drupal/Tests/Core/Session/SessionConfigurationTest.php
+++ b/core/tests/Drupal/Tests/Core/Session/SessionConfigurationTest.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\Tests\Core\Session;
 
+use Drupal\Core\Session\SessionConfiguration;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\HttpFoundation\Request;
 
@@ -17,7 +18,7 @@ class SessionConfigurationTest extends UnitTestCase {
    * @returns \Drupal\Core\Session\SessionConfiguration|\PHPUnit_Framework_MockObject_MockObject
    */
   protected function createSessionConfiguration($options = []) {
-    return $this->getMock('Drupal\Core\Session\SessionConfiguration', ['drupalValidTestUa'], [$options]);
+    return $this->getMock(SessionConfiguration::class, ['drupalValidTestUa'], [$options]);
   }
 
   /**
diff --git a/core/tests/Drupal/Tests/Core/Session/UserSessionTest.php b/core/tests/Drupal/Tests/Core/Session/UserSessionTest.php
index 85fe1bb..a189a8a 100644
--- a/core/tests/Drupal/Tests/Core/Session/UserSessionTest.php
+++ b/core/tests/Drupal/Tests/Core/Session/UserSessionTest.php
@@ -3,9 +3,12 @@
 namespace Drupal\Tests\Core\Session;
 
 use Drupal\Core\DependencyInjection\ContainerBuilder;
+use Drupal\Core\Entity\EntityManagerInterface;
 use Drupal\Core\Session\UserSession;
 use Drupal\Tests\UnitTestCase;
+use Drupal\user\Entity\Role;
 use Drupal\user\RoleInterface;
+use Drupal\user\RoleStorage;
 
 /**
  * @coversDefaultClass \Drupal\Core\Session\UserSession
@@ -57,7 +60,7 @@ protected function setUp() {
     parent::setUp();
 
     $roles = [];
-    $roles['role_one'] = $this->getMockBuilder('Drupal\user\Entity\Role')
+    $roles['role_one'] = $this->getMockBuilder(Role::class)
       ->disableOriginalConstructor()
       ->setMethods(['hasPermission'])
       ->getMock();
@@ -69,7 +72,7 @@ protected function setUp() {
         ['last example permission', FALSE],
       ]));
 
-    $roles['role_two'] = $this->getMockBuilder('Drupal\user\Entity\Role')
+    $roles['role_two'] = $this->getMockBuilder(Role::class)
       ->disableOriginalConstructor()
       ->setMethods(['hasPermission'])
       ->getMock();
@@ -81,7 +84,7 @@ protected function setUp() {
         ['last example permission', FALSE],
       ]));
 
-    $roles['anonymous'] = $this->getMockBuilder('Drupal\user\Entity\Role')
+    $roles['anonymous'] = $this->getMockBuilder(Role::class)
       ->disableOriginalConstructor()
       ->setMethods(['hasPermission'])
       ->getMock();
@@ -93,7 +96,7 @@ protected function setUp() {
         ['last example permission', FALSE],
       ]));
 
-    $role_storage = $this->getMockBuilder('Drupal\user\RoleStorage')
+    $role_storage = $this->getMockBuilder(RoleStorage::class)
       ->disableOriginalConstructor()
       ->setMethods(['loadMultiple'])
       ->getMock();
@@ -108,7 +111,7 @@ protected function setUp() {
         [['anonymous', 'role_one', 'role_two'], [$roles['role_one'], $roles['role_two']]],
       ]));
 
-    $entity_manager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
+    $entity_manager = $this->getMock(EntityManagerInterface::class);
     $entity_manager->expects($this->any())
       ->method('getStorage')
       ->with($this->equalTo('user_role'))
diff --git a/core/tests/Drupal/Tests/Core/Session/WriteSafeSessionHandlerTest.php b/core/tests/Drupal/Tests/Core/Session/WriteSafeSessionHandlerTest.php
index 0ddae48..80b30fe 100644
--- a/core/tests/Drupal/Tests/Core/Session/WriteSafeSessionHandlerTest.php
+++ b/core/tests/Drupal/Tests/Core/Session/WriteSafeSessionHandlerTest.php
@@ -28,7 +28,7 @@ class WriteSafeSessionHandlerTest extends UnitTestCase {
   protected $sessionHandler;
 
   protected function setUp() {
-    $this->wrappedSessionHandler = $this->getMock('SessionHandlerInterface');
+    $this->wrappedSessionHandler = $this->getMock(\SessionHandlerInterface::class);
     $this->sessionHandler = new WriteSafeSessionHandler($this->wrappedSessionHandler);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/StackMiddleware/ReverseProxyMiddlewareTest.php b/core/tests/Drupal/Tests/Core/StackMiddleware/ReverseProxyMiddlewareTest.php
index b7a784d..e8856d2 100644
--- a/core/tests/Drupal/Tests/Core/StackMiddleware/ReverseProxyMiddlewareTest.php
+++ b/core/tests/Drupal/Tests/Core/StackMiddleware/ReverseProxyMiddlewareTest.php
@@ -6,6 +6,7 @@
 use Drupal\Core\StackMiddleware\ReverseProxyMiddleware;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\HttpFoundation\Request;
+use Symfony\Component\HttpKernel\HttpKernelInterface;
 
 /**
  * Unit test the reverse proxy stack middleware.
@@ -23,7 +24,7 @@ class ReverseProxyMiddlewareTest extends UnitTestCase {
    * {@inheritdoc}
    */
   protected function setUp() {
-    $this->mockHttpKernel = $this->getMock('Symfony\Component\HttpKernel\HttpKernelInterface');
+    $this->mockHttpKernel = $this->getMock(HttpKernelInterface::class);
   }
 
   /**
@@ -35,7 +36,7 @@ public function testNoProxy() {
 
     $middleware = new ReverseProxyMiddleware($this->mockHttpKernel, $settings);
     // Mock a request object.
-    $request = $this->getMock('Symfony\Component\HttpFoundation\Request', ['setTrustedHeaderName', 'setTrustedProxies']);
+    $request = $this->getMock(Request::class, ['setTrustedHeaderName', 'setTrustedProxies']);
     // setTrustedHeaderName() should never fire.
     $request->expects($this->never())
       ->method('setTrustedHeaderName');
diff --git a/core/tests/Drupal/Tests/Core/StringTranslation/TranslationManagerTest.php b/core/tests/Drupal/Tests/Core/StringTranslation/TranslationManagerTest.php
index 2cd750b..21739dc 100644
--- a/core/tests/Drupal/Tests/Core/StringTranslation/TranslationManagerTest.php
+++ b/core/tests/Drupal/Tests/Core/StringTranslation/TranslationManagerTest.php
@@ -9,6 +9,7 @@
 
 use Drupal\Component\Render\MarkupInterface;
 use Drupal\Core\StringTranslation\TranslationManager;
+use Drupal\Core\StringTranslation\Translator\TranslatorInterface;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -52,7 +53,7 @@ public function providerTestFormatPlural() {
    */
   public function testFormatPlural($count, $singular, $plural, array $args = [], array $options = [], $expected) {
     $langcode = empty($options['langcode']) ? 'fr' : $options['langcode'];
-    $translator = $this->getMock('\Drupal\Core\StringTranslation\Translator\TranslatorInterface');
+    $translator = $this->getMock(TranslatorInterface::class);
     $translator->expects($this->once())
       ->method('getStringTranslation')
       ->with($langcode, $this->anything(), $this->anything())
diff --git a/core/tests/Drupal/Tests/Core/Template/TwigExtensionTest.php b/core/tests/Drupal/Tests/Core/Template/TwigExtensionTest.php
index a872e30..d55eb50 100644
--- a/core/tests/Drupal/Tests/Core/Template/TwigExtensionTest.php
+++ b/core/tests/Drupal/Tests/Core/Template/TwigExtensionTest.php
@@ -2,12 +2,18 @@
 
 namespace Drupal\Tests\Core\Template;
 
+use Drupal\Component\Render\MarkupInterface;
+use Drupal\Core\Datetime\DateFormatterInterface;
 use Drupal\Core\GeneratedLink;
 use Drupal\Core\Render\RenderableInterface;
+use Drupal\Core\Render\RendererInterface;
+use Drupal\Core\Routing\UrlGeneratorInterface;
 use Drupal\Core\StringTranslation\TranslatableMarkup;
 use Drupal\Core\Template\Loader\StringLoader;
 use Drupal\Core\Template\TwigEnvironment;
 use Drupal\Core\Template\TwigExtension;
+use Drupal\Core\Theme\ActiveTheme;
+use Drupal\Core\Theme\ThemeManagerInterface;
 use Drupal\Core\Url;
 use Drupal\Tests\UnitTestCase;
 
@@ -62,10 +68,10 @@ class TwigExtensionTest extends UnitTestCase {
   public function setUp() {
     parent::setUp();
 
-    $this->renderer = $this->getMock('\Drupal\Core\Render\RendererInterface');
-    $this->urlGenerator = $this->getMock('\Drupal\Core\Routing\UrlGeneratorInterface');
-    $this->themeManager = $this->getMock('\Drupal\Core\Theme\ThemeManagerInterface');
-    $this->dateFormatter = $this->getMock('\Drupal\Core\Datetime\DateFormatterInterface');
+    $this->renderer = $this->getMock(RendererInterface::class);
+    $this->urlGenerator = $this->getMock(UrlGeneratorInterface::class);
+    $this->themeManager = $this->getMock(ThemeManagerInterface::class);
+    $this->dateFormatter = $this->getMock(DateFormatterInterface::class);
 
     $this->systemUnderTest = new TwigExtension($this->renderer, $this->urlGenerator, $this->themeManager, $this->dateFormatter);
   }
@@ -130,7 +136,7 @@ public function providerTestEscaping() {
    * @group legacy
    */
   public function testActiveTheme() {
-    $active_theme = $this->getMockBuilder('\Drupal\Core\Theme\ActiveTheme')
+    $active_theme = $this->getMockBuilder(ActiveTheme::class)
       ->disableOriginalConstructor()
       ->getMock();
     $active_theme->expects($this->once())
@@ -166,7 +172,7 @@ public function testFormatDate() {
    * Tests the active_theme_path function.
    */
   public function testActiveThemePath() {
-    $active_theme = $this->getMockBuilder('\Drupal\Core\Theme\ActiveTheme')
+    $active_theme = $this->getMockBuilder(ActiveTheme::class)
       ->disableOriginalConstructor()
       ->getMock();
     $active_theme
@@ -201,7 +207,7 @@ public function testSafeStringEscaping() {
 
     // By default, TwigExtension will attempt to cast objects to strings.
     // Ensure objects that implement MarkupInterface are unchanged.
-    $safe_string = $this->getMock('\Drupal\Component\Render\MarkupInterface');
+    $safe_string = $this->getMock(MarkupInterface::class);
     $this->assertSame($safe_string, $this->systemUnderTest->escapeFilter($twig, $safe_string, 'html', 'UTF-8', TRUE));
 
     // Ensure objects that do not implement MarkupInterface are escaped.
diff --git a/core/tests/Drupal/Tests/Core/Template/TwigSandboxTest.php b/core/tests/Drupal/Tests/Core/Template/TwigSandboxTest.php
index 1bbb9f4..406b1eb 100644
--- a/core/tests/Drupal/Tests/Core/Template/TwigSandboxTest.php
+++ b/core/tests/Drupal/Tests/Core/Template/TwigSandboxTest.php
@@ -7,6 +7,9 @@
 
 namespace Drupal\Tests\Core\Template;
 
+use Drupal\Core\Url;
+use Drupal\Core\Entity\ContentEntityBase;
+use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Template\Attribute;
 use Drupal\Core\Template\TwigSandboxPolicy;
 use Drupal\Core\Template\Loader\StringLoader;
@@ -48,7 +51,7 @@ protected function setUp() {
    * @dataProvider getTwigEntityDangerousMethods
    */
   public function testEntityDangerousMethods($template) {
-    $entity = $this->getMock('Drupal\Core\Entity\EntityInterface');
+    $entity = $this->getMock(EntityInterface::class);
     $this->setExpectedException(\Twig_Sandbox_SecurityError::class);
     $this->twig->render($template, ['entity' => $entity]);
   }
@@ -79,7 +82,7 @@ public function testExtendedClass() {
    * Currently "get", "has", and "is" are the only allowed prefixes.
    */
   public function testEntitySafePrefixes() {
-    $entity = $this->getMock('Drupal\Core\Entity\EntityInterface');
+    $entity = $this->getMock(EntityInterface::class);
     $entity->expects($this->atLeastOnce())
       ->method('hasLinkTemplate')
       ->with('test')
@@ -87,14 +90,14 @@ public function testEntitySafePrefixes() {
     $result = $this->twig->render('{{ entity.hasLinkTemplate("test") }}', ['entity' => $entity]);
     $this->assertTrue((bool)$result, 'Sandbox policy allows has* functions to be called.');
 
-    $entity = $this->getMock('Drupal\Core\Entity\EntityInterface');
+    $entity = $this->getMock(EntityInterface::class);
     $entity->expects($this->atLeastOnce())
       ->method('isNew')
       ->willReturn(TRUE);
     $result = $this->twig->render('{{ entity.isNew }}', ['entity' => $entity]);
     $this->assertTrue((bool)$result, 'Sandbox policy allows is* functions to be called.');
 
-    $entity = $this->getMock('Drupal\Core\Entity\EntityInterface');
+    $entity = $this->getMock(EntityInterface::class);
     $entity->expects($this->atLeastOnce())
       ->method('getEntityType')
       ->willReturn('test');
@@ -109,7 +112,7 @@ public function testEntitySafePrefixes() {
    * get.
    */
   public function testEntitySafeMethods() {
-    $entity = $this->getMockBuilder('Drupal\Core\Entity\ContentEntityBase')
+    $entity = $this->getMockBuilder(ContentEntityBase::class)
       ->disableOriginalConstructor()
       ->getMock();
     $entity->expects($this->atLeastOnce())
@@ -119,21 +122,21 @@ public function testEntitySafeMethods() {
     $result = $this->twig->render('{{ entity.get("title") }}', ['entity' => $entity]);
     $this->assertEquals($result, 'test', 'Sandbox policy allows get() to be called.');
 
-    $entity = $this->getMock('Drupal\Core\Entity\EntityInterface');
+    $entity = $this->getMock(EntityInterface::class);
     $entity->expects($this->atLeastOnce())
       ->method('id')
       ->willReturn('1234');
     $result = $this->twig->render('{{ entity.id }}', ['entity' => $entity]);
     $this->assertEquals($result, '1234', 'Sandbox policy allows get() to be called.');
 
-    $entity = $this->getMock('Drupal\Core\Entity\EntityInterface');
+    $entity = $this->getMock(EntityInterface::class);
     $entity->expects($this->atLeastOnce())
       ->method('label')
       ->willReturn('testing');
     $result = $this->twig->render('{{ entity.label }}', ['entity' => $entity]);
     $this->assertEquals($result, 'testing', 'Sandbox policy allows get() to be called.');
 
-    $entity = $this->getMock('Drupal\Core\Entity\EntityInterface');
+    $entity = $this->getMock(EntityInterface::class);
     $entity->expects($this->atLeastOnce())
       ->method('bundle')
       ->willReturn('testing');
@@ -145,7 +148,7 @@ public function testEntitySafeMethods() {
    * Tests that safe methods inside Url objects can be called.
    */
   public function testUrlSafeMethods() {
-    $url = $this->getMockBuilder('Drupal\Core\Url')
+    $url = $this->getMockBuilder(Url::class)
       ->disableOriginalConstructor()
       ->getMock();
     $url->expects($this->once())
diff --git a/core/tests/Drupal/Tests/Core/Theme/RegistryTest.php b/core/tests/Drupal/Tests/Core/Theme/RegistryTest.php
index f2cd22e..f6797b0 100644
--- a/core/tests/Drupal/Tests/Core/Theme/RegistryTest.php
+++ b/core/tests/Drupal/Tests/Core/Theme/RegistryTest.php
@@ -7,8 +7,14 @@
 
 namespace Drupal\Tests\Core\Theme;
 
+use Drupal\Core\Cache\CacheBackendInterface;
+use Drupal\Core\Extension\ModuleHandlerInterface;
+use Drupal\Core\Extension\ThemeHandlerInterface;
+use Drupal\Core\Lock\LockBackendInterface;
 use Drupal\Core\Theme\ActiveTheme;
 use Drupal\Core\Theme\Registry;
+use Drupal\Core\Theme\ThemeInitializationInterface;
+use Drupal\Core\Theme\ThemeManagerInterface;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -79,12 +85,12 @@ class RegistryTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $this->cache = $this->getMock('Drupal\Core\Cache\CacheBackendInterface');
-    $this->lock = $this->getMock('Drupal\Core\Lock\LockBackendInterface');
-    $this->moduleHandler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface');
-    $this->themeHandler = $this->getMock('Drupal\Core\Extension\ThemeHandlerInterface');
-    $this->themeInitialization = $this->getMock('Drupal\Core\Theme\ThemeInitializationInterface');
-    $this->themeManager = $this->getMock('Drupal\Core\Theme\ThemeManagerInterface');
+    $this->cache = $this->getMock(CacheBackendInterface::class);
+    $this->lock = $this->getMock(LockBackendInterface::class);
+    $this->moduleHandler = $this->getMock(ModuleHandlerInterface::class);
+    $this->themeHandler = $this->getMock(ThemeHandlerInterface::class);
+    $this->themeInitialization = $this->getMock(ThemeInitializationInterface::class);
+    $this->themeManager = $this->getMock(ThemeManagerInterface::class);
 
     $this->setupTheme();
   }
diff --git a/core/tests/Drupal/Tests/Core/Theme/ThemeNegotiatorTest.php b/core/tests/Drupal/Tests/Core/Theme/ThemeNegotiatorTest.php
index 1e2303d..d0d955d 100644
--- a/core/tests/Drupal/Tests/Core/Theme/ThemeNegotiatorTest.php
+++ b/core/tests/Drupal/Tests/Core/Theme/ThemeNegotiatorTest.php
@@ -5,7 +5,9 @@
 use Drupal\Core\DependencyInjection\ClassResolver;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
 use Drupal\Core\Routing\RouteMatch;
+use Drupal\Core\Theme\ThemeAccessCheck;
 use Drupal\Core\Theme\ThemeNegotiator;
+use Drupal\Core\Theme\ThemeNegotiatorInterface;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\Routing\Route;
 
@@ -47,7 +49,7 @@ class ThemeNegotiatorTest extends UnitTestCase {
    * {@inheritdoc}
    */
   protected function setUp() {
-    $this->themeAccessCheck = $this->getMockBuilder('\Drupal\Core\Theme\ThemeAccessCheck')
+    $this->themeAccessCheck = $this->getMockBuilder(ThemeAccessCheck::class)
       ->disableOriginalConstructor()
       ->getMock();
     $this->container = new ContainerBuilder();
@@ -59,7 +61,7 @@ protected function setUp() {
    * @see \Drupal\Core\Theme\ThemeNegotiator::determineActiveTheme()
    */
   public function testDetermineActiveTheme() {
-    $negotiator = $this->getMock('Drupal\Core\Theme\ThemeNegotiatorInterface');
+    $negotiator = $this->getMock(ThemeNegotiatorInterface::class);
     $negotiator->expects($this->once())
       ->method('determineActiveTheme')
       ->will($this->returnValue('example_test'));
@@ -89,7 +91,7 @@ public function testDetermineActiveTheme() {
   public function testDetermineActiveThemeWithPriority() {
     $negotiators = [];
 
-    $negotiator = $this->getMock('Drupal\Core\Theme\ThemeNegotiatorInterface');
+    $negotiator = $this->getMock(ThemeNegotiatorInterface::class);
     $negotiator->expects($this->once())
       ->method('determineActiveTheme')
       ->will($this->returnValue('example_test'));
@@ -99,7 +101,7 @@ public function testDetermineActiveThemeWithPriority() {
 
     $negotiators['test_negotiator_1'] = $negotiator;
 
-    $negotiator = $this->getMock('Drupal\Core\Theme\ThemeNegotiatorInterface');
+    $negotiator = $this->getMock(ThemeNegotiatorInterface::class);
     $negotiator->expects($this->never())
       ->method('determineActiveTheme');
     $negotiator->expects($this->never())
@@ -129,7 +131,7 @@ public function testDetermineActiveThemeWithPriority() {
   public function testDetermineActiveThemeWithAccessCheck() {
     $negotiators = [];
 
-    $negotiator = $this->getMock('Drupal\Core\Theme\ThemeNegotiatorInterface');
+    $negotiator = $this->getMock(ThemeNegotiatorInterface::class);
     $negotiator->expects($this->once())
       ->method('determineActiveTheme')
       ->will($this->returnValue('example_test'));
@@ -139,7 +141,7 @@ public function testDetermineActiveThemeWithAccessCheck() {
 
     $negotiators['test_negotiator_1'] = $negotiator;
 
-    $negotiator = $this->getMock('Drupal\Core\Theme\ThemeNegotiatorInterface');
+    $negotiator = $this->getMock(ThemeNegotiatorInterface::class);
     $negotiator->expects($this->once())
       ->method('determineActiveTheme')
       ->will($this->returnValue('example_test2'));
@@ -177,7 +179,7 @@ public function testDetermineActiveThemeWithAccessCheck() {
   public function testDetermineActiveThemeWithNotApplyingNegotiator() {
     $negotiators = [];
 
-    $negotiator = $this->getMock('Drupal\Core\Theme\ThemeNegotiatorInterface');
+    $negotiator = $this->getMock(ThemeNegotiatorInterface::class);
     $negotiator->expects($this->never())
       ->method('determineActiveTheme');
     $negotiator->expects($this->once())
@@ -186,7 +188,7 @@ public function testDetermineActiveThemeWithNotApplyingNegotiator() {
 
     $negotiators['test_negotiator_1'] = $negotiator;
 
-    $negotiator = $this->getMock('Drupal\Core\Theme\ThemeNegotiatorInterface');
+    $negotiator = $this->getMock(ThemeNegotiatorInterface::class);
     $negotiator->expects($this->once())
       ->method('determineActiveTheme')
       ->will($this->returnValue('example_test2'));
diff --git a/core/tests/Drupal/Tests/Core/Transliteration/PhpTransliterationTest.php b/core/tests/Drupal/Tests/Core/Transliteration/PhpTransliterationTest.php
index ac19ffa..95f39d8 100644
--- a/core/tests/Drupal/Tests/Core/Transliteration/PhpTransliterationTest.php
+++ b/core/tests/Drupal/Tests/Core/Transliteration/PhpTransliterationTest.php
@@ -3,6 +3,7 @@
 namespace Drupal\Tests\Core\Transliteration;
 
 use Drupal\Component\Utility\Random;
+use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Transliteration\PhpTransliteration;
 use Drupal\Tests\UnitTestCase;
 
@@ -37,7 +38,7 @@ public function testPhpTransliterationWithAlter($langcode, $original, $expected,
 
     // Test each case both with a new instance of the transliteration class,
     // and with one that builds as it goes.
-    $module_handler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface');
+    $module_handler = $this->getMock(ModuleHandlerInterface::class);
     $module_handler->expects($this->any())
       ->method('alter')
       ->will($this->returnCallback(function($hook, &$overrides, $langcode) {
diff --git a/core/tests/Drupal/Tests/Core/TypedData/RecursiveContextualValidatorTest.php b/core/tests/Drupal/Tests/Core/TypedData/RecursiveContextualValidatorTest.php
index 08b8117..43bc760 100644
--- a/core/tests/Drupal/Tests/Core/TypedData/RecursiveContextualValidatorTest.php
+++ b/core/tests/Drupal/Tests/Core/TypedData/RecursiveContextualValidatorTest.php
@@ -8,13 +8,17 @@
 namespace Drupal\Tests\Core\TypedData;
 
 use Drupal\Core\Cache\NullBackend;
+use Drupal\Core\DependencyInjection\ClassResolverInterface;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
+use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\TypedData\DataDefinition;
 use Drupal\Core\TypedData\MapDataDefinition;
+use Drupal\Core\TypedData\TypedDataInterface;
 use Drupal\Core\TypedData\TypedDataManager;
 use Drupal\Core\TypedData\Validation\ExecutionContextFactory;
 use Drupal\Core\TypedData\Validation\RecursiveValidator;
 use Drupal\Core\Validation\ConstraintManager;
+use Drupal\Core\Validation\TranslatorInterface;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\Validator\ConstraintValidatorFactory;
 use Symfony\Component\Validator\Context\ExecutionContextInterface;
@@ -64,10 +68,10 @@ protected function setUp() {
       'Drupal\\Core\\TypedData' => $this->root . '/core/lib/Drupal/Core/TypedData',
       'Drupal\\Core\\Validation' => $this->root . '/core/lib/Drupal/Core/Validation',
     ]);
-    $module_handler = $this->getMockBuilder('Drupal\Core\Extension\ModuleHandlerInterface')
+    $module_handler = $this->getMockBuilder(ModuleHandlerInterface::class)
       ->disableOriginalConstructor()
       ->getMock();
-    $class_resolver = $this->getMockBuilder('Drupal\Core\DependencyInjection\ClassResolverInterface')
+    $class_resolver = $this->getMockBuilder(ClassResolverInterface::class)
       ->disableOriginalConstructor()
       ->getMock();
 
@@ -80,7 +84,7 @@ protected function setUp() {
     $container->set('typed_data_manager', $this->typedDataManager);
     \Drupal::setContainer($container);
 
-    $translator = $this->getMock('Drupal\Core\Validation\TranslatorInterface');
+    $translator = $this->getMock(TranslatorInterface::class);
     $translator->expects($this->any())
       ->method('trans')
       ->willReturnCallback(function($id) {
@@ -258,7 +262,7 @@ public function providerTestValidatePropertyWithInvalidObjects() {
     $data[] = [new \stdClass()];
     $data[] = [new TestClass()];
 
-    $data[] = [$this->getMock('Drupal\Core\TypedData\TypedDataInterface')];
+    $data[] = [$this->getMock(TypedDataInterface::class)];
 
     return $data;
   }
diff --git a/core/tests/Drupal/Tests/Core/UnroutedUrlTest.php b/core/tests/Drupal/Tests/Core/UnroutedUrlTest.php
index 680e2fd..4bbde67 100644
--- a/core/tests/Drupal/Tests/Core/UnroutedUrlTest.php
+++ b/core/tests/Drupal/Tests/Core/UnroutedUrlTest.php
@@ -4,6 +4,8 @@
 
 use Drupal\Core\DependencyInjection\ContainerBuilder;
 use Drupal\Core\Url;
+use Drupal\Core\Utility\UnroutedUrlAssemblerInterface;
+use Drupal\Tests\Core\Routing\TestRouterInterface;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\Routing\Exception\ResourceNotFoundException;
@@ -48,12 +50,12 @@ class UnroutedUrlTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $this->urlAssembler = $this->getMock('Drupal\Core\Utility\UnroutedUrlAssemblerInterface');
+    $this->urlAssembler = $this->getMock(UnroutedUrlAssemblerInterface::class);
     $this->urlAssembler->expects($this->any())
       ->method('assemble')
       ->will($this->returnArgument(0));
 
-    $this->router = $this->getMock('Drupal\Tests\Core\Routing\TestRouterInterface');
+    $this->router = $this->getMock(TestRouterInterface::class);
     $container = new ContainerBuilder();
     $container->set('router.no_access_checks', $this->router);
     $container->set('unrouted_url_assembler', $this->urlAssembler);
diff --git a/core/tests/Drupal/Tests/Core/UrlTest.php b/core/tests/Drupal/Tests/Core/UrlTest.php
index ff4cb01..c5ec58a 100644
--- a/core/tests/Drupal/Tests/Core/UrlTest.php
+++ b/core/tests/Drupal/Tests/Core/UrlTest.php
@@ -11,8 +11,13 @@
 use Drupal\Core\Access\AccessManagerInterface;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
 use Drupal\Core\GeneratedUrl;
+use Drupal\Core\Path\AliasManagerInterface;
+use Drupal\Core\Path\PathValidatorInterface;
 use Drupal\Core\Routing\RouteMatch;
+use Drupal\Core\Routing\UrlGeneratorInterface;
+use Drupal\Core\Session\AccountInterface;
 use Drupal\Core\Url;
+use Drupal\Tests\Core\Routing\TestRouterInterface;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Cmf\Component\Routing\RouteObjectInterface;
 use Symfony\Component\HttpFoundation\ParameterBag;
@@ -96,18 +101,18 @@ protected function setUp() {
       $generate_from_route_map[] = $values;
       $generate_from_route_map[] = [$values[0], $values[1], $values[2], TRUE, (new GeneratedUrl())->setGeneratedUrl($values[4])];
     }
-    $this->urlGenerator = $this->getMock('Drupal\Core\Routing\UrlGeneratorInterface');
+    $this->urlGenerator = $this->getMock(UrlGeneratorInterface::class);
     $this->urlGenerator->expects($this->any())
       ->method('generateFromRoute')
       ->will($this->returnValueMap($generate_from_route_map));
 
-    $this->pathAliasManager = $this->getMock('Drupal\Core\Path\AliasManagerInterface');
+    $this->pathAliasManager = $this->getMock(AliasManagerInterface::class);
     $this->pathAliasManager->expects($this->any())
       ->method('getPathByAlias')
       ->will($this->returnValueMap($alias_map));
 
-    $this->router = $this->getMock('Drupal\Tests\Core\Routing\TestRouterInterface');
-    $this->pathValidator = $this->getMock('Drupal\Core\Path\PathValidatorInterface');
+    $this->router = $this->getMock(TestRouterInterface::class);
+    $this->pathValidator = $this->getMock(PathValidatorInterface::class);
 
     $this->container = new ContainerBuilder();
     $this->container->set('router.no_access_checks', $this->router);
@@ -365,7 +370,7 @@ public function testGetInternalPath($urls) {
       // Clone the url so that there is no leak of internal state into the
       // other ones.
       $url = clone $url;
-      $url_generator = $this->getMock('Drupal\Core\Routing\UrlGeneratorInterface');
+      $url_generator = $this->getMock(UrlGeneratorInterface::class);
       $url_generator->expects($this->once())
         ->method('getPathFromRoute')
         ->will($this->returnValueMap($map, $index));
@@ -501,7 +506,7 @@ public function testMergeOptions() {
    * @dataProvider accessProvider
    */
   public function testAccessRouted($access) {
-    $account = $this->getMock('Drupal\Core\Session\AccountInterface');
+    $account = $this->getMock(AccountInterface::class);
     $url = new TestUrl('entity.node.canonical', ['node' => 3]);
     $url->setAccessManager($this->getMockAccessManager($access, $account));
     $this->assertEquals($access, $url->access($account));
@@ -513,9 +518,9 @@ public function testAccessRouted($access) {
    * @covers ::access
    */
   public function testAccessUnrouted() {
-    $account = $this->getMock('Drupal\Core\Session\AccountInterface');
+    $account = $this->getMock(AccountInterface::class);
     $url = TestUrl::fromUri('base:kittens');
-    $access_manager = $this->getMock('Drupal\Core\Access\AccessManagerInterface');
+    $access_manager = $this->getMock(AccessManagerInterface::class);
     $access_manager->expects($this->never())
       ->method('checkNamedRoute');
     $url->setAccessManager($access_manager);
@@ -534,7 +539,7 @@ public function testRenderAccess($access) {
     $element = [
       '#url' => Url::fromRoute('entity.node.canonical', ['node' => 3]),
     ];
-    $this->container->set('current_user', $this->getMock('Drupal\Core\Session\AccountInterface'));
+    $this->container->set('current_user', $this->getMock(AccountInterface::class));
     $this->container->set('access_manager', $this->getMockAccessManager($access));
     $this->assertEquals($access, TestUrl::renderAccess($element));
   }
@@ -840,7 +845,7 @@ public function testFromRouteUriWithMissingRouteName() {
    * @return \Drupal\Core\Access\AccessManagerInterface|\PHPUnit_Framework_MockObject_MockObject
    */
   protected function getMockAccessManager($access, $account = NULL) {
-    $access_manager = $this->getMock('Drupal\Core\Access\AccessManagerInterface');
+    $access_manager = $this->getMock(AccessManagerInterface::class);
     $access_manager->expects($this->once())
       ->method('checkNamedRoute')
       ->with('entity.node.canonical', ['node' => 3], $account)
diff --git a/core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php b/core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php
index 50795b3..358e452 100644
--- a/core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php
+++ b/core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php
@@ -8,10 +8,15 @@
 use Drupal\Core\Language\Language;
 use Drupal\Core\Link;
 use Drupal\Core\Render\Markup;
+use Drupal\Core\Render\RendererInterface;
 use Drupal\Core\Url;
 use Drupal\Core\Utility\LinkGenerator;
+use Drupal\Core\Utility\UnroutedUrlAssemblerInterface;
 use Drupal\Tests\UnitTestCase;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
+use Drupal\Core\Extension\ModuleHandlerInterface;
+use Drupal\Core\Path\PathValidatorInterface;
+use Drupal\Core\Routing\UrlGenerator;
 
 /**
  * @coversDefaultClass \Drupal\Core\Utility\LinkGenerator
@@ -70,13 +75,13 @@ class LinkGeneratorTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $this->urlGenerator = $this->getMockBuilder('\Drupal\Core\Routing\UrlGenerator')
+    $this->urlGenerator = $this->getMockBuilder(UrlGenerator::class)
       ->disableOriginalConstructor()
       ->getMock();
-    $this->moduleHandler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface');
-    $this->renderer = $this->getMock('\Drupal\Core\Render\RendererInterface');
+    $this->moduleHandler = $this->getMock(ModuleHandlerInterface::class);
+    $this->renderer = $this->getMock(RendererInterface::class);
     $this->linkGenerator = new LinkGenerator($this->urlGenerator, $this->moduleHandler, $this->renderer);
-    $this->urlAssembler = $this->getMock('\Drupal\Core\Utility\UnroutedUrlAssemblerInterface');
+    $this->urlAssembler = $this->getMock(UnroutedUrlAssemblerInterface::class);
   }
 
   /**
@@ -217,7 +222,7 @@ public function testGenerateUrlWithQuotes() {
       ->with('base:example', ['query' => ['foo' => '"bar"', 'zoo' => 'baz']] + $this->defaultOptions)
       ->willReturn((new GeneratedUrl())->setGeneratedUrl('/example?foo=%22bar%22&zoo=baz'));
 
-    $path_validator = $this->getMock('Drupal\Core\Path\PathValidatorInterface');
+    $path_validator = $this->getMock(PathValidatorInterface::class);
     $container_builder = new ContainerBuilder();
     $container_builder->set('path.validator', $path_validator);
     \Drupal::setContainer($container_builder);
diff --git a/core/tests/Drupal/Tests/Core/Utility/TokenTest.php b/core/tests/Drupal/Tests/Core/Utility/TokenTest.php
index 91620e6..ea6ddf9 100644
--- a/core/tests/Drupal/Tests/Core/Utility/TokenTest.php
+++ b/core/tests/Drupal/Tests/Core/Utility/TokenTest.php
@@ -3,12 +3,18 @@
 namespace Drupal\Tests\Core\Utility;
 
 use Drupal\Component\Utility\Html;
+use Drupal\Core\Cache\CacheBackendInterface;
+use Drupal\Core\Cache\CacheTagsInvalidatorInterface;
 use Drupal\Core\Cache\Context\CacheContextsManager;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
+use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Language\LanguageInterface;
+use Drupal\Core\Language\LanguageManagerInterface;
 use Drupal\Core\Render\BubbleableMetadata;
 use Drupal\Core\Render\Markup;
+use Drupal\Core\Render\RendererInterface;
 use Drupal\Core\Utility\Token;
+use Drupal\node\NodeInterface;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -77,17 +83,17 @@ class TokenTest extends UnitTestCase {
    * {@inheritdoc}
    */
   protected function setUp() {
-    $this->cache = $this->getMock('\Drupal\Core\Cache\CacheBackendInterface');
+    $this->cache = $this->getMock(CacheBackendInterface::class);
 
-    $this->languageManager = $this->getMock('Drupal\Core\Language\LanguageManagerInterface');
+    $this->languageManager = $this->getMock(LanguageManagerInterface::class);
 
-    $this->moduleHandler = $this->getMock('\Drupal\Core\Extension\ModuleHandlerInterface');
+    $this->moduleHandler = $this->getMock(ModuleHandlerInterface::class);
 
-    $this->language = $this->getMock('\Drupal\Core\Language\LanguageInterface');
+    $this->language = $this->getMock(LanguageInterface::class);
 
-    $this->cacheTagsInvalidator = $this->getMock('\Drupal\Core\Cache\CacheTagsInvalidatorInterface');
+    $this->cacheTagsInvalidator = $this->getMock(CacheTagsInvalidatorInterface::class);
 
-    $this->renderer = $this->getMock('Drupal\Core\Render\RendererInterface');
+    $this->renderer = $this->getMock(RendererInterface::class);
 
     $this->token = new Token($this->moduleHandler, $this->cache, $this->languageManager, $this->cacheTagsInvalidator, $this->renderer);
 
@@ -158,7 +164,7 @@ public function testReplaceWithBubbleableMetadataObject() {
     $bubbleable_metadata->setCacheContexts(['current_user']);
     $bubbleable_metadata->setCacheMaxAge(12);
 
-    $node = $this->prophesize('Drupal\node\NodeInterface');
+    $node = $this->prophesize(NodeInterface::class);
     $node->getCacheTags()->willReturn(['node:1']);
     $node->getCacheContexts()->willReturn(['custom_context']);
     $node->getCacheMaxAge()->willReturn(10);
@@ -190,7 +196,7 @@ public function testReplaceWithHookTokensWithBubbleableMetadata() {
         return ['[node:title]' => 'hello world'];
       });
 
-    $node = $this->prophesize('Drupal\node\NodeInterface');
+    $node = $this->prophesize(NodeInterface::class);
     $node->getCacheContexts()->willReturn([]);
     $node->getCacheTags()->willReturn([]);
     $node->getCacheMaxAge()->willReturn(14);
@@ -228,7 +234,7 @@ public function testReplaceWithHookTokensAlterWithBubbleableMetadata() {
         $bubbleable_metadata->setCacheMaxAge(10);
       });
 
-    $node = $this->prophesize('Drupal\node\NodeInterface');
+    $node = $this->prophesize(NodeInterface::class);
     $node->getCacheContexts()->willReturn([]);
     $node->getCacheTags()->willReturn([]);
     $node->getCacheMaxAge()->willReturn(14);
diff --git a/core/tests/Drupal/Tests/Core/Utility/UnroutedUrlAssemblerTest.php b/core/tests/Drupal/Tests/Core/Utility/UnroutedUrlAssemblerTest.php
index 01b16ad..de9b34d 100644
--- a/core/tests/Drupal/Tests/Core/Utility/UnroutedUrlAssemblerTest.php
+++ b/core/tests/Drupal/Tests/Core/Utility/UnroutedUrlAssemblerTest.php
@@ -3,6 +3,7 @@
 namespace Drupal\Tests\Core\Utility;
 
 use Drupal\Core\GeneratedUrl;
+use Drupal\Core\PathProcessor\OutboundPathProcessorInterface;
 use Drupal\Core\Render\BubbleableMetadata;
 use Drupal\Core\Utility\UnroutedUrlAssembler;
 use Drupal\Tests\UnitTestCase;
@@ -50,7 +51,7 @@ protected function setUp() {
     parent::setUp();
 
     $this->requestStack = new RequestStack();
-    $this->pathProcessor = $this->getMock('Drupal\Core\PathProcessor\OutboundPathProcessorInterface');
+    $this->pathProcessor = $this->getMock(OutboundPathProcessorInterface::class);
     $this->unroutedUrlAssembler = new UnroutedUrlAssembler($this->requestStack, $this->pathProcessor);
   }
 
