public function CronFrequencyTest::testSupportedPhpVersion in Automatic Updates 8
Tests the functionality of supported PHP version readiness checks.
File
- tests/
src/ Kernel/ ReadinessChecker/ CronFrequencyTest.php, line 26
Class
- CronFrequencyTest
- Tests what happens when cron has frequency of greater than 3 hours.
Namespace
Drupal\Tests\automatic_updates\Kernel\ReadinessCheckerCode
public function testSupportedPhpVersion() {
// Module automated_cron is disabled.
$messages = $this->container
->get('automatic_updates.cron_frequency')
->run();
$this
->assertEmpty($messages);
// Module automated_cron has default configuration.
$this
->enableModules([
'automated_cron',
]);
$messages = $this->container
->get('automatic_updates.cron_frequency')
->run();
$this
->assertEmpty($messages);
// Module automated_cron has 6 hour configuration.
$this->container
->get('config.factory')
->getEditable('automated_cron.settings')
->set('interval', 21600)
->save();
$messages = $this->container
->get('automatic_updates.cron_frequency')
->run();
self::assertEquals('Cron is not set to run frequently enough. <a href="/admin/config/system/cron">Configure it</a> to run at least every 3 hours or disable automated cron and run it via an external scheduling system.', $messages[0]);
}