Browse Source

Add some unit tests

Fabien Potencier 13 years ago
parent
commit
9c739e71c2
1 changed files with 15 additions and 0 deletions
  1. 15 0
      tests/Composer/Test/Repository/FilesystemRepositoryTest.php

+ 15 - 0
tests/Composer/Test/Repository/FilesystemRepositoryTest.php

@@ -65,6 +65,21 @@ class FilesystemRepositoryTest extends \PHPUnit_Framework_TestCase
         $repository->getPackages();
     }
 
+    public function testUnexistentRepositoryFile()
+    {
+        $json = $this->createJsonFileMock();
+
+        $repository = new FilesystemRepository($json);
+        $repository->setRepositoryManager($this->getMock('Composer\Repository\RepositoryManager'));
+
+        $json
+            ->expects($this->once())
+            ->method('exists')
+            ->will($this->returnValue(false));
+
+        $this->assertEquals(array(), $repository->getPackages());
+    }
+
     public function testRepositoryWrite()
     {
         $json = $this->createJsonFileMock();