mirror of
https://github.com/composer/composer
synced 2025-05-11 01:22:54 +00:00
Add a warning message when Composer is not able to guess the root package version (#11858)
Co-authored-by: Jordi Boggiano <j.boggiano@seld.be>
This commit is contained in:
parent
1b7a71f7e7
commit
a0d474f75c
7 changed files with 71 additions and 14 deletions
|
@ -33,7 +33,7 @@ class ValidateCommandTest extends TestCase
|
|||
$this->assertSame(trim($expected), trim($appTester->getDisplay(true)));
|
||||
}
|
||||
|
||||
public function testValidateOnFileIssues(): void
|
||||
public function testValidateOnFileIssues(): void
|
||||
{
|
||||
$directory = $this->initTempComposer(self::MINIMAL_VALID_CONFIGURATION);
|
||||
unlink($directory.'/composer.json');
|
||||
|
@ -45,7 +45,7 @@ class ValidateCommandTest extends TestCase
|
|||
$this->assertSame($expected, trim($appTester->getDisplay(true)));
|
||||
}
|
||||
|
||||
public function testWithComposerLock(): void
|
||||
public function testWithComposerLock(): void
|
||||
{
|
||||
$this->initTempComposer(self::MINIMAL_VALID_CONFIGURATION);
|
||||
$this->createComposerLock();
|
||||
|
@ -53,7 +53,9 @@ class ValidateCommandTest extends TestCase
|
|||
$appTester = $this->getApplicationTester();
|
||||
$appTester->run(['command' => 'validate']);
|
||||
$expected = <<<OUTPUT
|
||||
./composer.json is valid but your composer.lock has some errors
|
||||
<warning>Composer could not detect the root package (test/suite) version, defaulting to '1.0.0'. See https://getcomposer.org/root-version</warning>
|
||||
<warning>Composer could not detect the root package (test/suite) version, defaulting to '1.0.0'. See https://getcomposer.org/root-version</warning>
|
||||
./composer.json is valid but your composer.lock has some errors
|
||||
# Lock file errors
|
||||
- Required package "root/req" is not present in the lock file.
|
||||
This usually happens when composer files are incorrectly merged or the composer.json file is manually edited.
|
||||
|
@ -64,12 +66,12 @@ OUTPUT;
|
|||
$this->assertSame(trim($expected), trim($appTester->getDisplay(true)));
|
||||
}
|
||||
|
||||
public function testUnaccessibleFile(): void
|
||||
public function testUnaccessibleFile(): void
|
||||
{
|
||||
if (Platform::isWindows()) {
|
||||
$this->markTestSkipped('Does not run on windows');
|
||||
}
|
||||
|
||||
|
||||
$directory = $this->initTempComposer(self::MINIMAL_VALID_CONFIGURATION);
|
||||
chmod($directory.'/composer.json', 0200);
|
||||
|
||||
|
@ -105,11 +107,15 @@ OUTPUT;
|
|||
|
||||
public static function provideValidateTests(): \Generator
|
||||
{
|
||||
|
||||
|
||||
yield 'validation passing' => [
|
||||
self::MINIMAL_VALID_CONFIGURATION,
|
||||
[],
|
||||
'./composer.json is valid',
|
||||
<<<OUTPUT
|
||||
<warning>Composer could not detect the root package (test/suite) version, defaulting to '1.0.0'. See https://getcomposer.org/root-version</warning>
|
||||
<warning>Composer could not detect the root package (test/suite) version, defaulting to '1.0.0'. See https://getcomposer.org/root-version</warning>
|
||||
./composer.json is valid
|
||||
OUTPUT
|
||||
];
|
||||
|
||||
$publishDataStripped= array_diff_key(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue