1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-09 00:22:53 +00:00

Merge branch '1.10'

This commit is contained in:
Jordi Boggiano 2020-10-08 14:33:36 +02:00
commit 03b8c3db3f
No known key found for this signature in database
GPG key ID: 7BBD42C429EC80BC
7 changed files with 89 additions and 32 deletions

View file

@ -48,7 +48,7 @@ class VersionGuesserTest extends TestCase
->expects($this->at($step))
->method('execute')
->willReturnCallback(function ($command, &$output) use ($self) {
$self->assertEquals('git branch --no-color --no-abbrev -v', $command);
$self->assertEquals('git branch -a --no-color --no-abbrev -v', $command);
return 128;
})
@ -116,7 +116,7 @@ class VersionGuesserTest extends TestCase
->expects($this->at(0))
->method('execute')
->willReturnCallback(function ($command, &$output) use ($self, $commitHash, $anotherCommitHash) {
$self->assertEquals('git branch --no-color --no-abbrev -v', $command);
$self->assertEquals('git branch -a --no-color --no-abbrev -v', $command);
$output = "* master $commitHash Commit message\n(no branch) $anotherCommitHash Commit message\n";
return 0;
@ -154,7 +154,7 @@ class VersionGuesserTest extends TestCase
->expects($this->at(0))
->method('execute')
->willReturnCallback(function ($command, &$output) use ($self, $commitHash, $anotherCommitHash) {
$self->assertEquals('git branch --no-color --no-abbrev -v', $command);
$self->assertEquals('git branch -a --no-color --no-abbrev -v', $command);
$output = " arbitrary $commitHash Commit message\n* current $anotherCommitHash Another message\n";
return 0;
@ -188,7 +188,7 @@ class VersionGuesserTest extends TestCase
->expects($this->at(0))
->method('execute')
->willReturnCallback(function ($command, &$output) use ($self, $commitHash, $anotherCommitHash) {
$self->assertEquals('git branch --no-color --no-abbrev -v', $command);
$self->assertEquals('git branch -a --no-color --no-abbrev -v', $command);
$output = " arbitrary $commitHash Commit message\n* feature $anotherCommitHash Another message\n";
return 0;
@ -235,7 +235,7 @@ class VersionGuesserTest extends TestCase
->expects($this->at(0))
->method('execute')
->willReturnCallback(function ($command, &$output) use ($self, $commitHash, $anotherCommitHash) {
$self->assertEquals('git branch --no-color --no-abbrev -v', $command);
$self->assertEquals('git branch -a --no-color --no-abbrev -v', $command);
$output = " latest-testing $commitHash Commit message\n* feature $anotherCommitHash Another message\n";
return 0;
@ -281,7 +281,7 @@ class VersionGuesserTest extends TestCase
->expects($this->at(0))
->method('execute')
->willReturnCallback(function ($command, &$output) use ($self, $commitHash, $anotherCommitHash) {
$self->assertEquals('git branch --no-color --no-abbrev -v', $command);
$self->assertEquals('git branch -a --no-color --no-abbrev -v', $command);
$output = "* latest-testing $commitHash Commit message\n current $anotherCommitHash Another message\n master $anotherCommitHash Another message\n";
return 0;
@ -316,7 +316,7 @@ class VersionGuesserTest extends TestCase
->expects($this->at(0))
->method('execute')
->willReturnCallback(function ($command, &$output) use ($self, $commitHash) {
$self->assertEquals('git branch --no-color --no-abbrev -v', $command);
$self->assertEquals('git branch -a --no-color --no-abbrev -v', $command);
$output = "* (no branch) $commitHash Commit message\n";
return 0;
@ -347,7 +347,7 @@ class VersionGuesserTest extends TestCase
->expects($this->at(0))
->method('execute')
->willReturnCallback(function ($command, &$output) use ($self, $commitHash) {
$self->assertEquals('git branch --no-color --no-abbrev -v', $command);
$self->assertEquals('git branch -a --no-color --no-abbrev -v', $command);
$output = "* (HEAD detached at FETCH_HEAD) $commitHash Commit message\n";
return 0;
@ -377,7 +377,7 @@ class VersionGuesserTest extends TestCase
->expects($this->at(0))
->method('execute')
->willReturnCallback(function ($command, &$output) use ($self, $commitHash) {
$self->assertEquals('git branch --no-color --no-abbrev -v', $command);
$self->assertEquals('git branch -a --no-color --no-abbrev -v', $command);
$output = "* (HEAD detached at 03a15d220) $commitHash Commit message\n";
return 0;
@ -406,7 +406,7 @@ class VersionGuesserTest extends TestCase
->expects($this->at(0))
->method('execute')
->willReturnCallback(function ($command, &$output) use ($self) {
$self->assertEquals('git branch --no-color --no-abbrev -v', $command);
$self->assertEquals('git branch -a --no-color --no-abbrev -v', $command);
$output = "* (HEAD detached at v2.0.5-alpha2) 433b98d4218c181bae01865901aac045585e8a1a Commit message\n";
return 0;
@ -446,7 +446,7 @@ class VersionGuesserTest extends TestCase
->expects($this->at(0))
->method('execute')
->willReturnCallback(function ($command, &$output) use ($self) {
$self->assertEquals('git branch --no-color --no-abbrev -v', $command);
$self->assertEquals('git branch -a --no-color --no-abbrev -v', $command);
$output = "* (HEAD detached at 1.0.0) c006f0c12bbbf197b5c071ffb1c0e9812bb14a4d Commit message\n";
return 0;
@ -487,7 +487,7 @@ class VersionGuesserTest extends TestCase
->expects($this->at(0))
->method('execute')
->willReturnCallback(function ($command, &$output) use ($self) {
$self->assertEquals('git branch --no-color --no-abbrev -v', $command);
$self->assertEquals('git branch -a --no-color --no-abbrev -v', $command);
$output = "* foo 03a15d220da53c52eddd5f32ffca64a7b3801bea Commit message\n";
return 0;
@ -517,7 +517,7 @@ class VersionGuesserTest extends TestCase
->expects($this->at(0))
->method('execute')
->willReturnCallback(function ($command, &$output) use ($self) {
$self->assertEquals('git branch --no-color --no-abbrev -v', $command);
$self->assertEquals('git branch -a --no-color --no-abbrev -v', $command);
$output = "* 1.5 03a15d220da53c52eddd5f32ffca64a7b3801bea Commit message\n";
return 0;
@ -532,4 +532,46 @@ class VersionGuesserTest extends TestCase
$this->assertEquals("1.5.x-dev", $versionData['pretty_version']);
$this->assertEquals("1.5.9999999.9999999-dev", $versionData['version']);
}
public function testRemoteBranchesAreSelected()
{
$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) {
$self->assertEquals('git branch -a --no-color --no-abbrev -v', $command);
$output = "* feature-branch 03a15d220da53c52eddd5f32ffca64a7b3801bea Commit message\n".
"remotes/origin/1.5 03a15d220da53c52eddd5f32ffca64a7b3801bea Commit message\n";
return 0;
})
;
$executor
->expects($this->at(1))
->method('execute')
->willReturnCallback(function ($command, &$output, $path) use ($self) {
$self->assertEquals('git rev-list remotes/origin/1.5..feature-branch', $command);
$output = "\n";
return 0;
})
;
$config = new Config;
$config->merge(array('repositories' => array('packagist' => false)));
$guesser = new VersionGuesser($config, $executor, new VersionParser());
$versionData = $guesser->guessVersion(array('version' => 'self.version'), 'dummy/path');
$this->assertEquals("1.5.x-dev", $versionData['pretty_version']);
$this->assertEquals("1.5.9999999.9999999-dev", $versionData['version']);
}
}