Zip64Test.php 1.0 KB

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