title: Symfony: Can I change container parameters on run time?
body: <p>I am totally new to Symfony, and I try to run some Acceptance tests. All good until now, but when I run the test I get a response like the following:</p>
  
  <p><a href="https://i.stack.imgur.com/qBZe2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qBZe2.png" alt="enter image description here"></a></p>
  
  <p>When I run my API controllers using the PostMan, I don't get any related information. I have this output only while I run the tests in my command line.</p>
  
  <p>Based on the output message:</p>
  
  <p><code>The "UsersBundle\Controller\UsersController" service is private, getting it from the contains is deprecated since Symfony 3.2 and will fail in 4.0. You should either make the service public, or stop using the container directly and use dependency injection instead.</code></p>
  
  <p>Apart from that I don't use the <code>UsersController</code> directly in my test method:</p>
  
  <pre><code>public function test_cannot_send_multiple_possword_reset_requests() {
      $client = static::createClient( $this-&gt;defaults );
  
      $client-&gt;request(
          'POST',
          '/api/v1/user-account/request/reset',
          [
              'username' =&gt; 'merianos',
          ],
          [],
          [
              'Content-Type' =&gt; 'application/json',
          ]
      );
  
      $this-&gt;assertEquals( 400, $client-&gt;getResponse()-&gt;getStatusCode() );
      $this-&gt;assertContains(
          'An email containing your password reset token has been send.',
          $client-&gt;getResponse()-&gt;getContent()
      );
  }
  </code></pre>
  
  <p>I was wondering if it is possible to override the following setting at runtime only for my unit/acceptance tests:</p>
  
  <pre><code># /src/UsersBundle/Resources/config/services.yml
  services:
      _defaults:
          public: false
  </code></pre>
  
  <p>Or of course, if there's any other way to achieve that same result.</p>
  
  <p>Note, that I am using Symfony 3.4.</p>