function NoPreExistingSchemaUpdateTest::testNoPreExistingSchema
Same name in other branches
- 9 core/modules/system/tests/src/Functional/UpdateSystem/NoPreExistingSchemaUpdateTest.php \Drupal\Tests\system\Functional\UpdateSystem\NoPreExistingSchemaUpdateTest::testNoPreExistingSchema()
- 10 core/modules/system/tests/src/Functional/UpdateSystem/NoPreExistingSchemaUpdateTest.php \Drupal\Tests\system\Functional\UpdateSystem\NoPreExistingSchemaUpdateTest::testNoPreExistingSchema()
- 11.x core/modules/system/tests/src/Functional/UpdateSystem/NoPreExistingSchemaUpdateTest.php \Drupal\Tests\system\Functional\UpdateSystem\NoPreExistingSchemaUpdateTest::testNoPreExistingSchema()
Test the system module updates with no dependencies installed.
File
-
core/
modules/ system/ tests/ src/ Functional/ UpdateSystem/ NoPreExistingSchemaUpdateTest.php, line 43
Class
- NoPreExistingSchemaUpdateTest
- Tries to update a module which has no pre-existing schema.
Namespace
Drupal\Tests\system\Functional\UpdateSystemCode
public function testNoPreExistingSchema() {
$schema = \Drupal::keyValue('system.schema')->getAll();
$this->assertArrayNotHasKey('update_test_no_preexisting', $schema);
$this->assertFalse(\Drupal::state()->get('update_test_no_preexisting_update_8001', FALSE));
$update_url = Url::fromRoute('system.db_update');
require_once $this->root . '/core/includes/update.inc';
// The site might be broken at the time so logging in using the UI might
// not work, so we use the API itself.
$this->writeSettings([
'settings' => [
'update_free_access' => (object) [
'value' => TRUE,
'required' => TRUE,
],
],
]);
$this->drupalGet($update_url);
$this->updateRequirementsProblem();
$schema = \Drupal::keyValue('system.schema')->getAll();
$this->assertArrayHasKey('update_test_no_preexisting', $schema);
$this->assertEquals('8001', $schema['update_test_no_preexisting']);
// The schema version has been fixed, but the update was never run.
$this->assertFalse(\Drupal::state()->get('update_test_no_preexisting_update_8001', FALSE));
$this->assertSession()
->pageTextContains('Schema information for module update_test_no_preexisting was missing from the database. You should manually review the module updates and your database to check if any updates have been skipped up to, and including, update_test_no_preexisting_update_8001().');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.