function LockFileValidatorTest::testLockFileDeleted
Tests validation when the lock file is deleted.
@dataProvider providerValidateStageEvents
File
-
core/
modules/ package_manager/ tests/ src/ Kernel/ LockFileValidatorTest.php, line 127
Class
- LockFileValidatorTest
- @coversDefaultClass \Drupal\package_manager\Validator\LockFileValidator @group package_manager @internal
Namespace
Drupal\Tests\package_manager\KernelCode
public function testLockFileDeleted(string $event_class) : void {
// Add a listener with an extremely high priority to the same event that
// should raise the validation error. Because the validator uses the default
// priority of 0, this listener deletes lock file before the validator
// runs.
$this->addEventTestListener(function () {
unlink($this->activeDir . '/composer.lock');
}, $event_class);
$result = ValidationResult::createError([
t('The active lock file (@file) does not exist.', [
'@file' => $this->activeDir . '/composer.lock',
]),
], t('Problem detected in lock file during stage operations.'));
$stage = $this->assertResults([
$result,
], $event_class);
// A status check should agree that there is an error here.
$this->assertStatusCheckResults([
$result,
], $stage);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.