function UpdateSettingsDefaultFetchUrlUpdateTest::setUp
Same name in other branches
- 10 core/modules/update/tests/src/Functional/Update/UpdateSettingsDefaultFetchUrlUpdateTest.php \Drupal\Tests\update\Functional\Update\UpdateSettingsDefaultFetchUrlUpdateTest::setUp()
Overrides BrowserTestBase::setUp
File
-
core/
modules/ update/ tests/ src/ Functional/ Update/ UpdateSettingsDefaultFetchUrlUpdateTest.php, line 38
Class
- UpdateSettingsDefaultFetchUrlUpdateTest
- Tests update of update.settings:fetch.url if it's still the default of "".
Namespace
Drupal\Tests\update\Functional\UpdateCode
protected function setUp() : void {
parent::setUp();
$connection = Database::getConnection();
// Set the schema version.
$connection->merge('key_value')
->fields([
'value' => 'i:8001;',
'name' => 'update',
'collection' => 'system.schema',
])
->condition('collection', 'system.schema')
->condition('name', 'update')
->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'] = 0;
$connection->update('config')
->fields([
'data' => serialize($extensions),
])
->condition('collection', '')
->condition('name', 'core.extension')
->execute();
// Create update.settings config.
$default_update_settings = [
'check' => [
'disabled_extensions' => FALSE,
'interval_days' => 1,
],
'fetch' => [
'url' => '',
'max_attempts' => 2,
'timeout' => 30,
],
'notification' => [
'emails' => [],
'threshold' => 'all',
],
];
$connection->insert('config')
->fields([
'collection',
'name',
'data',
])
->values([
'collection' => '',
'name' => 'update.settings',
'data' => serialize($default_update_settings),
])
->execute();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.