mirror of
https://github.com/composer/composer
synced 2025-05-09 00:22:53 +00:00
This commit is contained in:
parent
74c2fd5f06
commit
ffecd39d33
10 changed files with 169 additions and 192 deletions
|
@ -1,93 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
* (c) Nils Adermann <naderman@naderman.de>
|
||||
* Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Composer\Test;
|
||||
|
||||
use Composer\Factory;
|
||||
use Composer\Config;
|
||||
|
||||
class FactoryTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider dataAddPackagistRepository
|
||||
*/
|
||||
public function testAddPackagistRepository($expected, $composerConfig, $defaults = null)
|
||||
{
|
||||
$factory = new Factory();
|
||||
$config = new Config();
|
||||
if ($defaults) {
|
||||
$config->merge(array('repositories' => $defaults));
|
||||
}
|
||||
|
||||
$ref = new \ReflectionMethod($factory, 'addDefaultRepositories');
|
||||
$ref->setAccessible(true);
|
||||
|
||||
$this->assertEquals($expected, $ref->invoke($factory, $config, $composerConfig));
|
||||
}
|
||||
|
||||
public function dataAddPackagistRepository()
|
||||
{
|
||||
$repos = function() {
|
||||
$repositories = func_get_args();
|
||||
|
||||
return array('repositories' => $repositories);
|
||||
};
|
||||
|
||||
$data = array();
|
||||
$data[] = array(
|
||||
$repos(array('type' => 'composer', 'url' => 'http://packagist.org')),
|
||||
$repos()
|
||||
);
|
||||
|
||||
$data[] = array(
|
||||
$repos(array('packagist' => false)),
|
||||
$repos(array('packagist' => false))
|
||||
);
|
||||
|
||||
$data[] = array(
|
||||
$repos(
|
||||
array('type' => 'vcs', 'url' => 'git://github.com/composer/composer.git'),
|
||||
array('type' => 'composer', 'url' => 'http://packagist.org'),
|
||||
array('type' => 'pear', 'url' => 'http://pear.composer.org')
|
||||
),
|
||||
$repos(
|
||||
array('type' => 'vcs', 'url' => 'git://github.com/composer/composer.git'),
|
||||
array('packagist' => true),
|
||||
array('type' => 'pear', 'url' => 'http://pear.composer.org')
|
||||
)
|
||||
);
|
||||
|
||||
$multirepo = array(
|
||||
'example.com' => 'http://example.com',
|
||||
);
|
||||
|
||||
$data[] = array(
|
||||
$repos(
|
||||
array('type' => 'composer', 'url' => 'http://example.com'),
|
||||
array('type' => 'composer', 'url' => 'http://packagist.org')
|
||||
),
|
||||
$repos(),
|
||||
$multirepo,
|
||||
);
|
||||
|
||||
$data[] = array(
|
||||
$repos(
|
||||
array('type' => 'composer', 'url' => 'http://packagist.org'),
|
||||
array('type' => 'composer', 'url' => 'http://example.com')
|
||||
),
|
||||
$repos(array('packagist' => true)),
|
||||
$multirepo,
|
||||
);
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue