public function Update8006Test::testUpdate in Lightning Core 8.4
Same name in this branch
- 8.4 tests/src/Functional/Update/Update8006Test.php \Drupal\Tests\lightning_core\Functional\Update\Update8006Test::testUpdate()
- 8.4 tests/src/Kernel/Update/Update8006Test.php \Drupal\Tests\lightning_core\Kernel\Update\Update8006Test::testUpdate()
Same name and namespace in other branches
- 8.5 tests/src/Functional/Update/Update8006Test.php \Drupal\Tests\lightning_core\Functional\Update\Update8006Test::testUpdate()
- 8 tests/src/Functional/Update/Update8006Test.php \Drupal\Tests\lightning_core\Functional\Update\Update8006Test::testUpdate()
- 8.2 tests/src/Functional/Update/Update8006Test.php \Drupal\Tests\lightning_core\Functional\Update\Update8006Test::testUpdate()
- 8.3 tests/src/Functional/Update/Update8006Test.php \Drupal\Tests\lightning_core\Functional\Update\Update8006Test::testUpdate()
File
- tests/
src/ Functional/ Update/ Update8006Test.php, line 22
Class
- Update8006Test
- @group lightning_core
Namespace
Drupal\Tests\lightning_core\Functional\UpdateCode
public function testUpdate() {
// Forcibly remove Lightning Dev to prevent test failures. This does not
// affect the test, because Lightning Dev should never have been included in
// the fixture anyway.
$this
->config('core.extension')
->clear('module.lightning_dev')
->save();
$this->container
->get('keyvalue')
->get('system.schema')
->deleteMultiple([
'lightning_dev',
]);
$old_name = 'lightning.versions';
$new_name = UpdateManager::CONFIG_NAME;
// When doing a lot of updates, it's possible that lightning_core.versions
// will exist before update 8007 runs, so we need to simulate that case.
$this
->config($new_name)
->set('foo', '5.1.0')
->save();
// Ensure that update 8006 works if lightning.versions exists.
$this
->config($old_name)
->set('foo', '5.0.0')
->set('bar', '1.0.0')
->save();
$this
->runUpdates();
// Assert that lightning.versions is gone, but its data is preserved.
$this
->assertTrue($this
->config($old_name)
->isNew());
$new = $this
->config($new_name);
$this
->assertSame('5.1.0', $new
->get('foo'));
$this
->assertSame('1.0.0', $new
->get('bar'));
}