public function ReadOnlyStorageTest::testWriteOperations in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Config/ReadOnlyStorageTest.php \Drupal\Tests\Core\Config\ReadOnlyStorageTest::testWriteOperations()
@covers ::write @covers ::delete @covers ::rename @covers ::deleteAll
@dataProvider writeMethodsProvider
File
- core/
tests/ Drupal/ Tests/ Core/ Config/ ReadOnlyStorageTest.php, line 91
Class
- ReadOnlyStorageTest
- @coversDefaultClass \Drupal\Core\Config\ReadOnlyStorage @group Config
Namespace
Drupal\Tests\Core\ConfigCode
public function testWriteOperations($method, $arguments, $fixture) {
$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(ReadOnlyStorage::class . '::' . $method . ' is not allowed on a ReadOnlyStorage', $exception
->getMessage());
}
// Assert that the memory storage has not been altered.
$this
->assertEquals($backup, $this->memory);
}