', $result);
+ }
+}
diff --git a/tests/PhpWordTests/Writer/WPSTest.php b/tests/PhpWordTests/Writer/WPSTest.php
new file mode 100644
index 0000000000..766d4635c5
--- /dev/null
+++ b/tests/PhpWordTests/Writer/WPSTest.php
@@ -0,0 +1,111 @@
+addSection();
+ $section->addText('Hello, WPS!');
+
+ $writer = new WPS($phpWord);
+ $tempFile = tempnam(sys_get_temp_dir(), 'wps');
+ $writer->save($tempFile);
+
+ self::assertFileExists($tempFile);
+
+ // Test ZIP archive content
+ $zip = new ZipArchive();
+ $zip->open($tempFile);
+
+ // Verify required files exist
+ self::assertTrue($zip->locateName('content.xml') !== false);
+ self::assertTrue($zip->locateName('meta.xml') !== false);
+ self::assertTrue($zip->locateName('META-INF/manifest.xml') !== false);
+
+ $zip->close();
+
+ $content = file_get_contents($tempFile);
+ if (is_string($content)) {
+ self::assertEquals('PK', substr($content, 0, 2));
+ }
+
+ unlink($tempFile);
+ }
+
+ public function testWriterParts(): void
+ {
+ $phpWord = new PhpWord();
+ $writer = new WPS($phpWord);
+
+ // Test the writer parts are initialized correctly
+ self::assertInstanceOf('PhpOffice\\PhpWord\\Writer\\WPS\\Part\\Content', $writer->getWriterPart('content'));
+ self::assertInstanceOf('PhpOffice\\PhpWord\\Writer\\WPS\\Part\\Meta', $writer->getWriterPart('meta'));
+ self::assertInstanceOf('PhpOffice\\PhpWord\\Writer\\WPS\\Part\\Manifest', $writer->getWriterPart('manifest'));
+ }
+
+ public function testWithMedia(): void
+ {
+ $phpWord = new PhpWord();
+ $section = $phpWord->addSection();
+
+ // Add an image to the document
+ $imagePath = __DIR__ . '../tests/PhpWordTests/_files/images/earth.jpg';
+ $section->addImage($imagePath);
+
+ // Create header and add an image to it
+ $header = $section->addHeader();
+ $header->addImage($imagePath);
+
+ // Create footer and add an image to it
+ $footer = $section->addFooter();
+ $footer->addImage($imagePath);
+
+ $writer = new WPS($phpWord);
+ $tempFile = tempnam(sys_get_temp_dir(), 'wps');
+ $writer->save($tempFile);
+
+ // Test ZIP archive contains images
+ $zip = new ZipArchive();
+ $zip->open($tempFile);
+
+ // The exact path to images depends on the media handler implementation
+ // Just verify the Pictures directory exists
+ self::assertTrue($zip->locateName('Pictures/') !== false);
+
+ $zip->close();
+ unlink($tempFile);
+ }
+
+ public function testSaveToOutput(): void
+ {
+ $phpWord = new PhpWord();
+ $section = $phpWord->addSection();
+ $section->addText('Hello, WPS!');
+
+ $writer = new WPS($phpWord);
+
+ ob_start();
+ $writer->save('php://output');
+ $content = ob_get_clean();
+
+ // Check that the output starts with the ZIP file signature (PK header)
+ if (is_string($content)) {
+ self::assertEquals('PK', substr($content, 0, 2));
+ }
+ }
+}
diff --git a/tests/PhpWordTests/Writer/Word2007/Element/TOCTest.php b/tests/PhpWordTests/Writer/Word2007/Element/TOCTest.php
index 95e79114aa..d250382370 100644
--- a/tests/PhpWordTests/Writer/Word2007/Element/TOCTest.php
+++ b/tests/PhpWordTests/Writer/Word2007/Element/TOCTest.php
@@ -66,8 +66,14 @@ public function testWriteTitleWithoutpageNumber(): void
//more than one title and random text for create more than one page
for ($i = 1; $i <= 10; ++$i) {
$section->addTitle('Title ' . $i, 1);
- $content = file_get_contents('https://loripsum.net/api/10/long');
- \PhpOffice\PhpWord\Shared\Html::addHtml($section, $content ? $content : '', false, false);
+ // Using static content instead of making a network request
+ $content = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus.
+ Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor.
+ Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper congue,
+ euismod non, mi.
Proin porttitor, orci nec nonummy molestie, enim est eleifend mi,
+ non fermentum diam nisl sit amet erat. Duis semper. Duis arcu massa, scelerisque vitae,
+ consequat in, pretium a, enim.
';
+ \PhpOffice\PhpWord\Shared\Html::addHtml($section, $content, false, false);
$section->addPageBreak();
}