0
votes

I want to define the Test-Client useragent and hostname in my config.yml.

At the moment I use the same things in each configuration:

$client = static::createClient();
$container = $client->getContainer();
$client->setServerParameters(
    array(
        'HTTP_HOST' => 'Test',
        'HTTP_USER_AGENT' => 'Test'
    )
);

And I wish to use something like this

$client = static::createClient();
$container = $client->getContainer();
$client->setServerParameters(
    array(
        'HTTP_HOST' => $container->getParameter('test.host'),
        'HTTP_USER_AGENT' => $container->getParameter('test.useragent')
    )
);

But that fails.

There is no extension able to load the configuration for "test" in config.yml. Looked for namespace "test", found "framework", "security", "twig", "monolog", "swiftmailer", "assetic", "doctrine" [...]

1

1 Answers

1
votes

Add your values to the parameter.yml.

In general, just putting values into comfig.yml does not automatically add them to your container.

If you want to learn how you can make your code configurable via config.yml have a look at How to expose a Semantic Configuration for a Bundle