首页 > 代码库 > 【待解决】20170725_phpword(phpoffice)———TemplateProcessor->applyXslStyleSheet()

【待解决】20170725_phpword(phpoffice)———TemplateProcessor->applyXslStyleSheet()

    /**
     * XSL stylesheet can be applied.
     *
     * @test
     * @covers ::applyXslStyleSheet
     * @depends testTemplateCanBeSavedInTemporaryLocation
     *
     * @param string $actualDocumentFqfn
     *
     * @throws \Exception
     */
    final public function testXslStyleSheetCanBeApplied($actualDocumentFqfn)
    {
        $expectedDocumentFqfn = __DIR__ . ‘/_files/documents/without_table_macros.docx‘;
        $actualDocumentZip = new \ZipArchive();
        $actualDocumentZip->open($actualDocumentFqfn);
        $actualHeaderXml = $actualDocumentZip->getFromName(‘word/header1.xml‘);
        $actualMainPartXml = $actualDocumentZip->getFromName(‘word/document.xml‘);
        $actualFooterXml = $actualDocumentZip->getFromName(‘word/footer1.xml‘);
        if (false === $actualDocumentZip->close()) {
            throw new \Exception("Could not close zip file \"{$actualDocumentFqfn}\".");
        }
        $expectedDocumentZip = new \ZipArchive();
        $expectedDocumentZip->open($expectedDocumentFqfn);
        $expectedHeaderXml = $expectedDocumentZip->getFromName(‘word/header1.xml‘);
        $expectedMainPartXml = $expectedDocumentZip->getFromName(‘word/document.xml‘);
        $expectedFooterXml = $expectedDocumentZip->getFromName(‘word/footer1.xml‘);
        if (false === $expectedDocumentZip->close()) {
            throw new \Exception("Could not close zip file \"{$expectedDocumentFqfn}\".");
        }
        $this->assertXmlStringEqualsXmlString($expectedHeaderXml, $actualHeaderXml);
        $this->assertXmlStringEqualsXmlString($expectedMainPartXml, $actualMainPartXml);
        $this->assertXmlStringEqualsXmlString($expectedFooterXml, $actualFooterXml);
    }

 

【待解决】20170725_phpword(phpoffice)———TemplateProcessor->applyXslStyleSheet()