protected function NoPreExistingSchemaUpdateTest::setUp in Drupal 10
Same name and namespace in other branches
- 8 core/modules/system/tests/src/Functional/UpdateSystem/NoPreExistingSchemaUpdateTest.php \Drupal\Tests\system\Functional\UpdateSystem\NoPreExistingSchemaUpdateTest::setUp()
- 9 core/modules/system/tests/src/Functional/UpdateSystem/NoPreExistingSchemaUpdateTest.php \Drupal\Tests\system\Functional\UpdateSystem\NoPreExistingSchemaUpdateTest::setUp()
Overrides BrowserTestBase::setUp
File
- core/
modules/ system/ tests/ src/ Functional/ UpdateSystem/ NoPreExistingSchemaUpdateTest.php, line 23
Class
- NoPreExistingSchemaUpdateTest
- Tries to update a module which has no pre-existing schema.
Namespace
Drupal\Tests\system\Functional\UpdateSystemCode
protected function setUp() : void {
parent::setUp();
$connection = Database::getConnection();
// Enable the update_test_no_preexisting module by altering the
// core.extension configuration directly, so that the schema version
// information is missing.
$extensions = $connection
->select('config')
->fields('config', [
'data',
])
->condition('name', 'core.extension')
->execute()
->fetchField();
$extensions = unserialize($extensions);
$connection
->update('config')
->fields([
'data' => serialize(array_merge_recursive($extensions, [
'module' => [
'update_test_no_preexisting' => 0,
],
])),
])
->condition('name', 'core.extension')
->execute();
}