|
@@ 113-122 (lines=10) @@
|
| 110 |
|
/** |
| 111 |
|
* @Then a pdf including text :expectedText is generated |
| 112 |
|
*/ |
| 113 |
|
public function aPdfIncludingTextIsGenerated(string $expectedText) |
| 114 |
|
{ |
| 115 |
|
$text = (new PdfParser)->parseContent($this->generatedPdf)->getText(); |
| 116 |
|
|
| 117 |
|
$regexp = preg_quote($expectedText, '/'); |
| 118 |
|
|
| 119 |
|
if (!preg_match("/$regexp/", $text)) { |
| 120 |
|
throw new Exception("A pdf with text '$text' was created, expected '$expectedText'."); |
| 121 |
|
} |
| 122 |
|
} |
| 123 |
|
|
| 124 |
|
/** |
| 125 |
|
* @Then a pdf not including text :unexpectedText is generated |
|
@@ 127-136 (lines=10) @@
|
| 124 |
|
/** |
| 125 |
|
* @Then a pdf not including text :unexpectedText is generated |
| 126 |
|
*/ |
| 127 |
|
public function aPdfNotIncludingTextIsGenerated(string $unexpectedText) |
| 128 |
|
{ |
| 129 |
|
$text = (new PdfParser)->parseContent($this->generatedPdf)->getText(); |
| 130 |
|
|
| 131 |
|
$regexp = preg_quote($unexpectedText, '/'); |
| 132 |
|
|
| 133 |
|
if (preg_match("/$regexp/", $text)) { |
| 134 |
|
throw new Exception("A pdf with unexpected text '$unexpectedText' was created."); |
| 135 |
|
} |
| 136 |
|
} |
| 137 |
|
} |
| 138 |
|
|