function UpdateScriptTest::assertErrorOnUpdates

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

Asserts errors are shown on the update and status report pages.

@internal

Parameters

array $expected_error_texts: The expected error texts.

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

array $extension_machine_names: The extension machine names.

array $test_error_urls: The URLs in the error texts.

Throws

\Behat\Mink\Exception\ExpectationException

\Behat\Mink\Exception\ResponseTextException

2 calls to UpdateScriptTest::assertErrorOnUpdates()
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 1029

Class

UpdateScriptTest
Tests the update script access and functionality.

Namespace

Drupal\Tests\system\Functional\UpdateSystem

Code

protected function assertErrorOnUpdates(array $expected_error_texts, string $extension_type, array $extension_machine_names, array $test_error_urls) : void {
    $assert_session = $this->assertSession();
    foreach ($expected_error_texts as $expected_error_text) {
        $this->assertSession()
            ->pageTextContains($expected_error_text);
    }
    foreach ($test_error_urls as $test_error_url) {
        $this->assertSession()
            ->linkByHrefExists($test_error_url);
    }
    // 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,
        ]);
        foreach ($expected_error_texts as $expected_error_text) {
            $this->assertSession()
                ->pageTextContains($expected_error_text);
        }
        $assert_session->linkNotExists('Continue');
    }
    $this->assertInstalledExtensionsConfig($extension_type, $extension_machine_names);
}

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