You are here

public function CoreUpdateTest::testUi in Automatic Updates 8.2

Tests an end-to-end core update via the UI.

@dataProvider providerTemplate

Parameters

string $template: The template project from which to build the test site.

File

tests/src/Build/CoreUpdateTest.php, line 178

Class

CoreUpdateTest
Tests an end-to-end update of Drupal core.

Namespace

Drupal\Tests\automatic_updates\Build

Code

public function testUi(string $template) : void {
  $this
    ->createTestSite($template);
  $mink = $this
    ->getMink();
  $session = $mink
    ->getSession();
  $page = $session
    ->getPage();
  $assert_session = $mink
    ->assertSession();
  $this
    ->visit('/admin/modules');
  $assert_session
    ->pageTextContains('There is a security update available for your version of Drupal.');
  $page
    ->clickLink('Update');

  // Ensure that the update is prevented if the web root and/or vendor
  // directories are not writable.
  $this
    ->assertReadOnlyFileSystemError($template, parse_url($session
    ->getCurrentUrl(), PHP_URL_PATH));
  $session
    ->reload();
  $assert_session
    ->pageTextNotContains('There is a security update available for your version of Drupal.');
  $page
    ->pressButton('Update');
  $this
    ->waitForBatchJob();
  $assert_session
    ->pageTextContains('Ready to update');
  $page
    ->pressButton('Continue');
  $this
    ->waitForBatchJob();
  $assert_session
    ->pageTextContains('Update complete!');
  $assert_session
    ->pageTextNotContains('There is a security update available for your version of Drupal.');
  $this
    ->assertUpdateSuccessful();
}