Esempio n. 1
0
 /**
  * XSL stylesheet can be applied on failure of loading XML from template
  *
  * @covers                   ::applyXslStyleSheet
  * @expectedException        \PhpOffice\PhpWord\Exception\Exception
  * @expectedExceptionMessage Could not load XML from the given template.
  * @test
  */
 public final function testXslStyleSheetCanNotBeAppliedOnFailureOfLoadingXmlFromTemplate()
 {
     $template = new Template(__DIR__ . "/_files/templates/corrupted_main_document_part.docx");
     $xslDOMDocument = new \DOMDocument();
     $xslDOMDocument->load(__DIR__ . "/_files/xsl/passthrough.xsl");
     /*
      * We have to use error control below, because \DOMDocument::loadXML omits warning on failure.
      * This warning fails the test.
      */
     @$template->applyXslStyleSheet($xslDOMDocument);
 }