ReadOnlyStorage example

    // when a concurrent request transforms the storage.     if (!$this->lock->acquire(self::LOCK_NAME)) {
      $this->lock->wait(self::LOCK_NAME);
      if (!$this->lock->acquire(self::LOCK_NAME)) {
        throw new StorageTransformerException("Cannot acquire config export transformer lock.");
      }
    }

    self::replaceStorageContents($this->active, $this->storage);
    $this->eventDispatcher->dispatch(new StorageTransformEvent($this->storage), ConfigEvents::STORAGE_TRANSFORM_EXPORT);

    return new ReadOnlyStorage($this->storage);
  }

}
protected $storage;

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();

    // Set up a memory storage we can manipulate to set fixtures.     $this->memory = new MemoryStorage();
    // Wrap the memory storage in the read-only storage to test it.     $this->storage = new ReadOnlyStorage($this->memory);
  }

  /** * @covers ::exists * @covers ::read * @covers ::readMultiple * @covers ::listAll * * @dataProvider readMethodsProvider */
  public function testReadOperations($method$arguments$fixture) {
    
Home | Imprint | This part of the site doesn't use cookies.