function FunctionalTestSetupTrait::setContainerParameter

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php \Drupal\Core\Test\FunctionalTestSetupTrait::setContainerParameter()
  2. 10 core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php \Drupal\Core\Test\FunctionalTestSetupTrait::setContainerParameter()
  3. 11.x core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php \Drupal\Core\Test\FunctionalTestSetupTrait::setContainerParameter()

Changes parameters in the services.yml file.

Parameters

string $name: The name of the parameter.

string $value: The value of the parameter.

12 calls to FunctionalTestSetupTrait::setContainerParameter()
CorsIntegrationTest::testCrossSiteRequest in core/tests/Drupal/FunctionalTests/HttpKernel/CorsIntegrationTest.php
FunctionalTestSetupTrait::initSettings in core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php
Initialize settings created during install.
MediaSourceOEmbedVideoTest::initConfig in core/modules/media/tests/src/FunctionalJavascript/MediaSourceOEmbedVideoTest.php
Initialize various configurations post-installation.
PageCacheTest::testPageCacheTagsIndependentFromCacheabilityHeaders in core/modules/page_cache/tests/src/Functional/PageCacheTest.php
Tests that the page cache doesn't depend on cacheability headers.
RouterTest::testFinishResponseSubscriber in core/modules/system/tests/src/Functional/Routing/RouterTest.php
Confirms that our FinishResponseSubscriber logic works properly.

... See full list

File

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

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);
}

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