function PasswordTestBase::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/Password/PasswordTestBase.php, line 28

Class

PasswordTestBase
Integration tests for the PHP password hashing service.

Namespace

Drupal\KernelTests\Core\Password

Code

public function register(ContainerBuilder $container) : void {
  // The password.* kernel parameters are modified by parent::register().
  // Ensure this test is operating with the parameters set by the subclass.
  // Falls back to the original defaults if they are left unset.
  $originalAlgorithm = $container->getParameter('password.algorithm');
  $originalOptions = $container->getParameter('password.options');
  parent::register($container);
  $container->setParameter('password.algorithm', $this->passwordAlgorithm ?? $originalAlgorithm);
  $container->setParameter('password.options', $this->passwordOptions ?? $originalOptions);
}

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