1
0
Fork 0

Merge remote-tracking branch 'github-composer/master' into plugins

* github-composer/master:
  Correct FileDownloaderTest for invalid checksum

Conflicts:
	tests/Composer/Test/Downloader/FileDownloaderTest.php
pull/2179/head
Nils Adermann 2013-08-31 15:58:31 +02:00
commit 2ca07add97
1 changed files with 4 additions and 3 deletions

View File

@ -17,13 +17,13 @@ use Composer\Util\Filesystem;
class FileDownloaderTest extends \PHPUnit_Framework_TestCase class FileDownloaderTest extends \PHPUnit_Framework_TestCase
{ {
protected function getDownloader($io = null, $config = null, $rfs = null) protected function getDownloader($io = null, $config = null, $rfs = null, $filesystem = null)
{ {
$io = $io ?: $this->getMock('Composer\IO\IOInterface'); $io = $io ?: $this->getMock('Composer\IO\IOInterface');
$config = $config ?: $this->getMock('Composer\Config'); $config = $config ?: $this->getMock('Composer\Config');
$rfs = $rfs ?: $this->getMockBuilder('Composer\Util\RemoteFilesystem')->disableOriginalConstructor()->getMock(); $rfs = $rfs ?: $this->getMockBuilder('Composer\Util\RemoteFilesystem')->disableOriginalConstructor()->getMock();
return new FileDownloader($io, $config, null, null, $rfs); return new FileDownloader($io, $config, null, null, $rfs, $filesystem);
} }
/** /**
@ -134,12 +134,13 @@ class FileDownloaderTest extends \PHPUnit_Framework_TestCase
->method('getDistSha1Checksum') ->method('getDistSha1Checksum')
->will($this->returnValue('invalid')) ->will($this->returnValue('invalid'))
; ;
$filesystem = $this->getMock('Composer\Util\Filesystem');
do { do {
$path = sys_get_temp_dir().'/'.md5(time().mt_rand()); $path = sys_get_temp_dir().'/'.md5(time().mt_rand());
} while (file_exists($path)); } while (file_exists($path));
$downloader = $this->getDownloader(); $downloader = $this->getDownloader(null, null, null, $filesystem);
// make sure the file expected to be downloaded is on disk already // make sure the file expected to be downloaded is on disk already
mkdir($path, 0777, true); mkdir($path, 0777, true);