diff --git a/core/modules/search/tests/src/Kernel/SearchMatchTest.php b/core/modules/search/tests/src/Kernel/SearchMatchTest.php
index 5dd34e6f23407932b55f35db867d1d98a9504217..1469efa77adedc76babd584d940057068f0ee80a 100644
--- a/core/modules/search/tests/src/Kernel/SearchMatchTest.php
+++ b/core/modules/search/tests/src/Kernel/SearchMatchTest.php
@@ -5,12 +5,6 @@
 use Drupal\Core\Language\LanguageInterface;
 use Drupal\KernelTests\KernelTestBase;
 
-// The search index can contain different types of content. Typically the type
-// is 'node'. Here we test with _test_ and _test2_ as the type.
-const SEARCH_TYPE = '_test_';
-const SEARCH_TYPE_2 = '_test2_';
-const SEARCH_TYPE_JPN = '_test3_';
-
 /**
  * Indexes content and queries it.
  *
@@ -18,6 +12,12 @@
  */
 class SearchMatchTest extends KernelTestBase {
 
+  // The search index can contain different types of content. Typically the type
+  // is 'node'. Here we test with _test_ and _test2_ as the type.
+  const SEARCH_TYPE = '_test_';
+  const SEARCH_TYPE_2 = '_test2_';
+  const SEARCH_TYPE_JPN = '_test3_';
+
   /**
    * Modules to enable.
    *
@@ -49,10 +49,10 @@ function _setup() {
     $this->config('search.settings')->set('index.minimum_word_size', 3)->save();
 
     for ($i = 1; $i <= 7; ++$i) {
-      search_index(SEARCH_TYPE, $i, LanguageInterface::LANGCODE_NOT_SPECIFIED, $this->getText($i));
+      search_index(static::SEARCH_TYPE, $i, LanguageInterface::LANGCODE_NOT_SPECIFIED, $this->getText($i));
     }
     for ($i = 1; $i <= 5; ++$i) {
-      search_index(SEARCH_TYPE_2, $i + 7, LanguageInterface::LANGCODE_NOT_SPECIFIED, $this->getText2($i));
+      search_index(static::SEARCH_TYPE_2, $i + 7, LanguageInterface::LANGCODE_NOT_SPECIFIED, $this->getText2($i));
     }
     // No getText builder function for Japanese text; just a simple array.
     foreach (array(
@@ -60,7 +60,7 @@ function _setup() {
       14 => 'ドルーパルが大好きよ!',
       15 => 'コーヒーとケーキ',
     ) as $i => $jpn) {
-      search_index(SEARCH_TYPE_JPN, $i, LanguageInterface::LANGCODE_NOT_SPECIFIED, $jpn);
+      search_index(static::SEARCH_TYPE_JPN, $i, LanguageInterface::LANGCODE_NOT_SPECIFIED, $jpn);
     }
     search_update_totals();
   }
@@ -161,7 +161,7 @@ function _testQueries() {
     foreach ($queries as $query => $results) {
       $result = db_select('search_index', 'i')
         ->extend('Drupal\search\SearchQuery')
-        ->searchExpression($query, SEARCH_TYPE)
+        ->searchExpression($query, static::SEARCH_TYPE)
         ->execute();
 
       $set = $result ? $result->fetchAll() : array();
@@ -181,7 +181,7 @@ function _testQueries() {
     foreach ($queries as $query => $results) {
       $result = db_select('search_index', 'i')
         ->extend('Drupal\search\SearchQuery')
-        ->searchExpression($query, SEARCH_TYPE_2)
+        ->searchExpression($query, static::SEARCH_TYPE_2)
         ->execute();
 
       $set = $result ? $result->fetchAll() : array();
@@ -204,7 +204,7 @@ function _testQueries() {
     foreach ($queries as $query => $results) {
       $result = db_select('search_index', 'i')
         ->extend('Drupal\search\SearchQuery')
-        ->searchExpression($query, SEARCH_TYPE_JPN)
+        ->searchExpression($query, static::SEARCH_TYPE_JPN)
         ->execute();
 
       $set = $result ? $result->fetchAll() : array();