PendingUpdatesValidatorTest.php in Automatic Updates 8.2
File
tests/src/Kernel/ReadinessValidation/PendingUpdatesValidatorTest.php
View source
<?php
namespace Drupal\Tests\automatic_updates\Kernel\ReadinessValidation;
use Drupal\automatic_updates\Validation\ValidationResult;
use Drupal\Tests\automatic_updates\Kernel\AutomaticUpdatesKernelTestBase;
class PendingUpdatesValidatorTest extends AutomaticUpdatesKernelTestBase {
protected static $modules = [
'automatic_updates',
'package_manager',
];
public function testNoPendingUpdates() : void {
$this
->assertCheckerResultsFromManager([], TRUE);
}
public function testPendingUpdateHook() : void {
require __DIR__ . '/../../../fixtures/db_update.php';
$this->container
->get('keyvalue')
->get('system.schema')
->set('automatic_updates', \Drupal::CORE_MINIMUM_SCHEMA_VERSION);
$result = ValidationResult::createError([
'Some modules have database schema updates to install. You should run the <a href="/update.php">database update script</a> immediately.',
]);
$this
->assertCheckerResultsFromManager([
$result,
], TRUE);
}
public function testPendingPostUpdate() : void {
require __DIR__ . '/../../../fixtures/post_update.php';
$result = ValidationResult::createError([
'Some modules have database schema updates to install. You should run the <a href="/update.php">database update script</a> immediately.',
]);
$this
->assertCheckerResultsFromManager([
$result,
], TRUE);
}
}