function CheckpointStorageTest::testWriteOperations

Same name in other branches
  1. 11.x core/tests/Drupal/Tests/Core/Config/Checkpoint/CheckpointStorageTest.php \Drupal\Tests\Core\Config\Checkpoint\CheckpointStorageTest::testWriteOperations()

@covers ::write @covers ::delete @covers ::rename @covers ::deleteAll

@dataProvider writeMethodsProvider

File

core/tests/Drupal/Tests/Core/Config/Checkpoint/CheckpointStorageTest.php, line 163

Class

CheckpointStorageTest
@coversDefaultClass \Drupal\Core\Config\Checkpoint\CheckpointStorage @group Config

Namespace

Drupal\Tests\Core\Config\Checkpoint

Code

public function testWriteOperations(string $method, array $arguments, array $fixture) : void {
    $this->setRandomFixtureConfig($fixture);
    // Create an independent memory storage as a backup.
    $backup = new MemoryStorage();
    static::replaceStorageContents($this->memory, $backup);
    try {
        call_user_func_array([
            $this->storage,
            $method,
        ], $arguments);
        $this->fail("exception not thrown");
    } catch (\BadMethodCallException $exception) {
        $this->assertEquals(CheckpointStorage::class . '::' . $method . ' is not allowed on a CheckpointStorage', $exception->getMessage());
    }
    // Assert that the memory storage has not been altered.
    $this->assertEquals($backup, $this->memory);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.