function LockFileValidatorTest::register

Overrides PackageManagerKernelTestBase::register

File

core/modules/package_manager/tests/src/Kernel/LockFileValidatorTest.php, line 46

Class

LockFileValidatorTest
@coversDefaultClass \Drupal\package_manager\Validator\LockFileValidator @group package_manager @internal

Namespace

Drupal\Tests\package_manager\Kernel

Code

public function register(ContainerBuilder $container) : void {
    parent::register($container);
    // Temporarily mock the Composer inspector to prevent it from complaining
    // over the lack of a lock file if it's invoked by other validators.
    $inspector = $this->prophesize(ComposerInspector::class);
    $arguments = Argument::cetera();
    $inspector->getConfig('allow-plugins', $arguments)
        ->willReturn('[]');
    $inspector->getConfig('secure-http', $arguments)
        ->willReturn('true');
    $inspector->getConfig('disable-tls', $arguments)
        ->willReturn('false');
    $inspector->getConfig('extra', $arguments)
        ->willReturn('{}');
    $inspector->getConfig('minimum-stability', $arguments)
        ->willReturn('stable');
    $inspector->getInstalledPackagesList($arguments)
        ->willReturn(new InstalledPackagesList());
    $inspector->getAllowPluginsConfig($arguments)
        ->willReturn([]);
    $inspector->validate($arguments);
    $inspector->getRootPackageInfo($arguments)
        ->willReturn([]);
    $container->set(ComposerInspector::class, $inspector->reveal());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.