Results
14.07.2020
automatic_updates 8.x-2.x-dev ::
automatic_updates_extensions/src/Form/UpdateReady.php
* Form classes are internal and should not be used by external code.
*/
final class UpdateReady extends UpdateFormBase {
public function __construct(
private readonly ExtensionUpdateSandboxManager $sandboxManager,
MessengerInterface $messenger,
private readonly StateInterface $state,
private readonly ModuleExtensionList $moduleList, 14.07.2020
automatic_updates 8.x-2.x-dev ::
automatic_updates_extensions/automatic_updates_extensions.routing.yml
path: '/admin/automatic-update-extensions-ready/{stage_id}'
defaults:
_form: '\Drupal\automatic_updates_extensions\Form\UpdateReady'
_title: 'Ready to update'
requirements:
_permission: 'administer software updates'
options:
_admin_route: TRUE
_maintenance_access: TRUE 14.07.2020
automatic_updates 8.x-2.x-dev ::
src/Form/UpdateReady.php
* Form classes are internal and the form structure may change at any time.
*/
final class UpdateReady extends UpdateFormBase {
public function __construct(
private readonly UpdateSandboxManager $sandboxManager,
private readonly StateInterface $state,
private readonly RendererInterface $renderer,
private readonly EventDispatcherInterface $eventDispatcher, 14.07.2020
automatic_updates 8.x-2.x-dev ::
src/BatchProcessor.php
* https://www.drupal.org/i/3267817.
*
* @see \Drupal\update\Form\UpdateReady::submitForm()
* @see automatic_updates_batch_alter()
*/
public static function dbUpdateBatchFinished(bool $success, array $results, array $operations): void {
// Run status checks after database updates are completed to ensure that
// PendingUpdatesValidator does not report any errors.
// @see \Drupal\package_manager\Validator\PendingUpdatesValidator 14.07.2020
automatic_updates 8.x-2.x-dev ::
tests/src/Build/CoreUpdateTest.php
$page = $session->getPage();
$assert_session = $mink->assertSession();
$this->coreUpdateTillUpdateReady($page);
$page->pressButton('Continue');
$this->waitForBatchJob();
$assert_session->addressEquals('/admin/reports/updates');
$assert_session->pageTextContains('Update complete!');
$assert_session->pageTextContains('Up to date');
$assert_session->pageTextNotContains('There is a security update available for your version of Drupal.');
$page = $session->getPage();
$assert_session = $mink->assertSession();
$this->coreUpdateTillUpdateReady($page);
$this->visit('/admin/reports/status');
$assert_session->pageTextContains('Your site is ready for automatic updates.');
$page->clickLink('Run cron');
// The stage will first destroy the stage made above before going through
// stage lifecycle events for the cron update.
$expected_events = [
* The page element.
*/
private function coreUpdateTillUpdateReady(DocumentElement $page): void {
$session = $this->getMink()->getSession();
$this->visit('/admin/modules');
$assert_session = $this->getMink()->assertSession($session);
$assert_session->pageTextContains('There is a security update available for your version of Drupal.');
$page->clickLink('Update'); 14.07.2020
automatic_updates 8.x-2.x-dev ::
tests/src/Functional/StagedDatabaseUpdateTest.php
$this->checkForMetaRefresh();
$this->assertUpdateStagedTimes(1);
$this->assertUpdateReady('9.8.1');
// Simulate a staged database update in the automatic_updates_test module.
// We must do this after the update has started, because the pending updates
// validator will prevent an update from starting.
$state->set('automatic_updates_test.new_update', TRUE);
// The warning from the updater form should be repeated, and we should see
// a warning about pending database updates. Once the staged changes have 14.07.2020
automatic_updates 8.x-2.x-dev ::
tests/src/Functional/AutomaticUpdatesFunctionalTestBase.php
* The target version of Drupal core.
*/
protected function assertUpdateReady(string $target_version): void {
$assert_session = $this->assertSession();
$assert_session->addressMatches('/\/admin\/automatic-update-ready\/[a-zA-Z0-9_\-]+$/');
$assert_session->pageTextContainsOnce('Drupal core will be updated to ' . $target_version);
$button = $assert_session->buttonExists("Continue");
$this->assertTrue($button->hasClass('button--primary'));
} 14.07.2020
automatic_updates 8.x-2.x-dev ::
tests/src/Functional/StatusCheckTest.php
$page->pressButton('Update to 9.8.1');
$this->checkForMetaRefresh();
$this->assertUpdateReady('9.8.1');
$page->pressButton('Continue');
$this->checkForMetaRefresh();
$assert_session->pageTextContains('Update complete!');
// The warning should not be visible anymore.
$this->drupalGet('/admin/structure'); 14.07.2020
automatic_updates 8.x-2.x-dev ::
tests/src/Functional/UpdateFailedTest.php
$this->checkForMetaRefresh();
$this->assertUpdateStagedTimes(1);
$this->assertUpdateReady('9.8.1');
// Confirm if the staged directory is deleted without using destroy(), then
// an error message will be displayed on the page.
// @see \Drupal\package_manager\Stage::getStagingRoot()
/** @var \Drupal\Core\File\FileSystemInterface $file_system */
$file_system = $this->container->get('file_system');
$dir = $file_system->getTempDirectory() . '/.package_manager' . $this->config('system.site')->get('uuid'); 14.07.2020
automatic_updates 8.x-2.x-dev ::
tests/src/Functional/ErrorMessageOnStageDestroyTest.php
$page->pressButton('Update to 9.8.1');
$this->checkForMetaRefresh();
$this->assertUpdateReady('9.8.1');
$sandbox_manager = $this->container->get(UpdateSandboxManager::class);
$random_message = $this->randomString();
// @see \Drupal\Tests\package_manager\Kernel\StageTest::testStoreDestroyInfo()
// @see \Drupal\automatic_updates\CronUpdateRunner::performUpdate()
$sandbox_manager->destroy(TRUE, t($random_message));
$this->checkForMetaRefresh(); 14.07.2020
automatic_updates 8.x-2.x-dev ::
tests/src/Functional/SuccessfulUpdateTest.php
$this->checkForMetaRefresh();
$this->assertUpdateStagedTimes(1);
$this->assertUpdateReady('9.8.1');
// Confirm that the site was put into maintenance mode if needed.
$this->assertMaintenanceMode($maintenance_mode_on);
$page->pressButton('Continue');
$this->checkForMetaRefresh();
$assert_session->addressEquals('/admin/reports/updates');
$assert_session->pageTextNotContains($cached_message->render()); 14.07.2020
automatic_updates 8.x-2.x-dev ::
tests/src/Functional/UpdateLockTest.php
$page->pressButton('Update');
$this->checkForMetaRefresh();
$this->assertUpdateReady('9.8.2');
$assert_session->buttonExists('Continue');
$url = $this->getSession()->getCurrentUrl();
// Another user cannot show up and try to start an update, since the other
// user already started one.
$this->drupalLogin($user_2); 14.07.2020
automatic_updates 8.x-2.x-dev ::
tests/src/Functional/StatusCheckerRunAfterUpdateTest.php
$this->checkForMetaRefresh();
$this->assertUpdateStagedTimes(1);
$this->assertUpdateReady('9.8.1');
// Set an error before completing the update. This error should be visible
// on admin pages after completing the update without having to explicitly
// run the status checks.
TestSubscriber1::setTestResult([ValidationResult::createError([t('Error before continue.')])], StatusCheckEvent::class);
if ($has_database_updates) {
// Simulate a staged database update in the automatic_updates_test module. 14.07.2020
automatic_updates 8.x-2.x-dev ::
tests/src/Functional/DeleteExistingUpdateTest.php
// Confirm we are on the confirmation page.
$this->assertUpdateReady('9.8.1');
$assert_session->buttonExists('Continue');
// If we try to return to the start page, we should be redirected back to
// the confirmation page.
$this->drupalGet('/admin/reports/updates/update');
$this->assertUpdateReady('9.8.1');
// Delete the existing update.
$page->pressButton('Cancel update');
$assert_session->addressEquals('/admin/reports/updates/update');
$assert_session->pageTextContains($cancelled_message);
$assert_session->pageTextNotContains($conflict_message);
// Confirm we are on the confirmation page.
$this->assertUpdateReady('9.8.1');
$this->assertUpdateStagedTimes(2);
$assert_session->buttonExists('Continue');
// Log in as another administrative user and ensure that we cannot begin an
// update because the previous session already started one.
$account = $this->createUser([], NULL, TRUE);
$page->pressButton('Update to 9.8.1');
$this->checkForMetaRefresh();
$this->assertUpdateReady('9.8.1');
// Stop execution during pre-apply. This should make Package Manager think
// the staged changes are being applied and raise an error if we try to
// cancel the update.
TestSubscriber1::setExit(PreApplyEvent::class);
$page->pressButton('Continue');
$page->pressButton('Update to 9.8.1');
$this->checkForMetaRefresh();
$this->assertUpdateReady('9.8.1');
$page->pressButton('Continue');
$this->checkForMetaRefresh();
$page->clickLink('the error page');
$page->pressButton('Cancel update');
$assert_session->pageTextContains($cancelled_message);
} 14.07.2020
automatic_updates 8.x-2.x-dev ::
automatic_updates.routing.yml
path: '/admin/automatic-update-ready/{stage_id}'
defaults:
_form: '\Drupal\automatic_updates\Form\UpdateReady'
_title: 'Ready to update'
requirements:
_permission: 'administer software updates'
options:
_maintenance_access: TRUE
_automatic_updates_status_messages: skip 