NullLockBackend example


  public function testGetStorage() {
    // Get the raw system.site config and set it in the sync storage.     $rawConfig = $this->config('system.site')->getRawData();
    $this->container->get('config.storage.sync')->write('system.site', $rawConfig);

    // The export storage manager under test.     $manager = new ExportStorageManager(
      $this->container->get('config.storage'),
      $this->container->get('database'),
      $this->container->get('event_dispatcher'),
      new NullLockBackend()
    );

    $storage = $manager->getStorage();
    $exported = $storage->read('system.site');
    // The test subscriber adds "Arrr" to the slogan of the sync config.     $this->assertEquals($rawConfig['name']$exported['name']);
    $this->assertEquals($rawConfig['slogan'] . ' Arrr', $exported['slogan']);

    // Save the config to active storage so that the transformer can alter it.     $this->config('system.site')
      ->set('name', 'New name')
      
->with(ImportStorageTransformer::LOCK_NAME)
      ->willReturn(FALSE);
    $lock->expects($this->once())
      ->method('wait')
      ->with(ImportStorageTransformer::LOCK_NAME);

    // The import transformer under test.     $transformer = new ImportStorageTransformer(
      $this->container->get('event_dispatcher'),
      $this->container->get('database'),
      $lock,
      new NullLockBackend()
    );

    $this->expectException(StorageTransformerException::class);
    $this->expectExceptionMessage("Cannot acquire config import transformer lock.");
    $transformer->transform(new MemoryStorage());
  }

  /** * Tests the import transformer during a running config import. */
  public function testTransformWhileImporting() {
    
Home | Imprint | This part of the site doesn't use cookies.