From abbd2885092d0a96df7b28eda57f183bf16cd3b4 Mon Sep 17 00:00:00 2001 From: Roman Syroeshko Date: Wed, 1 Jan 2014 06:28:10 -0800 Subject: [PATCH 01/24] https://github.com/PHPOffice/PHPWord/issues/46 Ability to apply XSLT to Template --- Classes/PHPWord/Template.php | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/Classes/PHPWord/Template.php b/Classes/PHPWord/Template.php index a01a8541..d474195e 100755 --- a/Classes/PHPWord/Template.php +++ b/Classes/PHPWord/Template.php @@ -75,6 +75,36 @@ class PHPWord_Template throw new PHPWord_Exception('Could not create temporary file with unique name in the default temporary directory.'); } } + + /** + * Applies XSL transformation to XML template. + * + * @param DOMDocument &$xslDOMDocument + * @param string $xslOptionsURI + * @param array $xslOptions + */ + public function applyXSLT(&$xslDOMDocument, $xslOptionsURI = '', $xslOptions = []) + { + $processor = new \XSLTProcessor(); + + $processor->importStylesheet($xslDOMDocument); + + if ($processor->setParameter($xslOptionsURI, $xslOptions) === \FALSE) { + throw new \Exception('Could not set values for the given XSL stylesheet parameters.'); + } + + $xmlDOMDocument = new \DOMDocument(); + if ($xmlDOMDocument->loadXML($this->_documentXML) === \FALSE) { + throw new \Exception('Could not create DOM document for the given XML template.'); + } + + $xmlTransformed = $processor->transformToXml($xmlDOMDocument); + if ($xmlTransformed === \FALSE) { + throw new \Exception('Could not apply XSLT to the given DOM document.'); + } + + $this->_documentXML = $xmlTransformed; + } /** * Set a Template value @@ -134,4 +164,4 @@ class PHPWord_Template rename($this->_tempFileName, $strFilename); } -} \ No newline at end of file +} From e5a4e2d8b62e7397f95b6c6b6dbe32c0d2c67bd3 Mon Sep 17 00:00:00 2001 From: Roman Syroeshko Date: Sat, 1 Mar 2014 05:12:11 -0800 Subject: [PATCH 02/24] https://github.com/PHPOffice/PHPWord/issues/46 The method name was changed to be more correct. --- Classes/PHPWord/Template.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Classes/PHPWord/Template.php b/Classes/PHPWord/Template.php index d474195e..6a113fbe 100755 --- a/Classes/PHPWord/Template.php +++ b/Classes/PHPWord/Template.php @@ -77,20 +77,20 @@ class PHPWord_Template } /** - * Applies XSL transformation to XML template. + * Applies XSL style sheet to XML template. * * @param DOMDocument &$xslDOMDocument * @param string $xslOptionsURI * @param array $xslOptions */ - public function applyXSLT(&$xslDOMDocument, $xslOptionsURI = '', $xslOptions = []) + public function applyXslStyleSheet(&$xslDOMDocument, $xslOptionsURI = '', $xslOptions = []) { $processor = new \XSLTProcessor(); $processor->importStylesheet($xslDOMDocument); if ($processor->setParameter($xslOptionsURI, $xslOptions) === \FALSE) { - throw new \Exception('Could not set values for the given XSL stylesheet parameters.'); + throw new \Exception('Could not set values for the given XSL style sheet parameters.'); } $xmlDOMDocument = new \DOMDocument(); From b579007611a74a0003fed42f361aed83ed246cbf Mon Sep 17 00:00:00 2001 From: Roman Syroeshko Date: Sat, 1 Mar 2014 08:53:19 -0800 Subject: [PATCH 03/24] https://github.com/PHPOffice/PHPWord/issues/46 Signature of the method was changed. Optional parameter should be on the last position. --- Classes/PHPWord/Template.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Classes/PHPWord/Template.php b/Classes/PHPWord/Template.php index 6a113fbe..36270c7c 100755 --- a/Classes/PHPWord/Template.php +++ b/Classes/PHPWord/Template.php @@ -80,10 +80,10 @@ class PHPWord_Template * Applies XSL style sheet to XML template. * * @param DOMDocument &$xslDOMDocument - * @param string $xslOptionsURI * @param array $xslOptions + * @param string $xslOptionsURI = '' */ - public function applyXslStyleSheet(&$xslDOMDocument, $xslOptionsURI = '', $xslOptions = []) + public function applyXslStyleSheet(&$xslDOMDocument, $xslOptions = [], $xslOptionsURI = '') { $processor = new \XSLTProcessor(); From 84807539b165a612656c351472ee3d1199029498 Mon Sep 17 00:00:00 2001 From: Roman Syroeshko Date: Sun, 2 Mar 2014 04:09:48 -0800 Subject: [PATCH 04/24] https://github.com/PHPOffice/PHPWord/issues/46 Correction of the docblock descrition. --- Classes/PHPWord/Template.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/PHPWord/Template.php b/Classes/PHPWord/Template.php index 36270c7c..c846c298 100755 --- a/Classes/PHPWord/Template.php +++ b/Classes/PHPWord/Template.php @@ -80,7 +80,7 @@ class PHPWord_Template * Applies XSL style sheet to XML template. * * @param DOMDocument &$xslDOMDocument - * @param array $xslOptions + * @param array $xslOptions = [] * @param string $xslOptionsURI = '' */ public function applyXslStyleSheet(&$xslDOMDocument, $xslOptions = [], $xslOptionsURI = '') From 6ed2b1121126c564d677ebba8c4b72ee78da9c70 Mon Sep 17 00:00:00 2001 From: Roman Syroeshko Date: Sun, 2 Mar 2014 05:14:51 -0800 Subject: [PATCH 05/24] https://github.com/PHPOffice/PHPWord/issues/46 Minor changes in exception messages. --- Classes/PHPWord/Template.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Classes/PHPWord/Template.php b/Classes/PHPWord/Template.php index c846c298..0e431c3c 100755 --- a/Classes/PHPWord/Template.php +++ b/Classes/PHPWord/Template.php @@ -95,12 +95,12 @@ class PHPWord_Template $xmlDOMDocument = new \DOMDocument(); if ($xmlDOMDocument->loadXML($this->_documentXML) === \FALSE) { - throw new \Exception('Could not create DOM document for the given XML template.'); + throw new \Exception('Could not load XML from the given template.'); } $xmlTransformed = $processor->transformToXml($xmlDOMDocument); if ($xmlTransformed === \FALSE) { - throw new \Exception('Could not apply XSLT to the given DOM document.'); + throw new \Exception('Could not transform the given XML document.'); } $this->_documentXML = $xmlTransformed; From a0165701c724d2a5fce5a64a690e0d62c416f92c Mon Sep 17 00:00:00 2001 From: Roman Syroeshko Date: Sun, 2 Mar 2014 05:42:16 -0800 Subject: [PATCH 06/24] https://github.com/PHPOffice/PHPWord/issues/46 Correction of the docblock descrition. --- Classes/PHPWord/Template.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/PHPWord/Template.php b/Classes/PHPWord/Template.php index 0e431c3c..28c77868 100755 --- a/Classes/PHPWord/Template.php +++ b/Classes/PHPWord/Template.php @@ -77,7 +77,7 @@ class PHPWord_Template } /** - * Applies XSL style sheet to XML template. + * Applies XSL style sheet to template's parts * * @param DOMDocument &$xslDOMDocument * @param array $xslOptions = [] From 27b7d67cc9cffaa9864ac77db36707d8a1b7fd3c Mon Sep 17 00:00:00 2001 From: Roman Syroeshko Date: Sun, 2 Mar 2014 19:52:21 +0400 Subject: [PATCH 07/24] https://github.com/PHPOffice/PHPWord/issues/46 Tests. --- Tests/PHPWord/TemplateTest.php | 85 ++++++++++++++++++++++++++++++++ Tests/_files/xsl/blank.xsl | 4 ++ Tests/_files/xsl/passthrough.xsl | 11 +++++ 3 files changed, 100 insertions(+) create mode 100644 Tests/PHPWord/TemplateTest.php create mode 100644 Tests/_files/xsl/blank.xsl create mode 100644 Tests/_files/xsl/passthrough.xsl diff --git a/Tests/PHPWord/TemplateTest.php b/Tests/PHPWord/TemplateTest.php new file mode 100644 index 00000000..99d977b0 --- /dev/null +++ b/Tests/PHPWord/TemplateTest.php @@ -0,0 +1,85 @@ +load( + \join(\DIRECTORY_SEPARATOR, + array(\PHPWORD_TESTS_DIR_ROOT, '_files', 'xsl', 'passthrough.xsl')) + ); + + $template->applyXslStyleSheet($xslDOMDocument, [1 => 'somevalue']); + } + + /** + * @covers ::applyXslStyleSheet + * @expectedException Exception + * @expectedExceptionMessage Could not load XML from the given template. + * @test + */ + final public function testXslStyleSheetCanNotBeAppliedOnFailureOfLoadingXmlFromTemplate() + { + $template = new PHPWord_Template( + \join(\DIRECTORY_SEPARATOR, + array(\PHPWORD_TESTS_DIR_ROOT, '_files', 'templates', 'corrupted_main_document_part.docx')) + ); + + $xslDOMDocument = new \DOMDocument(); + $xslDOMDocument->load( + \join(\DIRECTORY_SEPARATOR, + array(\PHPWORD_TESTS_DIR_ROOT, '_files', 'xsl', 'passthrough.xsl')) + ); + + $template->applyXslStyleSheet($xslDOMDocument); + } + + /** + * @covers ::applyXslStyleSheet + * @expectedException Exception + * @expectedExceptionMessage Could not transform the given XML document. + * @test + */ + final public function testXslStyleSheetCanNotBeAppliedOnFailureOfTransformation() + { + $template = new PHPWord_Template( + \join(\DIRECTORY_SEPARATOR, + array(\PHPWORD_TESTS_DIR_ROOT, '_files', 'templates', 'blank.docx')) + ); + + $xslDOMDocument = new \DOMDocument(); + $xslDOMDocument->load( + \join(\DIRECTORY_SEPARATOR, + array(\PHPWORD_TESTS_DIR_ROOT, '_files', 'xsl', 'blank.xsl')) + ); + + $template->applyXslStyleSheet($xslDOMDocument); + } +} \ No newline at end of file diff --git a/Tests/_files/xsl/blank.xsl b/Tests/_files/xsl/blank.xsl new file mode 100644 index 00000000..48edfd43 --- /dev/null +++ b/Tests/_files/xsl/blank.xsl @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Tests/_files/xsl/passthrough.xsl b/Tests/_files/xsl/passthrough.xsl new file mode 100644 index 00000000..4ab21dd7 --- /dev/null +++ b/Tests/_files/xsl/passthrough.xsl @@ -0,0 +1,11 @@ + + + + + + + + + + \ No newline at end of file From fb5ef658dfb37832ac244e22770876e3b10c5b25 Mon Sep 17 00:00:00 2001 From: Roman Syroeshko Date: Sun, 2 Mar 2014 20:08:02 +0400 Subject: [PATCH 08/24] https://github.com/PHPOffice/PHPWord/issues/46 Compatibility with PHP 5.3 was fixed. --- Classes/PHPWord/Template.php | 4 ++-- Tests/PHPWord/TemplateTest.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Classes/PHPWord/Template.php b/Classes/PHPWord/Template.php index 28c77868..425bd413 100755 --- a/Classes/PHPWord/Template.php +++ b/Classes/PHPWord/Template.php @@ -80,10 +80,10 @@ class PHPWord_Template * Applies XSL style sheet to template's parts * * @param DOMDocument &$xslDOMDocument - * @param array $xslOptions = [] + * @param array $xslOptions = array() * @param string $xslOptionsURI = '' */ - public function applyXslStyleSheet(&$xslDOMDocument, $xslOptions = [], $xslOptionsURI = '') + public function applyXslStyleSheet(&$xslDOMDocument, $xslOptions = array(), $xslOptionsURI = '') { $processor = new \XSLTProcessor(); diff --git a/Tests/PHPWord/TemplateTest.php b/Tests/PHPWord/TemplateTest.php index 99d977b0..34ef6cb1 100644 --- a/Tests/PHPWord/TemplateTest.php +++ b/Tests/PHPWord/TemplateTest.php @@ -36,7 +36,7 @@ class PHPWord_TemplateTest extends \PHPUnit_Framework_TestCase array(\PHPWORD_TESTS_DIR_ROOT, '_files', 'xsl', 'passthrough.xsl')) ); - $template->applyXslStyleSheet($xslDOMDocument, [1 => 'somevalue']); + $template->applyXslStyleSheet($xslDOMDocument, array(1 => 'somevalue')); } /** From d324a6480817640ed8045023c4ad1e9efa04e9f9 Mon Sep 17 00:00:00 2001 From: Roman Syroeshko Date: Sun, 2 Mar 2014 20:14:19 +0400 Subject: [PATCH 09/24] https://github.com/PHPOffice/PHPWord/issues/46 FIXED: misprint in test's name. --- Tests/PHPWord/TemplateTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/PHPWord/TemplateTest.php b/Tests/PHPWord/TemplateTest.php index 34ef6cb1..5326b1c2 100644 --- a/Tests/PHPWord/TemplateTest.php +++ b/Tests/PHPWord/TemplateTest.php @@ -23,7 +23,7 @@ class PHPWord_TemplateTest extends \PHPUnit_Framework_TestCase * @expectedExceptionMessage Could not set values for the given XSL style sheet parameters. * @test */ - final public function testXsLStyleSheetCanNotBeAppliedOnFailureOfSettingParameterValue() + final public function testXslStyleSheetCanNotBeAppliedOnFailureOfSettingParameterValue() { $template = new PHPWord_Template( \join(\DIRECTORY_SEPARATOR, From a765d61b1537bce2c250d1a4fcdc64a22e6aba4b Mon Sep 17 00:00:00 2001 From: Roman Syroeshko Date: Sun, 2 Mar 2014 08:44:40 -0800 Subject: [PATCH 10/24] https://github.com/PHPOffice/PHPWord/issues/46 --- Tests/_files/templates/blank.docx | Bin 0 -> 3785 bytes .../templates/corrupted_main_document_part.docx | Bin 0 -> 3806 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 Tests/_files/templates/blank.docx create mode 100644 Tests/_files/templates/corrupted_main_document_part.docx diff --git a/Tests/_files/templates/blank.docx b/Tests/_files/templates/blank.docx new file mode 100644 index 0000000000000000000000000000000000000000..071b7f350d7220ca436181046a431e3445489e82 GIT binary patch literal 3785 zcmaJ^2{=^iAGS6I$<9Rx$#Tn*J=+jjvW_MDF4^~evSgQK!dPyy?@hKLd&6MJ9#Kif zTwC@q67iqu-b$YT?RTDYo^zh(yyrW=_xpYC@BMT&iAm@Q$jHbD5O(I*2~GqB?%vAV z!PQ6T3jPXzpruI+qKw)2%AmYH<0=@}H;m;{^5EJ9L}jn8j}8N_-hmCh7rCgh{r zg0?r=Ubqb(bBsmbzc}6x<~c$!+YE0QU0*hY%;2^38S4A3`=n zgsiL%k}XC7Zb{*Psz(&)HNGgN@#K3te(`aldIwrt-y8_{kLY2gBSBnu?+Mbqj1}dX zEQn8g^TksCPY5d4;L>Z(yprX}1D!MU#JtmnM2AnFhi6E}KC5xFaEWHE8kS>WfqsZ^ zKOdu(-T|WBEKlnrl)s{IP!{TTHsjN)+3C)z-J$NoY6Zo@tocQzN4aIu>cfCp#sEAW z`$EFV9$d0?zomobI~_g_zP@+dZ~NehP)XLL>Jp~BzW0#p6Fcp#%?h#_8}nE| zFW=CDIn;9cQ5NEolNw=Ydi%~lD(VC?=@Gr&^>mpRnAY`*wZRC%#Yu^1Xg)lXW5K?Z z*KQe#_$URy0?xF>+?W72v1RzcWtDeoyjnRL!!ofH_#FLTCc{f`8I0o2|DJN%?>Rbp zxceH|*t$C4lZ5LIXrqLw+qM~C8xsY9sKQdii`~Fo#Q}ipjFw%$3;kbt#U@ke7;EW*x5FoizYdL!~RORl!WKu$OC1ycF}`WR@~*Q*;(SaA?_hJ2q`nJr8ehj2HC~4`F;7v!7>Fy%1L*WVR}j zRTn_Y8UW1oy^DoAKDYx}q3yUtJlAZktTTn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Final keyword was removed in test class. --- Tests/PHPWord/TemplateTest.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Tests/PHPWord/TemplateTest.php b/Tests/PHPWord/TemplateTest.php index 5326b1c2..bd8e98e2 100644 --- a/Tests/PHPWord/TemplateTest.php +++ b/Tests/PHPWord/TemplateTest.php @@ -12,7 +12,7 @@ class PHPWord_TemplateTest extends \PHPUnit_Framework_TestCase * @covers ::applyXslStyleSheet * @test */ - final public function testXslStyleSheetCanBeApplied() + public function testXslStyleSheetCanBeApplied() { // TODO: implement after merge of the issue https://github.com/PHPOffice/PHPWord/issues/56 } @@ -23,7 +23,7 @@ class PHPWord_TemplateTest extends \PHPUnit_Framework_TestCase * @expectedExceptionMessage Could not set values for the given XSL style sheet parameters. * @test */ - final public function testXslStyleSheetCanNotBeAppliedOnFailureOfSettingParameterValue() + public function testXslStyleSheetCanNotBeAppliedOnFailureOfSettingParameterValue() { $template = new PHPWord_Template( \join(\DIRECTORY_SEPARATOR, @@ -45,7 +45,7 @@ class PHPWord_TemplateTest extends \PHPUnit_Framework_TestCase * @expectedExceptionMessage Could not load XML from the given template. * @test */ - final public function testXslStyleSheetCanNotBeAppliedOnFailureOfLoadingXmlFromTemplate() + public function testXslStyleSheetCanNotBeAppliedOnFailureOfLoadingXmlFromTemplate() { $template = new PHPWord_Template( \join(\DIRECTORY_SEPARATOR, @@ -67,7 +67,7 @@ class PHPWord_TemplateTest extends \PHPUnit_Framework_TestCase * @expectedExceptionMessage Could not transform the given XML document. * @test */ - final public function testXslStyleSheetCanNotBeAppliedOnFailureOfTransformation() + public function testXslStyleSheetCanNotBeAppliedOnFailureOfTransformation() { $template = new PHPWord_Template( \join(\DIRECTORY_SEPARATOR, @@ -82,4 +82,4 @@ class PHPWord_TemplateTest extends \PHPUnit_Framework_TestCase $template->applyXslStyleSheet($xslDOMDocument); } -} \ No newline at end of file +} From e0e48938fa8dc6f52133c85466ee2cd6b1ca1cbd Mon Sep 17 00:00:00 2001 From: Roman Syroeshko Date: Sun, 2 Mar 2014 10:06:27 -0800 Subject: [PATCH 12/24] https://github.com/PHPOffice/PHPWord/issues/46 Boolean values now meet PHP-FIG. --- Classes/PHPWord/Template.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Classes/PHPWord/Template.php b/Classes/PHPWord/Template.php index 425bd413..039b350f 100755 --- a/Classes/PHPWord/Template.php +++ b/Classes/PHPWord/Template.php @@ -89,17 +89,17 @@ class PHPWord_Template $processor->importStylesheet($xslDOMDocument); - if ($processor->setParameter($xslOptionsURI, $xslOptions) === \FALSE) { + if ($processor->setParameter($xslOptionsURI, $xslOptions) === false) { throw new \Exception('Could not set values for the given XSL style sheet parameters.'); } $xmlDOMDocument = new \DOMDocument(); - if ($xmlDOMDocument->loadXML($this->_documentXML) === \FALSE) { + if ($xmlDOMDocument->loadXML($this->_documentXML) === false) { throw new \Exception('Could not load XML from the given template.'); } $xmlTransformed = $processor->transformToXml($xmlDOMDocument); - if ($xmlTransformed === \FALSE) { + if ($xmlTransformed === false) { throw new \Exception('Could not transform the given XML document.'); } From 1c3ebe1f919f0b013973da2be3a80ea95dfe2b12 Mon Sep 17 00:00:00 2001 From: Roman Syroeshko Date: Mon, 3 Mar 2014 16:53:00 +0400 Subject: [PATCH 13/24] https://github.com/PHPOffice/PHPWord/issues/46 An attempt to fix tests. --- Tests/PHPWord/TemplateTest.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Tests/PHPWord/TemplateTest.php b/Tests/PHPWord/TemplateTest.php index bd8e98e2..d80b1bbd 100644 --- a/Tests/PHPWord/TemplateTest.php +++ b/Tests/PHPWord/TemplateTest.php @@ -12,7 +12,7 @@ class PHPWord_TemplateTest extends \PHPUnit_Framework_TestCase * @covers ::applyXslStyleSheet * @test */ - public function testXslStyleSheetCanBeApplied() + final public function testXslStyleSheetCanBeApplied() { // TODO: implement after merge of the issue https://github.com/PHPOffice/PHPWord/issues/56 } @@ -23,7 +23,7 @@ class PHPWord_TemplateTest extends \PHPUnit_Framework_TestCase * @expectedExceptionMessage Could not set values for the given XSL style sheet parameters. * @test */ - public function testXslStyleSheetCanNotBeAppliedOnFailureOfSettingParameterValue() + final public function testXsLStyleSheetCanNotBeAppliedOnFailureOfSettingParameterValue() { $template = new PHPWord_Template( \join(\DIRECTORY_SEPARATOR, @@ -36,7 +36,7 @@ class PHPWord_TemplateTest extends \PHPUnit_Framework_TestCase array(\PHPWORD_TESTS_DIR_ROOT, '_files', 'xsl', 'passthrough.xsl')) ); - $template->applyXslStyleSheet($xslDOMDocument, array(1 => 'somevalue')); + @$template->applyXslStyleSheet($xslDOMDocument, [1 => 'somevalue']); } /** @@ -45,7 +45,7 @@ class PHPWord_TemplateTest extends \PHPUnit_Framework_TestCase * @expectedExceptionMessage Could not load XML from the given template. * @test */ - public function testXslStyleSheetCanNotBeAppliedOnFailureOfLoadingXmlFromTemplate() + final public function testXslStyleSheetCanNotBeAppliedOnFailureOfLoadingXmlFromTemplate() { $template = new PHPWord_Template( \join(\DIRECTORY_SEPARATOR, @@ -58,7 +58,7 @@ class PHPWord_TemplateTest extends \PHPUnit_Framework_TestCase array(\PHPWORD_TESTS_DIR_ROOT, '_files', 'xsl', 'passthrough.xsl')) ); - $template->applyXslStyleSheet($xslDOMDocument); + @$template->applyXslStyleSheet($xslDOMDocument); } /** @@ -67,7 +67,7 @@ class PHPWord_TemplateTest extends \PHPUnit_Framework_TestCase * @expectedExceptionMessage Could not transform the given XML document. * @test */ - public function testXslStyleSheetCanNotBeAppliedOnFailureOfTransformation() + final public function testXslStyleSheetCanNotBeAppliedOnFailureOfTransformation() { $template = new PHPWord_Template( \join(\DIRECTORY_SEPARATOR, @@ -80,6 +80,6 @@ class PHPWord_TemplateTest extends \PHPUnit_Framework_TestCase array(\PHPWORD_TESTS_DIR_ROOT, '_files', 'xsl', 'blank.xsl')) ); - $template->applyXslStyleSheet($xslDOMDocument); + @$template->applyXslStyleSheet($xslDOMDocument); } -} +} \ No newline at end of file From bdcbd149e7809b580dce978daa56662fa538a2f5 Mon Sep 17 00:00:00 2001 From: Roman Syroeshko Date: Mon, 3 Mar 2014 17:03:09 +0400 Subject: [PATCH 14/24] https://github.com/PHPOffice/PHPWord/issues/46 FIXED (again): compatibility with PHP 5.3. FIXED (again): misprint in method name. --- Tests/PHPWord/TemplateTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tests/PHPWord/TemplateTest.php b/Tests/PHPWord/TemplateTest.php index d80b1bbd..c821323b 100644 --- a/Tests/PHPWord/TemplateTest.php +++ b/Tests/PHPWord/TemplateTest.php @@ -23,7 +23,7 @@ class PHPWord_TemplateTest extends \PHPUnit_Framework_TestCase * @expectedExceptionMessage Could not set values for the given XSL style sheet parameters. * @test */ - final public function testXsLStyleSheetCanNotBeAppliedOnFailureOfSettingParameterValue() + final public function testXslStyleSheetCanNotBeAppliedOnFailureOfSettingParameterValue() { $template = new PHPWord_Template( \join(\DIRECTORY_SEPARATOR, @@ -36,7 +36,7 @@ class PHPWord_TemplateTest extends \PHPUnit_Framework_TestCase array(\PHPWORD_TESTS_DIR_ROOT, '_files', 'xsl', 'passthrough.xsl')) ); - @$template->applyXslStyleSheet($xslDOMDocument, [1 => 'somevalue']); + @$template->applyXslStyleSheet($xslDOMDocument, array(1 => 'somevalue')); } /** From ec5322d9ab5a0ecfb011d1046cf551e28c7a3ef6 Mon Sep 17 00:00:00 2001 From: Roman Syroeshko Date: Mon, 3 Mar 2014 08:15:51 -0800 Subject: [PATCH 15/24] https://github.com/PHPOffice/PHPWord/issues/46 --- .../templates/empty_main_document_part.docx | Bin 0 -> 3425 bytes Tests/_files/xsl/blank.xsl | 4 ---- 2 files changed, 4 deletions(-) create mode 100644 Tests/_files/templates/empty_main_document_part.docx delete mode 100644 Tests/_files/xsl/blank.xsl diff --git a/Tests/_files/templates/empty_main_document_part.docx b/Tests/_files/templates/empty_main_document_part.docx new file mode 100644 index 0000000000000000000000000000000000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)bm5oDWeh80i6kD&%5AxyR(*lmo z?n#%3GrOnbto7AYJDq*f2;uC`aZF+_|IYsDD{<*^fM2;K?!U4*uxDxPQvczdNCCJ< z0016<5#Y7D5w#~ah-X3fIpXB`>< z${=n&A4dh2o`0tQJ+03spA-$8QXYpH@UP@w=;qlko!k>RkvR?*tUmt_$vOLhlN7>j bo#PlKIkk~A)rijF9+F^x=2(Q6esuf4k!)p4 literal 0 HcmV?d00001 diff --git a/Tests/_files/xsl/blank.xsl b/Tests/_files/xsl/blank.xsl deleted file mode 100644 index 48edfd43..00000000 --- a/Tests/_files/xsl/blank.xsl +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file From bfe7da63fc4b814ce44396065c6ad26ded5afaef Mon Sep 17 00:00:00 2001 From: Roman Syroeshko Date: Mon, 3 Mar 2014 20:16:59 +0400 Subject: [PATCH 16/24] https://github.com/PHPOffice/PHPWord/issues/46 FIXED: last negative test. --- Tests/PHPWord/TemplateTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tests/PHPWord/TemplateTest.php b/Tests/PHPWord/TemplateTest.php index c821323b..748c8d77 100644 --- a/Tests/PHPWord/TemplateTest.php +++ b/Tests/PHPWord/TemplateTest.php @@ -71,13 +71,13 @@ class PHPWord_TemplateTest extends \PHPUnit_Framework_TestCase { $template = new PHPWord_Template( \join(\DIRECTORY_SEPARATOR, - array(\PHPWORD_TESTS_DIR_ROOT, '_files', 'templates', 'blank.docx')) + array(\PHPWORD_TESTS_DIR_ROOT, '_files', 'templates', 'empty_main_document_part.docx')) ); $xslDOMDocument = new \DOMDocument(); $xslDOMDocument->load( \join(\DIRECTORY_SEPARATOR, - array(\PHPWORD_TESTS_DIR_ROOT, '_files', 'xsl', 'blank.xsl')) + array(\PHPWORD_TESTS_DIR_ROOT, '_files', 'xsl', 'passthrough.xsl')) ); @$template->applyXslStyleSheet($xslDOMDocument); From a8b73b9061166e1997cbc7b2866e6856aa2b517b Mon Sep 17 00:00:00 2001 From: Roman Syroeshko Date: Mon, 3 Mar 2014 20:36:02 +0400 Subject: [PATCH 17/24] https://github.com/PHPOffice/PHPWord/issues/46 FIXED: tests (last test was removed, because there is no chance to make it work). --- Tests/PHPWord/TemplateTest.php | 22 ------------------ .../templates/empty_main_document_part.docx | Bin 3425 -> 0 bytes 2 files changed, 22 deletions(-) delete mode 100644 Tests/_files/templates/empty_main_document_part.docx diff --git a/Tests/PHPWord/TemplateTest.php b/Tests/PHPWord/TemplateTest.php index 748c8d77..7ea31f64 100644 --- a/Tests/PHPWord/TemplateTest.php +++ b/Tests/PHPWord/TemplateTest.php @@ -60,26 +60,4 @@ class PHPWord_TemplateTest extends \PHPUnit_Framework_TestCase @$template->applyXslStyleSheet($xslDOMDocument); } - - /** - * @covers ::applyXslStyleSheet - * @expectedException Exception - * @expectedExceptionMessage Could not transform the given XML document. - * @test - */ - final public function testXslStyleSheetCanNotBeAppliedOnFailureOfTransformation() - { - $template = new PHPWord_Template( - \join(\DIRECTORY_SEPARATOR, - array(\PHPWORD_TESTS_DIR_ROOT, '_files', 'templates', 'empty_main_document_part.docx')) - ); - - $xslDOMDocument = new \DOMDocument(); - $xslDOMDocument->load( - \join(\DIRECTORY_SEPARATOR, - array(\PHPWORD_TESTS_DIR_ROOT, '_files', 'xsl', 'passthrough.xsl')) - ); - - @$template->applyXslStyleSheet($xslDOMDocument); - } } \ No newline at end of file diff --git a/Tests/_files/templates/empty_main_document_part.docx b/Tests/_files/templates/empty_main_document_part.docx deleted file mode 100644 index f3ebe478d90f27686dad9594358f37e0d77702e3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3425 zcmai02|QGL8y;I@%e9j|B+HENo%`XOZrqzD0(;`-m7@fecx5*8)==M zZbt=_nS4*VLYc=^@v55l#yM!WB#XnwyvyDVYuGhI87hSL zW9FRdf1o$lCFx7MMz&~MW@(WerE6KC0-5PRYd`+p+VE7oEAIjiL#G7v$c|zSMY4l7 zMx8ysFukE#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!)p4 From b76531246952b585b7db8b7cbfbe0cc8bcf6bd53 Mon Sep 17 00:00:00 2001 From: Roman Syroeshko Date: Mon, 3 Mar 2014 21:12:05 +0400 Subject: [PATCH 18/24] https://github.com/PHPOffice/PHPWord/issues/46 FIXED: indentation. --- Classes/PHPWord/Template.php | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/Classes/PHPWord/Template.php b/Classes/PHPWord/Template.php index 039b350f..d93cd0c6 100755 --- a/Classes/PHPWord/Template.php +++ b/Classes/PHPWord/Template.php @@ -64,7 +64,7 @@ class PHPWord_Template if ($this->_tempFileName !== false) { // Copy the source File to the temp File if (!copy($strFilename, $this->_tempFileName)) { - throw new PHPWord_Exception('Could not copy the template from ' . $strFilename . ' to ' . $this->_tempFileName . '.'); + throw new PHPWord_Exception("Could not copy the template from {$strFilename} to {$this->_tempFileName}."); } $this->_objZip = new ZipArchive(); @@ -85,25 +85,25 @@ class PHPWord_Template */ public function applyXslStyleSheet(&$xslDOMDocument, $xslOptions = array(), $xslOptionsURI = '') { - $processor = new \XSLTProcessor(); + $processor = new \XSLTProcessor(); - $processor->importStylesheet($xslDOMDocument); + $processor->importStylesheet($xslDOMDocument); - if ($processor->setParameter($xslOptionsURI, $xslOptions) === false) { - throw new \Exception('Could not set values for the given XSL style sheet parameters.'); - } + if ($processor->setParameter($xslOptionsURI, $xslOptions) === false) { + throw new \Exception('Could not set values for the given XSL style sheet parameters.'); + } - $xmlDOMDocument = new \DOMDocument(); - if ($xmlDOMDocument->loadXML($this->_documentXML) === false) { - throw new \Exception('Could not load XML from the given template.'); - } + $xmlDOMDocument = new \DOMDocument(); + if ($xmlDOMDocument->loadXML($this->_documentXML) === false) { + throw new \Exception('Could not load XML from the given template.'); + } - $xmlTransformed = $processor->transformToXml($xmlDOMDocument); - if ($xmlTransformed === false) { - throw new \Exception('Could not transform the given XML document.'); - } + $xmlTransformed = $processor->transformToXml($xmlDOMDocument); + if ($xmlTransformed === false) { + throw new \Exception('Could not transform the given XML document.'); + } - $this->_documentXML = $xmlTransformed; + $this->_documentXML = $xmlTransformed; } /** From 670765f80f1e7fc94137dcd6c3bd6868d19c84b8 Mon Sep 17 00:00:00 2001 From: Roman Syroeshko Date: Tue, 4 Mar 2014 14:36:39 +0400 Subject: [PATCH 19/24] https://github.com/PHPOffice/PHPWord/issues/46 Notes on error control usage were added. --- Tests/PHPWord/TemplateTest.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Tests/PHPWord/TemplateTest.php b/Tests/PHPWord/TemplateTest.php index 7ea31f64..643fa29c 100644 --- a/Tests/PHPWord/TemplateTest.php +++ b/Tests/PHPWord/TemplateTest.php @@ -36,6 +36,10 @@ class PHPWord_TemplateTest extends \PHPUnit_Framework_TestCase array(\PHPWORD_TESTS_DIR_ROOT, '_files', 'xsl', 'passthrough.xsl')) ); + /* + * We have to use error control below, because XSLTProcessor::setParameter omits warning on failure. + * This warning fails the test. + */ @$template->applyXslStyleSheet($xslDOMDocument, array(1 => 'somevalue')); } @@ -58,6 +62,10 @@ class PHPWord_TemplateTest extends \PHPUnit_Framework_TestCase array(\PHPWORD_TESTS_DIR_ROOT, '_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); } } \ No newline at end of file From 60c21a2feeabe5334604d7252da901b8f9bdfa72 Mon Sep 17 00:00:00 2001 From: Roman Syroeshko Date: Fri, 7 Mar 2014 17:47:23 +0400 Subject: [PATCH 20/24] https://github.com/PHPOffice/PHPWord/issues/46 Positive test. --- Tests/PHPWord/TemplateTest.php | 65 +++++++++++++++++--- Tests/_files/xsl/remove_tables_by_needle.xsl | 24 ++++++++ 2 files changed, 80 insertions(+), 9 deletions(-) create mode 100644 Tests/_files/xsl/remove_tables_by_needle.xsl diff --git a/Tests/PHPWord/TemplateTest.php b/Tests/PHPWord/TemplateTest.php index 643fa29c..a6211474 100644 --- a/Tests/PHPWord/TemplateTest.php +++ b/Tests/PHPWord/TemplateTest.php @@ -14,7 +14,46 @@ class PHPWord_TemplateTest extends \PHPUnit_Framework_TestCase */ final public function testXslStyleSheetCanBeApplied() { - // TODO: implement after merge of the issue https://github.com/PHPOffice/PHPWord/issues/56 + $template = new PHPWord_Template( + \join( + \DIRECTORY_SEPARATOR, + array(\PHPWORD_TESTS_DIR_ROOT, '_files', 'templates', 'with_table_macros.docx') + ) + ); + + $xslDOMDocument = new \DOMDocument(); + $xslDOMDocument->load( + \join( + \DIRECTORY_SEPARATOR, + array(\PHPWORD_TESTS_DIR_ROOT, '_files', 'xsl', 'remove_tables_by_needle.xsl') + ) + ); + + foreach (array('${employee.', '${scoreboard.') as $needle) { + $template->applyXslStyleSheet($xslDOMDocument, array('needle' => $needle)); + } + + $actualDocument = $template->save(); + $expectedDocument = \join( + \DIRECTORY_SEPARATOR, + array(\PHPWORD_TESTS_DIR_ROOT, '_files', 'documents', 'without_table_macros.docx') + ); + + $actualZip = new ZipArchive(); + $actualZip->open($actualDocument); + $actualXml = $zip->getFromName('word/document.xml'); + if ($actualZip->close() === false) { + throw new \Exception('Could not close zip file "' . $actualDocument . '".'); + } + + $expectedZip = new ZipArchive(); + $expectedZip->open($expectedDocument); + $expectedXml = $zip->getFromName('word/document.xml'); + if ($expectedZip->close() === false) { + throw new \Exception('Could not close zip file "' . $expectedDocument . '".'); + } + + $this->assertXmlStringEqualsXmlString(expectedXml, actualXml); } /** @@ -26,14 +65,18 @@ class PHPWord_TemplateTest extends \PHPUnit_Framework_TestCase final public function testXslStyleSheetCanNotBeAppliedOnFailureOfSettingParameterValue() { $template = new PHPWord_Template( - \join(\DIRECTORY_SEPARATOR, - array(\PHPWORD_TESTS_DIR_ROOT, '_files', 'templates', 'blank.docx')) + \join( + \DIRECTORY_SEPARATOR, + array(\PHPWORD_TESTS_DIR_ROOT, '_files', 'templates', 'blank.docx') + ) ); $xslDOMDocument = new \DOMDocument(); $xslDOMDocument->load( - \join(\DIRECTORY_SEPARATOR, - array(\PHPWORD_TESTS_DIR_ROOT, '_files', 'xsl', 'passthrough.xsl')) + \join( + \DIRECTORY_SEPARATOR, + array(\PHPWORD_TESTS_DIR_ROOT, '_files', 'xsl', 'passthrough.xsl') + ) ); /* @@ -52,14 +95,18 @@ class PHPWord_TemplateTest extends \PHPUnit_Framework_TestCase final public function testXslStyleSheetCanNotBeAppliedOnFailureOfLoadingXmlFromTemplate() { $template = new PHPWord_Template( - \join(\DIRECTORY_SEPARATOR, - array(\PHPWORD_TESTS_DIR_ROOT, '_files', 'templates', 'corrupted_main_document_part.docx')) + \join( + \DIRECTORY_SEPARATOR, + array(\PHPWORD_TESTS_DIR_ROOT, '_files', 'templates', 'corrupted_main_document_part.docx') + ) ); $xslDOMDocument = new \DOMDocument(); $xslDOMDocument->load( - \join(\DIRECTORY_SEPARATOR, - array(\PHPWORD_TESTS_DIR_ROOT, '_files', 'xsl', 'passthrough.xsl')) + \join( + \DIRECTORY_SEPARATOR, + array(\PHPWORD_TESTS_DIR_ROOT, '_files', 'xsl', 'passthrough.xsl') + ) ); /* diff --git a/Tests/_files/xsl/remove_tables_by_needle.xsl b/Tests/_files/xsl/remove_tables_by_needle.xsl new file mode 100644 index 00000000..1a7b1369 --- /dev/null +++ b/Tests/_files/xsl/remove_tables_by_needle.xsl @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + From 657e8345b3450a5b62f8a97851d67ab3ec66d2d4 Mon Sep 17 00:00:00 2001 From: Roman Syroeshko Date: Fri, 7 Mar 2014 05:54:09 -0800 Subject: [PATCH 21/24] https://github.com/PHPOffice/PHPWord/issues/46 --- Tests/_files/documents/without_table_macros.docx | Bin 0 -> 5083 bytes Tests/_files/templates/with_table_macros.docx | Bin 0 -> 5375 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 Tests/_files/documents/without_table_macros.docx create mode 100644 Tests/_files/templates/with_table_macros.docx diff --git a/Tests/_files/documents/without_table_macros.docx b/Tests/_files/documents/without_table_macros.docx new file mode 100644 index 0000000000000000000000000000000000000000..e4e9767fc1aa165ae5b86947c9af49950cb5b787 GIT binary patch literal 5083 zcmai21y~e&_g=bTNs*9{ZUh18QcAiz7wPVhZbdo-q#Hy5X@R8{1eOL#>2MJg>HK!@ zckd_H|98LtnP;DwXJ^jLoOjN7-*bLyN+_r#08C6wK)l^ES->p=!jG+-E!EtdUEI0N zU0k?)9365Jz$)E5K-v9($5yV6yG*teY|NxYtKq0o0LZ8JGu7%AhQ}J?9gtvI|2@~k zBEh=B#-IGwa+qU6^GP76Ji3lBXt$lQ=4!2gPG8nMl{_aREt@vU(YxC;^e1psawrMh zmqrD=iX3Ml;EBm#b|4<(dWx)x>;JW0faqTKWp*b$CwV375T;Iu!D$fP8J|V4|i_kzS8FDBfVPnKRi!F~$yR<*|beraE*ZL-c$B)Z(u(V$pC?vecoUCVNax~rtNt3$XO&QMr%Xz;bTx1#s~q|`5>;zdy-@4)JA zyUHE@ksazYj_(~8g$WH$1p~vN{(sBIqrS5LPD{ey*62r+wM;#uc3St9n)uYZ+)cJAF{;l z@85KAFtyJzX`R7@6f@uAYc%$dsgAv3-$Op`(+2DXODD5t)xk(59v;-;{kFvjBI+Azk4H#Z&F#}sdFr3kSK zwM=-4`4Si=BPKS5@N4L+^wqx}t5q%);{wQ%b^elOmRt!5uayhgm<4lHs?=D3M#0X5)y!i-{NFa?pE?)kO3{_I|w8+K5(OS9J_!N}8<>Ov&E6B@6WK1RLJ5CeO5n_r=g6>gKpvm2e?6NJPw#ak&S%HKpqjx1b>DDj|xJ^r`sq zvZ$F|Wuj`N4cGpkRYUZgOZtI`@{om1K72D(zI%??ot( z%Qx$Kr#X_+Le^au#le17fb0&11<8%Xmm&=947s$h`M?p*oDr5TB`HBzBmMh&q{jvP zF0WvncuDHli}0v)yuvvu3hP*)l9jVV66L5j~oZOuV@x%)F~hO=apetgY= z%eZ8rV=Lh6e)^i(IfeBr$;&3$&)UJPozs;rRnT}+lP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;bw_jP5qNN_HnAFFjgFg-ZkqP(H(cqy7<253llrY4!t??V+I1;NtAKWY%F+03R#U8ywgfo`Ewki0 zfhZ#|F`Y6N;?kw>cZ5AAJQUl}n@EcNGiZVli#;@%!3uAjRTf?u!(*$K8<#x&I=!8m zg{YKi2u00T>)e~_;+b`%Yq`qviyF4p6NW5LvVF3!_dIxx5t9y!XA4mhXtGcj1yhuR zYs)-Uz11g`*5BT$?lJFuFC1Y#XMOt<5E@?|A7EH8&}3DTz?$D$npRyhrNzj>DZQ0L z)a~BC3C1g0-*@_UhipCK{P+Y0#1Gbp|L+OsuG#n-nX!%i9|H~~Mns{D5+Az%CM?JU z9pXeh;S3y>PbJ!2UVhtNLqjO-Q!(3+G+mx%3WeT6qo5u=_LVbc!0CSZBt|)uFySM4 zsrh&_-O6Pk{`1jV14vPhIMCKia~^+AaY56yE(30x?gL{;ZQfkG*>+0~5nn4(j}9&h zS!dihkvox{P z8cQD*uKKA=P+;i1P*{@P&q(huB#NcV8XNNt<6#@!pHw$4hAPhV%qAGNU)_B6}B`FN+#lND(gQ3+HgAI-_kw9O?%@*vSd$%E5;yDyx8#3_h zCajNHnv@7z^d&DPhiEW6jj=v%cz3;LVeM_EgBcCtJDl1ojq2+?uhI3m@HNwoI4;+z z>G&P~K}~oGtpYji>flT67NbE6r73M-a`d!8e-ri`*E%B~5u)j|Z%$nAr3m88Wg;I{ z)(iA&>QT1FT6!N;^APf~$9t&jb$%vvo*(cK;vY6-kjhg z^~TY^<;W@^D7(&eYw7qA{q}`m00hf>JaF8F@b<^90*L|dqX6z;`)J#>axwY#JmdDD z#{}=Kkc4)^}FMJf#Xiq`DM7UTm75H^ZQEoWrVv_`ejtGKL3xE?#m;;yWby_@3e+r zh6Ed(|8W0@^6 Date: Fri, 7 Mar 2014 17:58:56 +0400 Subject: [PATCH 22/24] https://github.com/PHPOffice/PHPWord/issues/46 Fix for positive test. --- Tests/PHPWord/TemplateTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tests/PHPWord/TemplateTest.php b/Tests/PHPWord/TemplateTest.php index a6211474..77f1ee4e 100644 --- a/Tests/PHPWord/TemplateTest.php +++ b/Tests/PHPWord/TemplateTest.php @@ -39,14 +39,14 @@ class PHPWord_TemplateTest extends \PHPUnit_Framework_TestCase array(\PHPWORD_TESTS_DIR_ROOT, '_files', 'documents', 'without_table_macros.docx') ); - $actualZip = new ZipArchive(); + $actualZip = new \ZipArchive(); $actualZip->open($actualDocument); $actualXml = $zip->getFromName('word/document.xml'); if ($actualZip->close() === false) { throw new \Exception('Could not close zip file "' . $actualDocument . '".'); } - $expectedZip = new ZipArchive(); + $expectedZip = new \ZipArchive(); $expectedZip->open($expectedDocument); $expectedXml = $zip->getFromName('word/document.xml'); if ($expectedZip->close() === false) { From 379e5ce2e87ac94e20d30e5301e8d3cb559221dd Mon Sep 17 00:00:00 2001 From: Roman Syroeshko Date: Fri, 7 Mar 2014 18:04:44 +0400 Subject: [PATCH 23/24] https://github.com/PHPOffice/PHPWord/issues/46 Positive test fix. --- Tests/PHPWord/TemplateTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tests/PHPWord/TemplateTest.php b/Tests/PHPWord/TemplateTest.php index 77f1ee4e..8ad6c145 100644 --- a/Tests/PHPWord/TemplateTest.php +++ b/Tests/PHPWord/TemplateTest.php @@ -41,14 +41,14 @@ class PHPWord_TemplateTest extends \PHPUnit_Framework_TestCase $actualZip = new \ZipArchive(); $actualZip->open($actualDocument); - $actualXml = $zip->getFromName('word/document.xml'); + $actualXml = $actualZip->getFromName('word/document.xml'); if ($actualZip->close() === false) { throw new \Exception('Could not close zip file "' . $actualDocument . '".'); } $expectedZip = new \ZipArchive(); $expectedZip->open($expectedDocument); - $expectedXml = $zip->getFromName('word/document.xml'); + $expectedXml = $expectedZip->getFromName('word/document.xml'); if ($expectedZip->close() === false) { throw new \Exception('Could not close zip file "' . $expectedDocument . '".'); } From 4c414c8524f48fb3eab584f943deab78258eb679 Mon Sep 17 00:00:00 2001 From: Roman Syroeshko Date: Fri, 7 Mar 2014 18:09:44 +0400 Subject: [PATCH 24/24] https://github.com/PHPOffice/PHPWord/issues/46 Positive test fix #3. --- Tests/PHPWord/TemplateTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/PHPWord/TemplateTest.php b/Tests/PHPWord/TemplateTest.php index 8ad6c145..1cc30639 100644 --- a/Tests/PHPWord/TemplateTest.php +++ b/Tests/PHPWord/TemplateTest.php @@ -53,7 +53,7 @@ class PHPWord_TemplateTest extends \PHPUnit_Framework_TestCase throw new \Exception('Could not close zip file "' . $expectedDocument . '".'); } - $this->assertXmlStringEqualsXmlString(expectedXml, actualXml); + $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml); } /**