function ExecutableFinderTest::testLegacyExecutablePaths

Tests that the executable finder falls back to looking in config for paths.

Attributes

#[Group('legacy')]

File

core/modules/package_manager/tests/src/Unit/ExecutableFinderTest.php, line 97

Class

ExecutableFinderTest
Tests Package Manager's executable finder service.

Namespace

Drupal\Tests\package_manager\Unit

Code

public function testLegacyExecutablePaths() : void {
  $exception = $this->prophesize(LogicException::class);
  $decorated = $this->prophesize(ExecutableFinderInterface::class);
  $decorated->find('composer')
    ->willThrow($exception->reveal());
  $decorated->find('rsync')
    ->willThrow($exception->reveal());
  $finder = new ExecutableFinder($decorated->reveal(), $this->prophesize(FileSystemInterface::class)
    ->reveal(), $this->getConfigFactoryStub([
    'package_manager.settings' => [
      'executables' => [
        'composer' => 'legacy-composer',
        'rsync' => 'legacy-rsync',
      ],
    ],
  ]));
  // Simulate Composer not being locally installed, with no fallback setting.
  $reflector = new \ReflectionProperty($finder, 'composerPackagePath');
  $reflector->setValue($finder, FALSE);
  $this->expectDeprecation("Storing the path to Composer in configuration is deprecated in drupal:11.2.4 and not supported in drupal:12.0.0. Add composer/composer directly to your project's dependencies instead. See https://www.drupal.org/node/3540264");
  $finder->find('composer');
  $this->expectDeprecation("Storing the path to rsync in configuration is deprecated in drupal:11.2.4 and not supported in drupal:12.0.0. Move it to the <code>package_manager_rsync_path</code> setting instead. See https://www.drupal.org/node/3540264");
  $finder->find('rsync');
}

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