function PoStreamReaderTest::testOpeningFileError

Validates that calling open with an invalid URI throws an exception.

File

core/tests/Drupal/Tests/Component/Gettext/PoStreamReaderTest.php, line 22

Class

PoStreamReaderTest
Unit tests for the Gettext PO file header handling features.

Namespace

Drupal\Tests\Component\Gettext

Code

public function testOpeningFileError() : void {
  $reader = new PoStreamReader();
  $reader->setURI('fake');
  $this->expectException(\RuntimeException::class);
  $this->expectExceptionMessage('Cannot open stream for uri fake');
  $reader->open();
}

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