function ContainerTest::testSetParameterWithUnfrozenContainer

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php \Drupal\Tests\Component\DependencyInjection\ContainerTest::testSetParameterWithUnfrozenContainer()
  2. 8.9.x core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php \Drupal\Tests\Component\DependencyInjection\ContainerTest::testSetParameterWithUnfrozenContainer()
  3. 11.x core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php \Drupal\Tests\Component\DependencyInjection\ContainerTest::testSetParameterWithUnfrozenContainer()

Tests that Container::setParameter() in an unfrozen case works properly.

@covers ::setParameter

File

core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php, line 125

Class

ContainerTest
@coversDefaultClass \Drupal\Component\DependencyInjection\Container @group DependencyInjection

Namespace

Drupal\Tests\Component\DependencyInjection

Code

public function testSetParameterWithUnfrozenContainer() : void {
    $container_definition = $this->containerDefinition;
    $container_definition['frozen'] = FALSE;
    $this->container = new $this->containerClass($container_definition);
    $this->container
        ->setParameter('some_config', 'new_value');
    $this->assertEquals('new_value', $this->container
        ->getParameter('some_config'), 'Container parameters can be set.');
}

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