1
0
Fork 0

Fix self-update tests on releases

pull/11885/head
Jordi Boggiano 2024-03-11 17:32:50 +01:00
parent 2124f09d75
commit 94fe294545
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 9 additions and 0 deletions

View File

@ -12,6 +12,7 @@
namespace Composer\Test\Command; namespace Composer\Test\Command;
use Composer\Composer;
use Composer\Test\TestCase; use Composer\Test\TestCase;
/** /**
@ -44,6 +45,10 @@ class SelfUpdateCommandTest extends TestCase
public function testSuccessfulUpdate(): void public function testSuccessfulUpdate(): void
{ {
if (Composer::VERSION !== '@package_version'.'@') {
$this->markTestSkipped('On releases this test can fail to upgrade as we are already on latest version');
}
$appTester = $this->getApplicationTester(); $appTester = $this->getApplicationTester();
$appTester->run(['command' => 'self-update']); $appTester->run(['command' => 'self-update']);
@ -74,6 +79,10 @@ class SelfUpdateCommandTest extends TestCase
*/ */
public function testUpdateToDifferentChannel(string $option, string $expectedOutput): void public function testUpdateToDifferentChannel(string $option, string $expectedOutput): void
{ {
if (Composer::VERSION !== '@package_version'.'@' && in_array($option, ['--stable', '--preview'], true)) {
$this->markTestSkipped('On releases this test can fail to upgrade as we are already on latest version');
}
$appTester = $this->getApplicationTester(); $appTester = $this->getApplicationTester();
$appTester->run(['command' => 'self-update', $option => true]); $appTester->run(['command' => 'self-update', $option => true]);
$appTester->assertCommandIsSuccessful(); $appTester->assertCommandIsSuccessful();