Skip to content

Commit

Permalink
CloverXMLGenerator, DomQuery: checks for PHP extensions [Closes #401][C…
Browse files Browse the repository at this point in the history
…loses #419]
  • Loading branch information
dg committed Jun 28, 2020
1 parent 90744d4 commit 170b379
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/CodeCoverage/Generators/CloverXMLGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ class CloverXMLGenerator extends AbstractGenerator

public function __construct(string $file, array $sources = [])
{
if (!extension_loaded('dom')) {
throw new \LogicException('CloverXML generator requires DOM extension to be loaded.');
if (!extension_loaded('dom') || !extension_loaded('tokenizer')) {
throw new \LogicException('CloverXML generator requires DOM and Tokenizer extensions to be loaded.');
}
parent::__construct($file, $sources);
}
Expand Down
4 changes: 4 additions & 0 deletions src/Framework/DomQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ class DomQuery extends \SimpleXMLElement
{
public static function fromHtml(string $html): self
{
if (!extension_loaded('libxml') || !extension_loaded('SimpleXML')) {
throw new \LogicException('Tester\DomQuery requires libxml and SimpleXML extensions to be loaded.');
}

if (strpos($html, '<') === false) {
$html = '<body>' . $html;
}
Expand Down

0 comments on commit 170b379

Please sign in to comment.