Add "missing lockfile" test for the Audit command
parent
b2304d0b12
commit
29ae7b632a
|
@ -13,6 +13,7 @@
|
||||||
namespace Composer\Test\Command;
|
namespace Composer\Test\Command;
|
||||||
|
|
||||||
use Composer\Test\TestCase;
|
use Composer\Test\TestCase;
|
||||||
|
use UnexpectedValueException;
|
||||||
|
|
||||||
class AuditCommandTest extends TestCase
|
class AuditCommandTest extends TestCase
|
||||||
{
|
{
|
||||||
|
@ -24,5 +25,20 @@ class AuditCommandTest extends TestCase
|
||||||
$appTester->run(['command' => 'audit']);
|
$appTester->run(['command' => 'audit']);
|
||||||
|
|
||||||
$appTester->assertCommandIsSuccessful();
|
$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]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue