From 484c04b5e54c178a4f7b0b47e998b87c4605220b Mon Sep 17 00:00:00 2001 From: Steve Buzonas Date: Thu, 26 Feb 2015 03:19:26 -0500 Subject: [PATCH] update repository manager tests to use data provider and test for exception case --- .../Test/Repository/RepositoryManagerTest.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/Composer/Test/Repository/RepositoryManagerTest.php b/tests/Composer/Test/Repository/RepositoryManagerTest.php index 94acc8bad..4293dff66 100644 --- a/tests/Composer/Test/Repository/RepositoryManagerTest.php +++ b/tests/Composer/Test/Repository/RepositoryManagerTest.php @@ -19,8 +19,11 @@ class RepositoryManagerTest extends TestCase /** * @dataProvider creationCases */ - public function testRepoCreation($type, $config) + public function testRepoCreation($type, $config, $exception = null) { + if ($exception) { + $this->setExpectedException($exception); + } $rm = new RepositoryManager( $this->getMock('Composer\IO\IOInterface'), $this->getMock('Composer\Config'), @@ -37,8 +40,7 @@ class RepositoryManagerTest extends TestCase $rm->setRepositoryClass('artifact', 'Composer\Repository\ArtifactRepository'); $rm->createRepository('composer', array('url' => 'http://example.org')); - $rm->createRepository('composer', array('url' => 'http://example.org')); - $rm->createRepository('composer', array('url' => 'http://example.org')); + $rm->createRepository($type, $config); } public function creationCases() @@ -51,7 +53,8 @@ class RepositoryManagerTest extends TestCase array('svn', array('url' => 'svn://example.org/foo/bar')), array('pear', array('url' => 'http://pear.example.org/foo')), array('artifact', array('url' => '/path/to/zips')), - array('package', array()), + array('package', array('package' => array())), + array('invalid', array(), 'InvalidArgumentException'), ); } }