summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLee Rowlands <lee.rowlands@previousnext.com.au>2022-05-11 10:22:16 +1000
committerLee Rowlands <lee.rowlands@previousnext.com.au>2022-05-11 10:22:36 +1000
commit2247be97079854e94eaa69b2b5ce1e8b4f85e8d1 (patch)
tree353d9ffa4679f819e800d86f255cb9c0edf2ea90
parentfa0f6dddfbd5f210cfb5138ca252713733c070ab (diff)
downloaddrupal-2247be97079854e94eaa69b2b5ce1e8b4f85e8d1.tar.gz
drupal-2247be97079854e94eaa69b2b5ce1e8b4f85e8d1.zip
Issue #3279788 by alexpott: PHP 7.3 testing on Drupal 9.4.x and 9.5.x is broken due to \Drupal\Tests\RequirementsPageTrait::assertRequirementSummaries() assuming Seven is the update.php theme
(cherry picked from commit 23e599bae440579a54dfbd8529737719aca0bd28)
-rw-r--r--core/tests/Drupal/Tests/RequirementsPageTrait.php40
1 files changed, 26 insertions, 14 deletions
diff --git a/core/tests/Drupal/Tests/RequirementsPageTrait.php b/core/tests/Drupal/Tests/RequirementsPageTrait.php
index 91ef8b2f011d..eef29535db27 100644
--- a/core/tests/Drupal/Tests/RequirementsPageTrait.php
+++ b/core/tests/Drupal/Tests/RequirementsPageTrait.php
@@ -79,21 +79,33 @@ trait RequirementsPageTrait {
* The type of requirement, either 'warning' or 'error'.
*/
protected function assertRequirementSummaries(array $summaries, string $type) {
- // Allow only details elements that are directly after the warning/error
- // header or each other. There is no guaranteed wrapper we can rely on
- // across distributions. When there are multiple warnings, the selectors
- // will be:
- // - h3#warning+details summary
- // - h3#warning+details+details summary
- // - etc.
- // For errors, the selectors are the same except that they are h3#error.
- // We add one more selector than expected requirements to confirm that
- // there isn't any other requirement message before clicking the link.
- // @todo Make this more reliable in
- // https://www.drupal.org/project/drupal/issues/2927345.
+ // The selectors are different for Seven and Claro.
+ $is_claro = stripos($this->getSession()->getPage()->getContent(), 'claro/css/theme/maintenance-page.css') !== FALSE;
+
$selectors = [];
- for ($i = 0; $i <= count($summaries); $i++) {
- $selectors[] = 'h3#' . $type . implode('', array_fill(0, $i + 1, '+details')) . ' summary';
+ if ($is_claro) {
+ // In Claro each requirement heading is present in a div with the class
+ // system-status-report__status-title. There is one summary element per
+ // requirement type and it is adjacent to a div with the class
+ // claro-details__wrapper.
+ $selectors[] = 'summary#' . $type . '+.claro-details__wrapper .system-status-report__status-title';
+ }
+ else {
+ // Allow only details elements that are directly after the warning/error
+ // header or each other. There is no guaranteed wrapper we can rely on
+ // across distributions. When there are multiple warnings, the selectors
+ // will be:
+ // - h3#warning+details summary
+ // - h3#warning+details+details summary
+ // - etc.
+ // For errors, the selectors are the same except that they are h3#error.
+ // We add one more selector than expected requirements to confirm that
+ // there isn't any other requirement message before clicking the link.
+ // @todo Make this more reliable in
+ // https://www.drupal.org/project/drupal/issues/2927345.
+ for ($i = 0; $i <= count($summaries); $i++) {
+ $selectors[] = 'h3#' . $type . implode('', array_fill(0, $i + 1, '+details')) . ' summary';
+ }
}
$elements = $this->cssSelect(implode(', ', $selectors));