@@ -861,6 +861,7 @@ public function testSetImageValue(): void
861
861
$ templateProcessor = $ this ->getTemplateProcessor (__DIR__ . '/_files/templates/header-footer.docx ' );
862
862
$ imageJpg = __DIR__ . '/_files/images/earth.jpg ' ;
863
863
$ imageGif = __DIR__ . '/_files/images/mario.gif ' ;
864
+ $ imagePng = __DIR__ . '/_files/images/firefox.png ' ;
864
865
$ imageSvg = __DIR__ . '/_files/images/phpword.svg ' ;
865
866
866
867
$ variablesReplace = [
@@ -909,16 +910,17 @@ public function testSetImageValue(): void
909
910
$ phpWord = new PhpWord ();
910
911
$ section = $ phpWord ->addSection ();
911
912
$ section ->addText ('${Test0:width=100:ratio=true} ' );
912
- $ section ->addText ('${Test1:height=50:ratio=true} ' );
913
- $ section ->addText ('${Test2:width=10cm:height=7cm:ratio=false} ' );
913
+ $ section ->addText ('${Test1::50:true} ' );
914
+ $ section ->addText ('${Test2:size=10cmx7cm:ratio=false} ' );
915
+ $ section ->addText ('${Test3} ' );
914
916
$ objWriter = IOFactory::createWriter ($ phpWord , 'Word2007 ' );
915
917
$ objWriter ->save ($ testFileName );
916
918
self ::assertFileExists ($ testFileName , "Generated file ' {$ testFileName }' not found! " );
917
919
918
920
$ resultFileName = 'images-test-result.docx ' ;
919
921
$ templateProcessor = new TemplateProcessor ($ testFileName );
920
922
unlink ($ testFileName );
921
- $ templateProcessor ->setImageValue (['Test0 ' , 'Test1 ' , 'Test2 ' ], [$ imageJpg , $ imageGif , $ imageSvg ]);
923
+ $ templateProcessor ->setImageValue (['Test0 ' , 'Test1 ' , 'Test2 ' , ' Test3 ' ], [$ imageJpg , $ imageGif , $ imageSvg, $ imagePng ]);
922
924
$ templateProcessor ->saveAs ($ resultFileName );
923
925
self ::assertFileExists ($ resultFileName , "Generated file ' {$ resultFileName }' not found! " );
924
926
@@ -930,7 +932,7 @@ public function testSetImageValue(): void
930
932
}
931
933
unlink ($ resultFileName );
932
934
933
- self ::assertStringNotContainsString ('${Test} ' , $ expectedMainPartXml , 'word/document.xml has no image. ' );
935
+ self ::assertStringNotContainsString ('${Test ' , $ expectedMainPartXml , 'word/document.xml has no image. ' );
934
936
}
935
937
936
938
/**
0 commit comments