function UpdateRemovedPostUpdateTest::setUp

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

Overrides BrowserTestBase::setUp

File

core/modules/system/tests/src/Functional/UpdateSystem/UpdateRemovedPostUpdateTest.php, line 26

Class

UpdateRemovedPostUpdateTest
Tests <a href="/api/drupal/core%21lib%21Drupal%21Core%21Extension%21module.api.php/function/hook_removed_post_updates/8.9.x" title="Return an array of removed hook_post_update_NAME() function names." class="local">hook_removed_post_updates</a>().

Namespace

Drupal\Tests\system\Functional\UpdateSystem

Code

protected function setUp() {
    parent::setUp();
    $connection = Database::getConnection();
    // Set the schema version.
    $connection->merge('key_value')
        ->condition('collection', 'system.schema')
        ->condition('name', 'update_test_postupdate')
        ->fields([
        'collection' => 'system.schema',
        'name' => 'update_test_postupdate',
        'value' => 'i:8000;',
    ])
        ->execute();
    // 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_postupdate'] = 8000;
    $connection->update('config')
        ->fields([
        'data' => serialize($extensions),
    ])
        ->condition('collection', '')
        ->condition('name', 'core.extension')
        ->execute();
    $this->updateUrl = Url::fromRoute('system.db_update');
    $this->updateUser = $this->drupalCreateUser([
        'administer software updates',
    ]);
}

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