PendingDbUpdatesTest.php in Automatic Updates 8
File
tests/src/Kernel/ReadinessChecker/PendingDbUpdatesTest.php
View source
<?php
namespace Drupal\Tests\automatic_updates\Kernel\ReadinessChecker;
use Drupal\automatic_updates\ReadinessChecker\PendingDbUpdates;
use Drupal\KernelTests\KernelTestBase;
class PendingDbUpdatesTest extends KernelTestBase {
public static $modules = [
'automatic_updates',
];
public function testPendingDbUpdates() {
$messages = $this->container
->get('automatic_updates.pending_db_updates')
->run();
$this
->assertEmpty($messages);
$messages = (new TestPendingDbUpdates())
->run();
self::assertEquals('There are pending database updates. Please run update.php.', $messages[0]);
}
}
class TestPendingDbUpdates extends PendingDbUpdates {
public function __construct() {
}
protected function areDbUpdatesPending() {
return TRUE;
}
}