X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Frest%2Ftests%2Fsrc%2FFunctional%2FEntityResource%2FEntityResourceRestTestCoverageTest.php;fp=web%2Fcore%2Fmodules%2Frest%2Ftests%2Fsrc%2FFunctional%2FEntityResource%2FEntityResourceRestTestCoverageTest.php;h=1c3523ffe055a048b7e006d6d3bae6340ce9a37a;hp=6421472067e05f52e73f2d9b6b8a02fef175c629;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hpb=74df008bdbb3a11eeea356744f39b802369bda3c diff --git a/web/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceRestTestCoverageTest.php b/web/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceRestTestCoverageTest.php index 642147206..1c3523ffe 100644 --- a/web/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceRestTestCoverageTest.php +++ b/web/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceRestTestCoverageTest.php @@ -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; }