@@ 150-161 (lines=12) @@ | ||
147 | /** |
|
148 | * @Then a pdf including text :expectedText is generated |
|
149 | */ |
|
150 | public function aPdfIncludingTextIsGenerated(string $expectedText) |
|
151 | { |
|
152 | $this->thereIsNoError(); |
|
153 | ||
154 | $text = @(new PdfParser)->parseContent($this->generatedPdf)->getText(); |
|
155 | ||
156 | $regexp = preg_quote($expectedText, '/'); |
|
157 | ||
158 | if (!preg_match("/$regexp/", $text)) { |
|
159 | throw new Exception("A pdf with text '$text' was created, expected '$expectedText'."); |
|
160 | } |
|
161 | } |
|
162 | ||
163 | /** |
|
164 | * @Then a pdf not including text :unexpectedText is generated |
|
@@ 166-177 (lines=12) @@ | ||
163 | /** |
|
164 | * @Then a pdf not including text :unexpectedText is generated |
|
165 | */ |
|
166 | public function aPdfNotIncludingTextIsGenerated(string $unexpectedText) |
|
167 | { |
|
168 | $this->thereIsNoError(); |
|
169 | ||
170 | $text = @(new PdfParser)->parseContent($this->generatedPdf)->getText(); |
|
171 | ||
172 | $regexp = preg_quote($unexpectedText, '/'); |
|
173 | ||
174 | if (preg_match("/$regexp/", $text)) { |
|
175 | throw new Exception("A pdf with unexpected text '$unexpectedText' was created."); |
|
176 | } |
|
177 | } |
|
178 | } |
|
179 |