function StatusTest::testWarningElementCount
Same name in other branches
- 10 core/modules/system/tests/src/Functional/System/StatusTest.php \Drupal\Tests\system\Functional\System\StatusTest::testWarningElementCount()
Tests that the Warning counter matches the displayed number of warnings.
File
-
core/
modules/ system/ tests/ src/ Functional/ System/ StatusTest.php, line 229
Class
- StatusTest
- Tests output on the status overview page.
Namespace
Drupal\Tests\system\Functional\SystemCode
public function testWarningElementCount() : void {
// 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);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.