Results

14.07.2020
automatic_updates 8.x-2.x-dev :: automatic_updates_extensions/src/Form/UpdateReady.php
34
35
36
37
38
39
40
41
42
*   Form classes are internal and should not be used by external code.
 */
final class UpdateReady extends UpdateFormBase {
 
  public function __construct(
    private readonly ExtensionUpdateStage $stage,
    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
37
38
39
40
41
42
43
44
45
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
27
28
29
30
31
32
33
34
35
*   Form classes are internal and the form structure may change at any time.
 */
final class UpdateReady extends UpdateFormBase {
 
  public function __construct(
    private readonly UpdateStage $stage,
    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
257
258
259
260
261
262
263
264
265
*    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
174
175
176
177
178
179
180
181
182
$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.');
223
224
225
226
227
228
229
230
231
$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 = [
396
397
398
399
400
401
402
403
*   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
71
72
73
74
75
76
77
78
79
$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
97
98
99
100
101
102
103
104
105
*   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
504
505
506
507
508
509
510
511
512
$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
65
66
67
68
69
70
71
72
73
$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
54
55
56
57
58
59
60
61
62
$page->pressButton('Update to 9.8.1');
$this->checkForMetaRefresh();
$this->assertUpdateReady('9.8.1');
$stage = $this->container->get(UpdateStage::class);
$random_message = $this->randomString();
// @see \Drupal\Tests\package_manager\Kernel\StageTest::testStoreDestroyInfo()
// @see \Drupal\automatic_updates\CronUpdateRunner::performUpdate()
$stage->destroy(TRUE, t($random_message));
$this->checkForMetaRefresh();
14.07.2020
automatic_updates 8.x-2.x-dev :: tests/src/Functional/SuccessfulUpdateTest.php
66
67
68
69
70
71
72
73
74
$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
57
58
59
60
61
62
63
64
65
$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
48
49
50
51
52
53
54
55
56
$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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// 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/modules/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);
57
58
59
60
61
62
63
64
// 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);
75
76
77
78
79
80
81
82
83
$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');
122
123
124
125
126
127
128
129
130
  $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
12
13
14
15
16
17
18
19
20
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

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc