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

Fix bug in an exception, added unit tests

This commit is contained in:
Fabien Potencier 2011-10-30 09:09:46 +01:00
parent e4f40272a3
commit 1450ebd837
3 changed files with 32 additions and 4 deletions

View file

@ -43,6 +43,28 @@ class FilesystemRepositoryTest extends \PHPUnit_Framework_TestCase
$this->assertSame('vendor', $packages[0]->getType());
}
/**
* @expectedException \UnexpectedValueException
*/
public function testCorruptedRepositoryFile()
{
$json = $this->createJsonFileMock();
$repository = new FilesystemRepository($json);
$repository->setRepositoryManager($this->getMock('Composer\Repository\RepositoryManager'));
$json
->expects($this->once())
->method('read')
->will($this->returnValue('foo'));
$json
->expects($this->once())
->method('exists')
->will($this->returnValue(true));
$repository->getPackages();
}
public function testRepositoryWrite()
{
$json = $this->createJsonFileMock();