1
0
Fork 0

Add "missing lockfile" test for the Audit command

pull/11162/head
Dan Barrett 2022-10-29 18:14:48 +11:00
parent b2304d0b12
commit 29ae7b632a
No known key found for this signature in database
GPG Key ID: B2C1C5184A5C8D5A
1 changed files with 16 additions and 0 deletions

View File

@ -13,6 +13,7 @@
namespace Composer\Test\Command;
use Composer\Test\TestCase;
use UnexpectedValueException;
class AuditCommandTest extends TestCase
{
@ -24,5 +25,20 @@ class AuditCommandTest extends TestCase
$appTester->run(['command' => 'audit']);
$appTester->assertCommandIsSuccessful();
self::assertEquals('No packages - skipping audit.', trim($appTester->getDisplay(true)));
}
public function testErrorAuditingLockFileWhenItIsMissing(): void
{
$this->initTempComposer();
$this->createInstalledJson([self::getPackage()]);
$this->expectException(UnexpectedValueException::class);
$this->expectExceptionMessage(
"Valid composer.json and composer.lock files are required to run this command with --locked"
);
$appTester = $this->getApplicationTester();
$appTester->run(['command' => 'audit', '--locked' => true]);
}
}