mirror of
https://github.com/composer/composer
synced 2025-05-09 00:22:53 +00:00
added non-feature-branches to handle non-numeric branches matching configured patterns not been handled as feature branches
This commit is contained in:
parent
7adc41d02c
commit
abc9d60fcc
3 changed files with 94 additions and 0 deletions
|
@ -153,4 +153,80 @@ class RootPackageLoaderTest extends \PHPUnit_Framework_TestCase
|
|||
'qux/quux' => BasePackage::STABILITY_RC,
|
||||
), $package->getStabilityFlags());
|
||||
}
|
||||
|
||||
public function testFeatureBranchPrettyVersion()
|
||||
{
|
||||
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 (0 === strpos($command, 'git rev-list')) {
|
||||
$output = "";
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ('git branch --no-color --no-abbrev -v' !== $command) {
|
||||
return 1; //0;
|
||||
}
|
||||
|
||||
$self->assertEquals('git branch --no-color --no-abbrev -v', $command);
|
||||
|
||||
$output = "* latest-production 38137d2f6c70e775e137b2d8a7a7d3eaebf7c7e5 Commit message\n master 4f6ed96b0bc363d2aa4404c3412de1c011f67c66 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('require' => array('foo/bar' => 'self.version')));
|
||||
|
||||
$this->assertEquals("dev-master", $package->getPrettyVersion());
|
||||
}
|
||||
|
||||
public function testNonFeatureBranchPrettyVersion()
|
||||
{
|
||||
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 (0 === strpos($command, 'git rev-list')) {
|
||||
$output = "";
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ('git branch --no-color --no-abbrev -v' !== $command) {
|
||||
return 1; //0;
|
||||
}
|
||||
|
||||
$self->assertEquals('git branch --no-color --no-abbrev -v', $command);
|
||||
|
||||
$output = "* latest-production 38137d2f6c70e775e137b2d8a7a7d3eaebf7c7e5 Commit message\n master 4f6ed96b0bc363d2aa4404c3412de1c011f67c66 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('require' => array('foo/bar' => 'self.version'), "non-feature-branches" => array("latest-.*")));
|
||||
|
||||
$this->assertEquals("dev-latest-production", $package->getPrettyVersion());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue