diff --git a/core/modules/system/tests/modules/theme_test/templates/theme-test-foo.html.twig b/core/modules/system/tests/modules/theme_test/templates/theme-test-foo.html.twig
new file mode 100644
index 0000000..5721304
--- /dev/null
+++ b/core/modules/system/tests/modules/theme_test/templates/theme-test-foo.html.twig
@@ -0,0 +1,14 @@
+{#
+/**
+ * @file
+ * Default theme implementation for the 'theme_test_foo' theme hook.
+ *
+ * Available variables:
+ * - foo: Dummy text to display.
+ *
+ * @see template_preprocess()
+ *
+ * @ingroup themeable
+ */
+#}
+{{ foo -}}
diff --git a/core/modules/system/tests/modules/theme_test/templates/theme-test.html.twig b/core/modules/system/tests/modules/theme_test/templates/theme-test.html.twig
new file mode 100644
index 0000000..c5c9b8d
--- /dev/null
+++ b/core/modules/system/tests/modules/theme_test/templates/theme-test.html.twig
@@ -0,0 +1,15 @@
+{#
+/**
+ * @file
+ * Default theme implementation for the 'theme_test' theme hook.
+ *
+ * Available variables:
+ * - foo: Dummy text to display.
+ *
+ * @see template_preprocess()
+ * @see template_preprocess_theme_test()
+ *
+ * @ingroup themeable
+ */
+#}
+Theme hook implementor=theme_theme_test(). Foo={{ foo }}
diff --git a/core/modules/system/tests/modules/theme_test/theme_test.inc b/core/modules/system/tests/modules/theme_test/theme_test.inc
index 6cde683..99043fe 100644
--- a/core/modules/system/tests/modules/theme_test/theme_test.inc
+++ b/core/modules/system/tests/modules/theme_test/theme_test.inc
@@ -1,14 +1,13 @@
 <?php
 
 /**
- * Returns HTML for the 'theme_test' theme hook used by tests.
- */
-function theme_theme_test($variables) {
-  return 'Theme hook implementor=theme_theme_test(). Foo=' . $variables['foo'];
-}
-
-/**
- * Preprocesses variables for theme_theme_test().
+ * Prepares variables for theme test templates.
+ *
+ * Default template: theme-test.html.twig.
+ *
+ * @param array $variables
+ *   An associative array containing:
+ *   - foo: Dummy text to display.
  */
 function template_preprocess_theme_test(&$variables) {
   $variables['foo'] = 'template_preprocess_theme_test';
diff --git a/core/modules/system/tests/modules/theme_test/theme_test.module b/core/modules/system/tests/modules/theme_test/theme_test.module
index 137fdfc..07bc084 100644
--- a/core/modules/system/tests/modules/theme_test/theme_test.module
+++ b/core/modules/system/tests/modules/theme_test/theme_test.module
@@ -7,6 +7,7 @@ function theme_test_theme($existing, $type, $theme, $path) {
   $items['theme_test'] = array(
     'file' => 'theme_test.inc',
     'variables' => array('foo' => ''),
+    'template' => 'theme-test',
   );
   $items['theme_test_template_test'] = array(
     'template' => 'theme_test.template_test',
@@ -16,6 +17,7 @@ function theme_test_theme($existing, $type, $theme, $path) {
   );
   $items['theme_test_foo'] = array(
     'variables' => array('foo' => NULL),
+    'template' => 'theme-test-foo',
   );
   return $items;
 }
@@ -164,11 +166,3 @@ function theme_test_preprocess_html(&$variables) {
   $variables['html_attributes']['theme_test_html_attribute'] = 'theme test html attribute value';
   $variables['attributes']['theme_test_body_attribute'] = 'theme test body attribute value';
 }
-
-/**
- * Theme function for testing theme('theme_test_foo').
- */
-function theme_theme_test_foo($variables) {
-  return $variables['foo'];
-}
-
