瀏覽代碼

Add test case for RepositoryManager::prependRepository method

Franz Liedke 9 年之前
父節點
當前提交
f47c2c9ed7
共有 1 個文件被更改,包括 16 次插入0 次删除
  1. 16 0
      tests/Composer/Test/Repository/RepositoryManagerTest.php

+ 16 - 0
tests/Composer/Test/Repository/RepositoryManagerTest.php

@@ -32,6 +32,22 @@ class RepositoryManagerTest extends TestCase
         }
     }
 
+    public function testPrepend()
+    {
+        $rm = new RepositoryManager(
+            $this->getMock('Composer\IO\IOInterface'),
+            $this->getMock('Composer\Config'),
+            $this->getMockBuilder('Composer\EventDispatcher\EventDispatcher')->disableOriginalConstructor()->getMock()
+        );
+
+        $repository1 = $this->getMock('Composer\Repository\RepositoryInterface');
+        $repository2 = $this->getMock('Composer\Repository\RepositoryInterface');
+        $rm->addRepository($repository1);
+        $rm->prependRepository($repository2);
+
+        $this->assertEquals(array($repository2, $repository1), $rm->getRepositories());
+    }
+
     /**
      * @dataProvider creationCases
      */