diff --git a/core/tests/Drupal/Tests/Core/Block/BlockBaseTest.php b/core/tests/Drupal/Tests/Core/Block/BlockBaseTest.php
index 2b9cd98b84..f0c329aebc 100644
--- a/core/tests/Drupal/Tests/Core/Block/BlockBaseTest.php
+++ b/core/tests/Drupal/Tests/Core/Block/BlockBaseTest.php
@@ -40,6 +40,46 @@ public function testGetMachineNameSuggestion($label, $expected) {
     $this->assertEquals($expected, $block_base->getMachineNameSuggestion());
   }
 
+  /**
+   * Tests the machine name suggestion when no label is available.
+   *
+   * @see \Drupal\Core\Block\BlockBase::getMachineNameSuggestion()
+   */
+  public function testGetMachineNameSuggestionEmptyLabel() {
+    $previous_error_handler = set_error_handler(function ($severity, $message, $file, $line) use (&$previous_error_handler) {
+      // Convert deprecation error into a catchable exception.
+      if ($severity === E_DEPRECATED) {
+        throw new \ErrorException($message, 0, $severity, $file, $line);
+      }
+      if ($previous_error_handler) {
+        return $previous_error_handler($severity, $message, $file, $line);
+      }
+    });
+
+    $module_handler = $this->createMock('Drupal\Core\Extension\ModuleHandlerInterface');
+    $transliteration = $this->getMockBuilder('Drupal\Core\Transliteration\PhpTransliteration')
+      ->setConstructorArgs([NULL, $module_handler])
+      ->onlyMethods(['readLanguageOverrides'])
+      ->getMock();
+
+    $config = [];
+    $definition = [
+      'admin_label' => NULL,
+      'provider' => 'block_test',
+    ];
+    $block_base = new TestBlockInstantiation($config, 'test_block_instantiation', $definition);
+    $block_base->setTransliteration($transliteration);
+
+    try {
+      $this->assertEquals(NULL, $block_base->getMachineNameSuggestion());
+    }
+    catch (\ErrorException $e) {
+      $this->fail('Exception thrown when no label provided.');
+    }
+
+    restore_error_handler();
+  }
+
   /**
    * Provides data for testGetMachineNameSuggestion().
    */
@@ -47,6 +87,7 @@ public function providerTestGetMachineNameSuggestion() {
     return [
       ['Admin label', 'adminlabel'],
       ['über åwesome', 'uberawesome'],
+      [NULL, NULL]
     ];
   }
 
