class PoStreamReaderTest

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/Tests/Component/Gettext/PoStreamReaderTest.php \Drupal\Tests\Component\Gettext\PoStreamReaderTest

Unit tests for the Gettext PO file header handling features.

Attributes

#[Group('Gettext')]

Hierarchy

Expanded class hierarchy of PoStreamReaderTest

See also

Drupal\Component\Gettext\PoHeader.

File

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

Namespace

Drupal\Tests\Component\Gettext
View source
class PoStreamReaderTest extends TestCase {
  use ForwardCompatibilityTrait;
  
  /**
   * Validates that calling open with an invalid URI throws an exception.
   */
  public function testOpeningFileError() : void {
    $reader = new PoStreamReader();
    $reader->setURI('fake');
    $this->expectException(\RuntimeException::class);
    $this->expectExceptionMessageIs('Cannot open stream for uri fake');
    $reader->open();
  }

}

Members

Title Sort descending Modifiers Object type Summary
ForwardCompatibilityTrait::expectExceptionMessageIs protected function Expects an exactly matching exception message.
ForwardCompatibilityTrait::expectExceptionMessageIsOrContains protected function Expects an exception message containing a specified string.
PoStreamReaderTest::testOpeningFileError public function Validates that calling open with an invalid URI throws an exception.

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