PearDownloaderTest.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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\Downloader;
  12. use Composer\Downloader\PearDownloader;
  13. class PearDownloaderTest extends \PHPUnit_Framework_TestCase
  14. {
  15. public function testErrorMessages()
  16. {
  17. $packageMock = $this->getMock('Composer\Package\PackageInterface');
  18. $packageMock->expects($this->any())
  19. ->method('getDistUrl')
  20. ->will($this->returnValue('file://'.__FILE__))
  21. ;
  22. $io = $this->getMock('Composer\IO\IOInterface');
  23. $downloader = new PearDownloader($io);
  24. try {
  25. $downloader->download($packageMock, sys_get_temp_dir().'/composer-pear-test');
  26. $this->fail('Download of invalid pear packages should throw an exception');
  27. } catch (\UnexpectedValueException $e) {
  28. $this->assertContains('Failed to extract PEAR package', $e->getMessage());
  29. }
  30. }
  31. }