|
|
@ -85,6 +85,39 @@ class RootPackageLoaderTest extends \PHPUnit_Framework_TestCase
|
|
|
|
$this->assertEquals("2.0.5.0-alpha2", $package->getVersion());
|
|
|
|
$this->assertEquals("2.0.5.0-alpha2", $package->getVersion());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function testInvalidTagBecomesVersion()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!function_exists('proc_open')) {
|
|
|
|
|
|
|
|
$this->markTestSkipped('proc_open() is not available');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$manager = $this->getMockBuilder('\\Composer\\Repository\\RepositoryManager')
|
|
|
|
|
|
|
|
->disableOriginalConstructor()
|
|
|
|
|
|
|
|
->getMock();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$self = $this;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Can do away with this mock object when https://github.com/sebastianbergmann/phpunit-mock-objects/issues/81 is fixed */
|
|
|
|
|
|
|
|
$processExecutor = new ProcessExecutorMock(function($command, &$output = null, $cwd = null) use ($self) {
|
|
|
|
|
|
|
|
if ('git describe --exact-match --tags' === $command) {
|
|
|
|
|
|
|
|
$output = "foo-bar";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$output = "* foo 03a15d220da53c52eddd5f32ffca64a7b3801bea Commit message\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$config = new Config;
|
|
|
|
|
|
|
|
$config->merge(array('repositories' => array('packagist' => false)));
|
|
|
|
|
|
|
|
$loader = new RootPackageLoader($manager, $config, null, $processExecutor);
|
|
|
|
|
|
|
|
$package = $loader->load(array());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->assertEquals("dev-foo", $package->getVersion());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected function loadPackage($data)
|
|
|
|
protected function loadPackage($data)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$manager = $this->getMockBuilder('\\Composer\\Repository\\RepositoryManager')
|
|
|
|
$manager = $this->getMockBuilder('\\Composer\\Repository\\RepositoryManager')
|
|
|
|