PharArchiverTest.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /*
  3. * This file is part of Composer.
  4. *
  5. * (c) Nils Adermann <naderman@naderman.de>
  6. * Jordi Boggiano <j.boggiano@seld.be>
  7. *
  8. * For the full copyright and license information, please view the LICENSE
  9. * file that was distributed with this source code.
  10. */
  11. namespace Composer\Test\Package\Archiver;
  12. use Composer\Package\Archiver\PharArchiver;
  13. /**
  14. * @author Till Klampaeckel <till@php.net>
  15. * @author Matthieu Moquet <matthieu@moquet.net>
  16. */
  17. class PharArchiverTest extends ArchiverTest
  18. {
  19. public function testTarArchive()
  20. {
  21. $this->setupGitRepo();
  22. $package = $this->setupPackage();
  23. $target = sys_get_temp_dir().'/composer_archiver_test.tar';
  24. // Test archive
  25. $archiver = new PharArchiver();
  26. $archiver->archive($package->getSourceUrl(), $target, 'tar');
  27. $this->assertFileExists($target);
  28. unlink($target);
  29. $this->removeGitRepo();
  30. }
  31. public function testZipArchive()
  32. {
  33. $this->setupGitRepo();
  34. $package = $this->setupPackage();
  35. $target = sys_get_temp_dir().'/composer_archiver_test.zip';
  36. // Test archive
  37. $archiver = new PharArchiver();
  38. $archiver->archive($package->getSourceUrl(), $target, 'zip');
  39. $this->assertFileExists($target);
  40. unlink($target);
  41. $this->removeGitRepo();
  42. }
  43. }