diff --git a/core/modules/simpletest/src/TestDiscovery.php b/core/modules/simpletest/src/TestDiscovery.php
index 132694607c..99c702d17d 100644
--- a/core/modules/simpletest/src/TestDiscovery.php
+++ b/core/modules/simpletest/src/TestDiscovery.php
@@ -270,9 +270,6 @@ public function findAllClassFiles($extension = NULL) {
    *
    * @throws \InvalidArgumentException
    *   If $namespace_prefix does not end in a namespace separator (backslash).
-   *
-   * @todo Limit to '*Test.php' files (~10% less files to reflect/introspect).
-   * @see https://www.drupal.org/node/2296635
    */
   public static function scanDirectory($namespace_prefix, $path) {
     if (substr($namespace_prefix, -1) !== '\\') {
@@ -288,7 +285,10 @@ public static function scanDirectory($namespace_prefix, $path) {
       if ($iterator->hasChildren()) {
         return TRUE;
       }
-      return $current->isFile() && $current->getExtension() === 'php';
+      if ($current->isFile() && $current->getExtension() === 'php') {
+        return strpos($current->getFilename(), 'Test.php') !== FALSE;
+      }
+      return FALSE;
     });
     $files = new \RecursiveIteratorIterator($filter);
     $classes = [];
diff --git a/core/modules/simpletest/tests/src/Unit/TestDiscoveryTest.php b/core/modules/simpletest/tests/src/Unit/TestDiscoveryTest.php
index 625297e439..92f1134ffd 100644
--- a/core/modules/simpletest/tests/src/Unit/TestDiscoveryTest.php
+++ b/core/modules/simpletest/tests/src/Unit/TestDiscoveryTest.php
@@ -277,10 +277,10 @@ class FunctionalExampleTest {}
             'src' => [
               'Functional' => [
                 'FunctionalExampleTest.php' => $test_file,
-                'FunctionalExampleTest2.php' => str_replace(['FunctionalExampleTest', '@group example'], ['FunctionalExampleTest2', '@group example2'], $test_file),
+                'FunctionalExample2Test.php' => str_replace(['FunctionalExampleTest', '@group example'], ['FunctionalExample2Test', '@group example2'], $test_file),
               ],
               'Kernel' => [
-                'KernelExampleTest3.php' => str_replace(['FunctionalExampleTest', '@group example'], ['KernelExampleTest3', '@group example2'], $test_file),
+                'KernelExample3Test.php' => str_replace(['FunctionalExampleTest', '@group example'], ['KernelExample3Test', '@group example2'], $test_file),
               ],
             ],
           ],
@@ -315,14 +315,14 @@ public function testGetTestClasses() {
         ],
       ],
       'example2' => [
-        'Drupal\Tests\test_module\Functional\FunctionalExampleTest2' => [
-          'name' => 'Drupal\Tests\test_module\Functional\FunctionalExampleTest2',
+        'Drupal\Tests\test_module\Functional\FunctionalExample2Test' => [
+          'name' => 'Drupal\Tests\test_module\Functional\FunctionalExample2Test',
           'description' => 'Test description',
           'group' => 'example2',
           'type' => 'PHPUnit-Functional',
         ],
-        'Drupal\Tests\test_module\Kernel\KernelExampleTest3' => [
-          'name' => 'Drupal\Tests\test_module\Kernel\KernelExampleTest3',
+        'Drupal\Tests\test_module\Kernel\KernelExample3Test' => [
+          'name' => 'Drupal\Tests\test_module\Kernel\KernelExample3Test',
           'description' => 'Test description',
           'group' => 'example2',
           'type' => 'PHPUnit-Kernel',
@@ -350,8 +350,8 @@ public function testGetTestClassesWithSelectedTypes() {
     $this->assertEquals([
       'example' => [],
       'example2' => [
-        'Drupal\Tests\test_module\Kernel\KernelExampleTest3' => [
-          'name' => 'Drupal\Tests\test_module\Kernel\KernelExampleTest3',
+        'Drupal\Tests\test_module\Kernel\KernelExample3Test' => [
+          'name' => 'Drupal\Tests\test_module\Kernel\KernelExample3Test',
           'description' => 'Test description',
           'group' => 'example2',
           'type' => 'PHPUnit-Kernel',
diff --git a/core/modules/simpletest/tests/src/Functional/TestDiscoveryTest.php b/core/modules/simpletest/tests/src/Functional/TestDiscoveryTest.php
new file mode 100644
index 0000000000..6c5dd35cd2
--- /dev/null
+++ b/core/modules/simpletest/tests/src/Functional/TestDiscoveryTest.php
@@ -0,0 +1,27 @@
+<?php
+
+namespace Drupal\Tests\simpletest\Functional;
+
+use Drupal\Tests\BrowserTestBase;
+
+/**
+ * Tests TestDiscovery.
+ *
+ * @group simpletest
+ */
+class TestDiscoveryTest extends BrowserTestBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public static $modules = ['simpletest'];
+
+  /**
+   * Tests get list tests without deprecated fails.
+   */
+  public function testGetTestClasses() {
+    $this->drupalLogin($this->drupalCreateUser(['administer unit tests']));
+    $this->drupalGet('admin/config/development/testing');
+  }
+
+}
diff --git a/core/modules/simpletest/tests/src/Traits/TestTraitDeprecationTrait.php b/core/modules/simpletest/tests/src/Traits/TestTraitDeprecationTrait.php
new file mode 100644
index 0000000000..e47209e092
--- /dev/null
+++ b/core/modules/simpletest/tests/src/Traits/TestTraitDeprecationTrait.php
@@ -0,0 +1,13 @@
+<?php
+
+namespace Drupal\Tests\simpletest\Traits;
+
+@trigger_error('Do not use me. And do not remove me. Thanks!', E_USER_DEPRECATED);
+
+/**
+ * Provides dummy deprecated trait for check unexpected deprecated error.
+ *
+ * @deprecated for tests deprecated trigger_error.
+ */
+trait TestTraitDeprecationTrait {
+}
