function InstallerTranslationDownloadTest::register

Same name and namespace in other branches
  1. main core/tests/Drupal/KernelTests/Core/Installer/InstallerTranslationDownloadTest.php \Drupal\KernelTests\Core\Installer\InstallerTranslationDownloadTest::register()

Registers test-specific services.

Extend this method in your test to register additional services. This method is called whenever the kernel is rebuilt.

Parameters

\Drupal\Core\DependencyInjection\ContainerBuilder $container: The service container to enhance.

Overrides KernelTestBase::register

File

core/tests/Drupal/KernelTests/Core/Installer/InstallerTranslationDownloadTest.php, line 88

Class

InstallerTranslationDownloadTest
Tests that profile translations are downloaded by the installer.

Namespace

Drupal\KernelTests\Core\Installer

Code

public function register(ContainerBuilder $container) : void {
  $handler = function (RequestInterface $request) : Response {
    $this->requests[] = $request->getMethod() . ' ' . basename($request->getUri()
      ->getPath());
    // We don't care about the response; we're just ensuring that certain
    // requests are made.
    return new Response(body: "msgid: \"\"\nmsgstr \"\"");
  };
  $client = new Client([
    'handler' => $handler,
  ]);
  $container->set('http_client', $client);
  parent::register($container);
}

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