Skip to content
Snippets Groups Projects
Unverified Commit 2d6ae27e authored by Lauri Timmanee's avatar Lauri Timmanee
Browse files

Issue #2869868 by AaronBauman, immaculatexavier, smustgrave: Requirements...

Issue #2869868 by AaronBauman, immaculatexavier, smustgrave: Requirements errors in "General System Information" are not visually apparent
parent b97fb783
No related branches found
No related tags found
Loading
......@@ -59,7 +59,9 @@ public static function preRenderGeneralInfo($element) {
case 'php_memory_limit':
$element['#general_info']['#' . $key] = $requirement;
if (isset($requirement['severity']) && $requirement['severity'] < REQUIREMENT_WARNING) {
unset($element['#requirements'][$key]);
if (empty($requirement['severity']) || $requirement['severity'] == REQUIREMENT_OK) {
unset($element['#requirements'][$key]);
}
}
break;
}
......
......@@ -4,6 +4,7 @@
use Drupal\Core\Url;
use Drupal\Tests\BrowserTestBase;
use Drupal\Core\StringTranslation\PluralTranslatableMarkup;
/**
* Tests output on the status overview page.
......@@ -92,7 +93,7 @@ public function testStatusPage() {
$this->drupalGet('admin/reports/status/php');
$this->assertSession()->statusCodeEquals(200);
// Check if cron error is displayed in errors section
// Check if cron error is displayed in errors section.
$cron_last_run = \Drupal::state()->get('system.cron_last');
\Drupal::state()->set('system.cron_last', 0);
$this->drupalGet('admin/reports/status');
......@@ -175,4 +176,44 @@ public function testStatusPage() {
}
}
/**
* Tests that the Error counter matches the displayed number of errors.
*/
public function testErrorElementCount() {
// Trigger "cron has not run recently" error:
$cron_config = \Drupal::config('system.cron');
$time = \Drupal::time()->getRequestTime();
\Drupal::state()->set('install_time', $time);
$threshold_error = $cron_config->get('threshold.requirements_error');
\Drupal::state()->set('system.cron_last', $time - $threshold_error - 1);
$this->drupalGet('admin/reports/status');
$error_elements = $this->cssSelect('.system-status-report__status-icon--error');
$this->assertNotEquals(count($error_elements), 0, 'Errors are listed on the page.');
$expected_text = new PluralTranslatableMarkup(count($error_elements), 'Error', 'Errors');
$expected_text = count($error_elements) . ' ' . $expected_text;
$this->assertSession()->responseContains((string) $expected_text);
}
/**
* Tests that the Warning counter matches the displayed number of warnings.
*/
public function testWarningElementCount() {
// Trigger "cron has not run recently" with warning threshold:
$cron_config = \Drupal::config('system.cron');
$time = \Drupal::time()->getRequestTime();
\Drupal::state()->set('install_time', $time);
$threshold_warning = $cron_config->get('threshold.requirements_warning');
\Drupal::state()->set('system.cron_last', $time - $threshold_warning - 1);
$this->drupalGet('admin/reports/status');
$warning_elements = $this->cssSelect('.system-status-report__status-icon--warning');
$this->assertNotEquals(count($warning_elements), 0, 'Warnings are listed on the page.');
$expected_text = new PluralTranslatableMarkup(count($warning_elements), 'Warning', 'Warnings');
$expected_text = count($warning_elements) . ' ' . $expected_text;
$this->assertSession()->responseContains((string) $expected_text);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment