1
0
Fork 0

update repository manager tests to use data provider and test for exception case

pull/3784/head
Steve Buzonas 2015-02-26 03:19:26 -05:00
parent e5985a9b55
commit 484c04b5e5
1 changed files with 7 additions and 4 deletions

View File

@ -19,8 +19,11 @@ class RepositoryManagerTest extends TestCase
/** /**
* @dataProvider creationCases * @dataProvider creationCases
*/ */
public function testRepoCreation($type, $config) public function testRepoCreation($type, $config, $exception = null)
{ {
if ($exception) {
$this->setExpectedException($exception);
}
$rm = new RepositoryManager( $rm = new RepositoryManager(
$this->getMock('Composer\IO\IOInterface'), $this->getMock('Composer\IO\IOInterface'),
$this->getMock('Composer\Config'), $this->getMock('Composer\Config'),
@ -37,8 +40,7 @@ class RepositoryManagerTest extends TestCase
$rm->setRepositoryClass('artifact', 'Composer\Repository\ArtifactRepository'); $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);
$rm->createRepository('composer', array('url' => 'http://example.org'));
} }
public function creationCases() public function creationCases()
@ -51,7 +53,8 @@ class RepositoryManagerTest extends TestCase
array('svn', array('url' => 'svn://example.org/foo/bar')), array('svn', array('url' => 'svn://example.org/foo/bar')),
array('pear', array('url' => 'http://pear.example.org/foo')), array('pear', array('url' => 'http://pear.example.org/foo')),
array('artifact', array('url' => '/path/to/zips')), array('artifact', array('url' => '/path/to/zips')),
array('package', array()), array('package', array('package' => array())),
array('invalid', array(), 'InvalidArgumentException'),
); );
} }
} }