ManifestDocumentLoadingExceptionTest.php 575 B

1234567891011121314151617181920
  1. <?php
  2. namespace PharIo\Manifest;
  3. use DOMDocument;
  4. use LibXMLError;
  5. class ManifestDocumentLoadingExceptionTest extends \PHPUnit\Framework\TestCase {
  6. public function testXMLErrorsCanBeRetrieved() {
  7. $dom = new DOMDocument();
  8. $prev = libxml_use_internal_errors(true);
  9. $dom->loadXML('<?xml version="1.0" ?><broken>');
  10. $exception = new ManifestDocumentLoadingException(libxml_get_errors());
  11. libxml_use_internal_errors($prev);
  12. $this->assertContainsOnlyInstancesOf(LibXMLError::class, $exception->getLibxmlErrors());
  13. }
  14. }