Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / rest / tests / src / Functional / EntityResource / EntityResourceRestTestCoverageTest.php
index 6421472067e05f52e73f2d9b6b8a02fef175c629..1c3523ffe055a048b7e006d6d3bae6340ce9a37a 100644 (file)
@@ -57,12 +57,10 @@ class EntityResourceRestTestCoverageTest extends BrowserTestBase {
    * Tests that all core content/config entity types have REST test coverage.
    */
   public function testEntityTypeRestTestCoverage() {
-    $default_test_locations = [
+    $tests = [
       // Test coverage for formats provided by the 'serialization' module.
       'serialization' => [
-        'possible paths' => [
-          '\Drupal\Tests\rest\Functional\EntityResource\CLASS\CLASS',
-        ],
+        'path' => '\Drupal\Tests\PROVIDER\Functional\Rest\CLASS',
         'class suffix' => [
           'JsonAnonTest',
           'JsonBasicAuthTest',
@@ -74,9 +72,7 @@ class EntityResourceRestTestCoverageTest extends BrowserTestBase {
       ],
       // Test coverage for formats provided by the 'hal' module.
       'hal' => [
-        'possible paths' => [
-          '\Drupal\Tests\hal\Functional\EntityResource\CLASS\CLASS',
-        ],
+        'path' => '\Drupal\Tests\PROVIDER\Functional\Hal\CLASS',
         'class suffix' => [
           'HalJsonAnonTest',
           'HalJsonBasicAuthTest',
@@ -92,21 +88,14 @@ class EntityResourceRestTestCoverageTest extends BrowserTestBase {
       $class_name = end($parts);
       $module_name = $parts[1];
 
-      // The test class can live either in the REST/HAL module, or in the module
-      // providing the entity type.
-      $tests = $default_test_locations;
-      $tests['serialization']['possible paths'][] = '\Drupal\Tests\\' . $module_name . '\Functional\Rest\CLASS';
-      $tests['hal']['possible paths'][] = '\Drupal\Tests\\' . $module_name . '\Functional\Hal\CLASS';
-
       foreach ($tests as $module => $info) {
-        $possible_paths = $info['possible paths'];
+        $path = $info['path'];
         $missing_tests = [];
         foreach ($info['class suffix'] as $postfix) {
-          foreach ($possible_paths as $path) {
-            $class = str_replace('CLASS', $class_name, $path . $postfix);
-            if (class_exists($class)) {
-              continue 2;
-            }
+          $class = str_replace(['PROVIDER', 'CLASS'], [$module_name, $class_name], $path . $postfix);
+          $class_alternative = str_replace("\\Drupal\\Tests\\$module_name\\Functional", '\Drupal\FunctionalTests', $class);
+          if (class_exists($class) || class_exists($class_alternative)) {
+            continue;
           }
           $missing_tests[] = $postfix;
         }