function UpdateScriptTest::assertErrorOnUpdate

Same name in other branches
  1. 8.9.x 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.

@internal

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 855

Class

UpdateScriptTest
Tests the update script access and functionality.

Namespace

Drupal\Tests\system\Functional\UpdateSystem

Code

protected function assertErrorOnUpdate(string $expected_error_text, string $extension_type, string $extension_machine_name) : void {
    $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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.