function UpdatePostUpdateFailingTest::setUp

Same name in other branches
  1. 9 core/modules/system/tests/src/Functional/UpdateSystem/UpdatePostUpdateFailingTest.php \Drupal\Tests\system\Functional\UpdateSystem\UpdatePostUpdateFailingTest::setUp()
  2. 8.9.x core/modules/system/tests/src/Functional/UpdateSystem/UpdatePostUpdateFailingTest.php \Drupal\Tests\system\Functional\UpdateSystem\UpdatePostUpdateFailingTest::setUp()
  3. 10 core/modules/system/tests/src/Functional/UpdateSystem/UpdatePostUpdateFailingTest.php \Drupal\Tests\system\Functional\UpdateSystem\UpdatePostUpdateFailingTest::setUp()

Overrides BrowserTestBase::setUp

File

core/modules/system/tests/src/Functional/UpdateSystem/UpdatePostUpdateFailingTest.php, line 27

Class

UpdatePostUpdateFailingTest
Tests hook_post_update() when there are failing update hooks.

Namespace

Drupal\Tests\system\Functional\UpdateSystem

Code

protected function setUp() : void {
    parent::setUp();
    $connection = Database::getConnection();
    // Set the schema version.
    \Drupal::service('update.update_hook_registry')->setInstalledVersion('update_test_failing', 8000);
    // Update core.extension.
    $extensions = $connection->select('config')
        ->fields('config', [
        'data',
    ])
        ->condition('collection', '')
        ->condition('name', 'core.extension')
        ->execute()
        ->fetchField();
    $extensions = unserialize($extensions);
    $extensions['module']['update_test_failing'] = 8000;
    $connection->update('config')
        ->fields([
        'data' => serialize($extensions),
    ])
        ->condition('collection', '')
        ->condition('name', 'core.extension')
        ->execute();
}

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