View source
<?php
namespace Drupal\Tests\automatic_updates\Kernel\ReadinessChecker;
use Drupal\KernelTests\KernelTestBase;
class OpcodeCacheTest extends KernelTestBase {
public static $modules = [
'automatic_updates',
];
public function testOpcodeCache($ini, $ini_value, $failure) {
ini_set($ini, $ini_value);
$messages = $this->container
->get('automatic_updates.opcode_cache')
->run();
if ($failure) {
$this
->assertNotEmpty($messages);
self::assertEquals((string) $messages[0], 'Automatic updates cannot run via CLI when opcode file cache is enabled.');
}
else {
$this
->assertEmpty($messages);
}
}
public function opcodeCacheProvider() {
$datum[] = [
'ini' => 'opcache.validate_timestamps',
'ini_value' => 0,
'failure' => TRUE,
];
$datum[] = [
'ini' => 'opcache.validate_timestamps',
'ini_value' => 1,
'failure' => FALSE,
];
$datum[] = [
'ini' => 'opcache.validate_timestamps',
'ini_value' => FALSE,
'failure' => TRUE,
];
$datum[] = [
'ini' => 'opcache.validate_timestamps',
'ini_value' => TRUE,
'failure' => FALSE,
];
$datum[] = [
'ini' => 'opcache.validate_timestamps',
'ini_value' => 2,
'failure' => FALSE,
];
$datum[] = [
'ini' => 'opcache.revalidate_freq',
'ini_value' => 3,
'failure' => TRUE,
];
$datum[] = [
'ini' => 'opcache.revalidate_freq',
'ini_value' => 2,
'failure' => FALSE,
];
return $datum;
}
}