You are here

class AutomaticUpdatesTestDisableValidatorsServiceProvider in Automatic Updates 8.2

Allows specific validators to be disabled by site settings.

This should only really be used by functional tests. Kernel tests should override their ::register() method to remove service definitions; build tests should stay out of the API/services layer unless absolutely necessary.

Hierarchy

Expanded class hierarchy of AutomaticUpdatesTestDisableValidatorsServiceProvider

File

tests/modules/automatic_updates_test_disable_validators/src/AutomaticUpdatesTestDisableValidatorsServiceProvider.php, line 16

Namespace

Drupal\automatic_updates_test_disable_validators
View source
class AutomaticUpdatesTestDisableValidatorsServiceProvider extends ServiceProviderBase {

  /**
   * {@inheritdoc}
   */
  public function alter(ContainerBuilder $container) {
    $validators = Settings::get('automatic_updates_disable_validators', []);
    array_walk($validators, [
      $container,
      'removeDefinition',
    ]);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AutomaticUpdatesTestDisableValidatorsServiceProvider::alter public function Modifies existing service definitions. Overrides ServiceProviderBase::alter
ServiceProviderBase::register public function Registers services to the container. Overrides ServiceProviderInterface::register 1