Fix test suite

main
Jordi Boggiano 8 years ago
parent 2c67fb67f2
commit 2dcd76aa43

@ -110,16 +110,6 @@ class RootPackageLoaderTest extends \PHPUnit_Framework_TestCase
$executor
->expects($this->at(0))
->method('execute')
->willReturnCallback(function ($command) use ($self) {
$self->assertEquals('git describe --exact-match --tags', $command);
return 1;
})
;
$executor
->expects($this->at(1))
->method('execute')
->willReturnCallback(function ($command, &$output) use ($self) {
$self->assertEquals('git branch --no-color --no-abbrev -v', $command);
$output = "* latest-production 38137d2f6c70e775e137b2d8a7a7d3eaebf7c7e5 Commit message\n master 4f6ed96b0bc363d2aa4404c3412de1c011f67c66 Commit message\n";
@ -129,7 +119,7 @@ class RootPackageLoaderTest extends \PHPUnit_Framework_TestCase
;
$executor
->expects($this->at(2))
->expects($this->at(1))
->method('execute')
->willReturnCallback(function ($command, &$output) use ($self) {
$self->assertEquals('git rev-list master..latest-production', $command);
@ -170,16 +160,6 @@ class RootPackageLoaderTest extends \PHPUnit_Framework_TestCase
$executor
->expects($this->at(0))
->method('execute')
->willReturnCallback(function ($command) use ($self) {
$self->assertEquals('git describe --exact-match --tags', $command);
return 1;
})
;
$executor
->expects($this->at(1))
->method('execute')
->willReturnCallback(function ($command, &$output) use ($self) {
$self->assertEquals('git branch --no-color --no-abbrev -v', $command);
$output = "* latest-production 38137d2f6c70e775e137b2d8a7a7d3eaebf7c7e5 Commit message\n master 4f6ed96b0bc363d2aa4404c3412de1c011f67c66 Commit message\n";

@ -37,17 +37,10 @@ class VersionGuesserTest extends \PHPUnit_Framework_TestCase
->getMock()
;
$executor
->expects($this->at(0))
->method('execute')
->with('git describe --exact-match --tags')
->willReturn(1)
;
$self = $this;
$executor
->expects($this->at(1))
->expects($this->at(0))
->method('execute')
->willReturnCallback(function ($command, &$output) use ($self, $commitHash, $anotherCommitHash) {
$self->assertEquals('git branch --no-color --no-abbrev -v', $command);
@ -77,17 +70,10 @@ class VersionGuesserTest extends \PHPUnit_Framework_TestCase
->getMock()
;
$executor
->expects($this->at(0))
->method('execute')
->with('git describe --exact-match --tags')
->willReturn(1)
;
$self = $this;
$executor
->expects($this->at(1))
->expects($this->at(0))
->method('execute')
->willReturnCallback(function ($command, &$output) use ($self, $commitHash) {
$self->assertEquals('git branch --no-color --no-abbrev -v', $command);
@ -119,6 +105,17 @@ class VersionGuesserTest extends \PHPUnit_Framework_TestCase
$executor
->expects($this->at(0))
->method('execute')
->willReturnCallback(function ($command, &$output) use ($self) {
$self->assertEquals('git branch --no-color --no-abbrev -v', $command);
$output = "* (HEAD detached at v2.0.5-alpha2) 433b98d4218c181bae01865901aac045585e8a1a Commit message\n";
return 0;
})
;
$executor
->expects($this->at(1))
->method('execute')
->willReturnCallback(function ($command, &$output) use ($self) {
$self->assertEquals('git describe --exact-match --tags', $command);
$output = "v2.0.5-alpha2";
@ -149,17 +146,6 @@ class VersionGuesserTest extends \PHPUnit_Framework_TestCase
$executor
->expects($this->at(0))
->method('execute')
->willReturnCallback(function ($command, &$output) use ($self) {
$self->assertEquals('git describe --exact-match --tags', $command);
$output = "foo-bar";
return 0;
})
;
$executor
->expects($this->at(1))
->method('execute')
->willReturnCallback(function ($command, &$output) use ($self) {
$self->assertEquals('git branch --no-color --no-abbrev -v', $command);
$output = "* foo 03a15d220da53c52eddd5f32ffca64a7b3801bea Commit message\n";

Loading…
Cancel
Save