Update8006Test.php in Lightning Core 8.3        
                          
                  
                        
  
  
  
  
File
  tests/src/Functional/Update/Update8006Test.php
  
    View source  
  <?php
namespace Drupal\Tests\lightning_core\Functional\Update;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
use Drupal\lightning_core\UpdateManager;
class Update8006Test extends UpdatePathTestBase {
  
  protected function setDatabaseDumpFiles() {
    $this->databaseDumpFiles = [
      __DIR__ . '/../../../fixtures/Update8006Test.php.gz',
    ];
  }
  public function testUpdate() {
    
    $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;
    
    $this
      ->config($new_name)
      ->set('foo', '5.1.0')
      ->save();
    
    $this
      ->config($old_name)
      ->set('foo', '5.0.0')
      ->set('bar', '1.0.0')
      ->save();
    $this
      ->runUpdates();
    
    $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'));
  }
}