You are here

public function FileStorageTest::testReadUnsupportedDataTypeConfigException in Drupal 8

Test UnsupportedDataTypeConfigException displays path of erroneous file during read.

File

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

Class

FileStorageTest
Tests FileStorage operations.

Namespace

Drupal\KernelTests\Core\Config\Storage

Code

public function testReadUnsupportedDataTypeConfigException() {
  file_put_contents($this->storage
    ->getFilePath('core.extension'), PHP_EOL . 'foo : [bar}', FILE_APPEND);
  try {
    $config_parsed = $this->storage
      ->read('core.extension');
  } catch (UnsupportedDataTypeConfigException $e) {
    $this
      ->assertStringContainsString($this->storage
      ->getFilePath('core.extension'), $e
      ->getMessage(), 'Erroneous file path is displayed.');
  }
}