diff --git a/core/modules/system/tests/modules/twig_loader_test/src/Loader/TestLoader.php b/core/modules/system/tests/modules/twig_loader_test/src/Loader/TestLoader.php
index e9a05b0ad2f2fa3bea8130adf9f0792f643f0e02..bd23809e26a81cca55abe9d12d8ae1029842286d 100644
--- a/core/modules/system/tests/modules/twig_loader_test/src/Loader/TestLoader.php
+++ b/core/modules/system/tests/modules/twig_loader_test/src/Loader/TestLoader.php
@@ -14,7 +14,7 @@ class TestLoader implements \Twig_LoaderInterface, \Twig_ExistsLoaderInterface,
    */
   public function getSourceContext($name) {
     $name = (string) $name;
-    $value = $name === 'kittens' ? 'kittens' : 'cats';
+    $value = $this->getSource($name);
     return new Source($value, $name);
   }
 
@@ -22,7 +22,12 @@ public function getSourceContext($name) {
    * {@inheritdoc}
    */
   public function getSource($name) {
-    return $this->getSourceContext($name)->getCode();
+    if ($name == 'kittens') {
+      return $name;
+    }
+    else {
+      return 'cats';
+    }
   }
 
   /**