1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-09 00:22:53 +00:00

Implement cache GC and fix keys

This commit is contained in:
Jordi Boggiano 2012-11-10 23:17:36 +01:00
parent 79bf55e505
commit 5a9d986e67
6 changed files with 55 additions and 19 deletions

View file

@ -23,7 +23,7 @@ class FileDownloaderTest extends \PHPUnit_Framework_TestCase
$config = $config ?: $this->getMock('Composer\Config');
$rfs = $rfs ?: $this->getMockBuilder('Composer\Util\RemoteFilesystem')->disableOriginalConstructor()->getMock();
return new FileDownloader($io, $config, $rfs);
return new FileDownloader($io, $config, null, $rfs);
}
/**
@ -56,8 +56,11 @@ class FileDownloaderTest extends \PHPUnit_Framework_TestCase
$downloader->download($packageMock, $path);
$this->fail();
} catch (\Exception $e) {
if (file_exists($path)) {
unset($path);
if (is_dir($path)) {
$fs = new Filesystem();
$fs->removeDirectory($path);
} elseif (is_file($path)) {
unlink($path);
}
$this->assertInstanceOf('RuntimeException', $e);
$this->assertContains('exists and is not a directory', $e->getMessage());
@ -112,7 +115,7 @@ class FileDownloaderTest extends \PHPUnit_Framework_TestCase
$fs = new Filesystem();
$fs->removeDirectory($path);
} elseif (is_file($path)) {
unset($path);
unlink($path);
}
$this->assertInstanceOf('UnexpectedValueException', $e);
@ -150,7 +153,7 @@ class FileDownloaderTest extends \PHPUnit_Framework_TestCase
$fs = new Filesystem();
$fs->removeDirectory($path);
} elseif (is_file($path)) {
unset($path);
unlink($path);
}
$this->assertInstanceOf('UnexpectedValueException', $e);