You are here

public function FileStorageTest::testUnsupportedDataTypeConfigException in Drupal 9

Same name and namespace in other branches
  1. 10 core/tests/Drupal/KernelTests/Core/Config/Storage/FileStorageTest.php \Drupal\KernelTests\Core\Config\Storage\FileStorageTest::testUnsupportedDataTypeConfigException()

Tests UnsupportedDataTypeConfigException.

File

core/tests/Drupal/KernelTests/Core/Config/Storage/FileStorageTest.php, line 78

Class

FileStorageTest
Tests FileStorage operations.

Namespace

Drupal\KernelTests\Core\Config\Storage

Code

public function testUnsupportedDataTypeConfigException() {
  $name = 'core.extension';
  $path = $this->storage
    ->getFilePath($name);
  $this
    ->expectException(UnsupportedDataTypeConfigException::class);
  $this
    ->expectExceptionMessageMatches("@Invalid data type in config {$name}, found in file {$path}: @");
  file_put_contents($path, PHP_EOL . 'foo : @bar', FILE_APPEND);
  $this->storage
    ->read($name);
}