2
0

Zip64Test.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace PhpZip;
  3. use PhpZip\Exception\ZipException;
  4. /**
  5. * @internal
  6. *
  7. * @large
  8. * @covers
  9. */
  10. class Zip64Test extends ZipTestCase
  11. {
  12. /**
  13. * Test support ZIP64 ext (slow test - normal).
  14. * Create > 65535 files in archive and open and extract to /dev/null.
  15. *
  16. * @throws ZipException
  17. */
  18. public function testCreateAndOpenZip64Ext()
  19. {
  20. $countFiles = 0xffff + 1;
  21. $zipFile = new ZipFile();
  22. for ($i = 0; $i < $countFiles; $i++) {
  23. $zipFile[$i . '.txt'] = (string) $i;
  24. }
  25. $zipFile->saveAsFile($this->outputFilename);
  26. $zipFile->close();
  27. static::assertCorrectZipArchive($this->outputFilename);
  28. $zipFile->openFile($this->outputFilename);
  29. static::assertSame($zipFile->count(), $countFiles);
  30. $i = 0;
  31. foreach ($zipFile as $entry => $content) {
  32. static::assertSame($entry, $i . '.txt');
  33. static::assertSame($content, (string) $i);
  34. $i++;
  35. }
  36. $zipFile->close();
  37. }
  38. }