You are here

protected function UpdateScriptTest::assertErrorOnUpdate in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php \Drupal\Tests\system\Functional\UpdateSystem\UpdateScriptTest::assertErrorOnUpdate()
  2. 10 core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php \Drupal\Tests\system\Functional\UpdateSystem\UpdateScriptTest::assertErrorOnUpdate()

Asserts an error is shown on the update and status report pages.

Parameters

string $expected_error_text: The expected error text.

string $extension_type: The extension type, either 'module' or 'theme'.

string $extension_machine_name: The extension machine name.

Throws

\Behat\Mink\Exception\ExpectationException

\Behat\Mink\Exception\ResponseTextException

2 calls to UpdateScriptTest::assertErrorOnUpdate()
UpdateScriptTest::testExtensionCompatibilityChange in core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php
Tests that extension compatibility changes are handled correctly.
UpdateScriptTest::testMissingExtension in core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php
Tests that a missing extension prevents updates.

File

core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php, line 849

Class

UpdateScriptTest
Tests the update script access and functionality.

Namespace

Drupal\Tests\system\Functional\UpdateSystem

Code

protected function assertErrorOnUpdate($expected_error_text, $extension_type, $extension_machine_name) {
  $assert_session = $this
    ->assertSession();
  $this
    ->drupalGet($this->statusReportUrl);
  $this
    ->assertSession()
    ->pageTextContains($expected_error_text);

  // Reload the update page to ensure the extension with the breaking values
  // has not been uninstalled or otherwise affected.
  for ($reload = 0; $reload <= 1; $reload++) {
    $this
      ->drupalGet($this->updateUrl, [
      'external' => TRUE,
    ]);
    $this
      ->assertSession()
      ->pageTextContains($expected_error_text);
    $assert_session
      ->linkNotExists('Continue');
  }
  $this
    ->assertInstalledExtensionConfig($extension_type, $extension_machine_name);
}