Skip to content

Commit 9309e04

Browse files
committed
Try Another Means to Generate Zip Close Failure
1 parent 763e34c commit 9309e04

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

tests/PhpWordTests/Shared/ZipArchiveTest.php

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,10 @@ public function testCloseException(): void
5353
$object = new ZipArchive();
5454
$object->open($this->zipFile, ZipArchive::CREATE);
5555
$object->addFromString('content/string.txt', 'Test');
56-
57-
// Lock the file
58-
$resource = fopen($this->zipFile, 'wb');
59-
self::assertNotFalse($resource);
60-
flock($resource, LOCK_EX);
61-
62-
// Closing the file should throws an exception
56+
// Should not be able to add a directory like this
57+
$object->addFile('.', '.');
58+
// But error doesn't express itself till close is attempted
6359
$object->close();
64-
65-
// Unlock the file
66-
flock($resource, LOCK_UN);
67-
fclose($resource);
6860
}
6961

7062
/**

0 commit comments

Comments
 (0)