mirror of
https://github.com/composer/composer
synced 2025-05-09 00:22:53 +00:00
Attempt at fixing support for git 2.11, refs #5942
This commit is contained in:
parent
1dcb2b5758
commit
e54c7478ee
2 changed files with 34 additions and 2 deletions
|
@ -91,6 +91,38 @@ class VersionGuesserTest extends \PHPUnit_Framework_TestCase
|
|||
$this->assertEquals("dev-$commitHash", $versionData['version']);
|
||||
}
|
||||
|
||||
public function testDetachedHeadBecomesDevHashGit2()
|
||||
{
|
||||
$commitHash = '03a15d220da53c52eddd5f32ffca64a7b3801bea';
|
||||
|
||||
$executor = $this->getMockBuilder('\\Composer\\Util\\ProcessExecutor')
|
||||
->setMethods(array('execute'))
|
||||
->disableArgumentCloning()
|
||||
->disableOriginalConstructor()
|
||||
->getMock()
|
||||
;
|
||||
|
||||
$self = $this;
|
||||
|
||||
$executor
|
||||
->expects($this->at(0))
|
||||
->method('execute')
|
||||
->willReturnCallback(function ($command, &$output) use ($self, $commitHash) {
|
||||
$self->assertEquals('git branch --no-color --no-abbrev -v', $command);
|
||||
$output = "* (HEAD detached at FETCH_HEAD) $commitHash Commit message\n";
|
||||
|
||||
return 0;
|
||||
})
|
||||
;
|
||||
|
||||
$config = new Config;
|
||||
$config->merge(array('repositories' => array('packagist' => false)));
|
||||
$guesser = new VersionGuesser($config, $executor, new VersionParser());
|
||||
$versionData = $guesser->guessVersion(array(), 'dummy/path');
|
||||
|
||||
$this->assertEquals("dev-$commitHash", $versionData['version']);
|
||||
}
|
||||
|
||||
public function testTagBecomesVersion()
|
||||
{
|
||||
$executor = $this->getMockBuilder('\\Composer\\Util\\ProcessExecutor')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue