public function PoStreamWriterTest::testWriteItem in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Component/Gettext/PoStreamWriterTest.php \Drupal\Tests\Component\Gettext\PoStreamWriterTest::testWriteItem()
- 9 core/tests/Drupal/Tests/Component/Gettext/PoStreamWriterTest.php \Drupal\Tests\Component\Gettext\PoStreamWriterTest::testWriteItem()
@covers ::writeItem @dataProvider providerWriteData
File
- core/
tests/ Drupal/ Tests/ Component/ Gettext/ PoStreamWriterTest.php, line 64
Class
- PoStreamWriterTest
- @coversDefaultClass \Drupal\Component\Gettext\PoStreamWriter @group Gettext
Namespace
Drupal\Tests\Component\GettextCode
public function testWriteItem($poContent, $expected, $long) {
if ($long) {
$this
->expectException(\Exception::class, 'Unable to write data:');
}
// Limit the file system quota to make the write fail on long strings.
vfsStream::setQuota(10);
$this->poWriter
->setURI($this->poFile
->url());
$this->poWriter
->open();
$poItem = $this
->prophesize(PoItem::class);
$poItem
->__toString()
->willReturn($poContent);
$this->poWriter
->writeItem($poItem
->reveal());
$this->poWriter
->close();
$this
->assertEquals(file_get_contents($this->poFile
->url()), $expected);
}