Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. FunctionalTestSetupTrait.php

function FunctionalTestSetupTrait::setContainerParameter

Changes parameters in the services.yml file.

Parameters

string $name: The name of the parameter.

string|array|bool $value: The value of the parameter.

1 call to FunctionalTestSetupTrait::setContainerParameter()
FunctionalTestSetupTrait::initSettings in core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php
Initialize settings created during install.

File

core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php, line 204

Class

FunctionalTestSetupTrait
Defines a trait for shared functional test setup functionality.

Namespace

Drupal\Core\Test

Code

protected function setContainerParameter($name, $value) {
    $filename = $this->siteDirectory . '/services.yml';
    chmod($filename, 0666);
    $services = Yaml::decode(file_get_contents($filename));
    $services['parameters'][$name] = $value;
    file_put_contents($filename, Yaml::encode($services));
    // Ensure that the cache is deleted for the yaml file loader.
    $file_cache = FileCacheFactory::get('container_yaml_loader');
    $file_cache->delete($filename);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal