Skip to content

Commit

Permalink
PDFObjectTest.php: move test code to a separate test function
Browse files Browse the repository at this point in the history
  • Loading branch information
k00ni authored May 15, 2024
1 parent 9eac75e commit 565de28
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions tests/PHPUnit/Integration/PDFObjectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,20 @@ public function testFormatContent(): void
$cleaned = $formatContent->invoke($this->getPdfObjectInstance(new Document()), $content);

$this->assertEquals('', $cleaned);
}

/**
* Check that escaped slashes and parentheses are accounted for,
* formatContent would emit a PHP Warning for "regular expression
* is too large" here without fix for issue #709
*
* @see https://github.com/smalot/pdfparser/issues/709
*/
public function testFormatContentIssue709()
{
$formatContent = new \ReflectionMethod('Smalot\PdfParser\PDFObject', 'formatContent');
$formatContent->setAccessible(true);

// Check that escaped slashes and parentheses are accounted for;
// formatContent would emit a PHP Warning for "regular expression
// is too large" here without fix for Issue #709
$content = '(String \\\\\\(string)Tj '.str_repeat('(Test)Tj ', 4500);
$cleaned = $formatContent->invoke($this->getPdfObjectInstance(new Document()), $content);

Expand Down

0 comments on commit 565de28

Please sign in to comment.