function ComposerDeprecationTest::testVendorTestCodeCleanup

@covers ::vendorTestCodeCleanup
@group legacy

File

core/tests/Drupal/Tests/Core/Composer/ComposerDeprecationTest.php, line 44

Class

ComposerDeprecationTest
Tests the deprecations in the Drupal\Core\Composer\Composer class.

Namespace

Drupal\Tests\Core\Composer

Code

public function testVendorTestCodeCleanup() {
  $event = $this->prophesize(PackageEvent::class);
  $composer = $this->prophesize(ComposerClass::class);
  $event->getComposer()
    ->willReturn($composer->reveal());
  $config = $this->prophesize(Config::class);
  $composer->getConfig()
    ->willReturn($config->reveal());
  $operation = $this->prophesize(UpdateOperation::class);
  $event->getOperation()
    ->willReturn($operation->reveal());
  $package = $this->prophesize(Package::class);
  $operation->getTargetPackage()
    ->willReturn($package->reveal());
  $package->getName()
    ->willReturn('foo');
  $package->getPrettyName()
    ->willReturn('foo');
  $io = $this->prophesize(IOInterface::class);
  $event->getIO()
    ->willReturn($io->reveal());
  $this->expectDeprecation('Unsilenced deprecation: Calling Drupal\\Core\\Composer\\Composer::vendorTestCodeCleanup from composer.json is deprecated in drupal:9.5.0 and is removed from drupal:10.0.0. Any "scripts" section mentioning this in composer.json can be removed and replaced with the drupal/core-vendor-hardening Composer plugin, as needed. See https://www.drupal.org/node/3260624');
  Composer::vendorTestCodeCleanup($event->reveal());
}

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