function RsyncValidatorTest::testPreCreateFailsIfRsyncNotFound

Tests that the stage cannot be created if rsync is selected, but not found.

File

core/modules/package_manager/tests/src/Kernel/RsyncValidatorTest.php, line 60

Class

RsyncValidatorTest
@covers \Drupal\package_manager\Validator\RsyncValidator[[api-linebreak]] @group package_manager @internal

Namespace

Drupal\Tests\package_manager\Kernel

Code

public function testPreCreateFailsIfRsyncNotFound() : void {
  /** @var \PhpTuf\ComposerStager\API\Translation\Factory\TranslatableFactoryInterface $translatable_factory */
  $translatable_factory = $this->container
    ->get(TranslatableFactoryInterface::class);
  $message = $translatable_factory->createTranslatableMessage('Nope!');
  $this->executableFinder
    ->find('rsync')
    ->willThrow(new LogicException($message));
  $result = ValidationResult::createError([
    $this->t('<code>rsync</code> is not available.'),
  ]);
  $this->assertResults([
    $result,
  ], PreCreateEvent::class);
  $this->enableModules([
    'help',
  ]);
  $result = ValidationResult::createError([
    $this->t('<code>rsync</code> is not available. See the <a href="/admin/help/package_manager#package-manager-faq-rsync">Package Manager help</a> for more information on how to resolve this.'),
  ]);
  $this->assertResults([
    $result,
  ], PreCreateEvent::class);
}

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