title: Phpunit reusable test methods in symfony
body: <p>Let's assume that I have three entites: <code>UserEntity</code>, <code>ZooEntity</code> and <code>AnimalEntity</code>. In order to create zoo I have to create user, because zoo has to have owner. In order to create animal I have to create zoo.</p>
  <p>Going further I have 3 controllers for each entity. I also have 3 test classes for controller testing.</p>
  <ul>
  <li><code>UserControllerTest</code></li>
  <li><code>ZooControllerTest</code></li>
  <li><code>AnimalControllerTest</code></li>
  </ul>
  <p>In animal test, every time, in each test (to make every test independent) I have to create user and then zoo. Therefore I created traits eg: <code>UserTestTrait</code> and <code>ZooTestTrait</code> which have <code>createUser</code> and <code>createZoo(user)</code> methods.</p>
  <ol>
  <li>I was wondering about chaning those traits into services. But then where I should keep them?
  Would be <code>tests/services/ZooService</code> a good place?</li>
  </ol>
  <p>For now I such structure:</p>
  <ul>
  <li><code>tests/Controller/Rest/ZooControllerTest</code></li>
  <li><code>tests/Controller/Rest/traits/ZooTestTrait</code></li>
  </ul>
  <ol start="2">
  <li><p>Assuming that I have those services and every service should have access to eg. entity manager, how can I access that in service? eg. <code>ZooService</code> located in <code>tests/services/ZooService</code></p>
  </li>
  <li><p>How can I use that service in controller? Lets assume that I would like to have it in setUp method:</p>
  <pre><code> protected function setUp(): void {
       $kernel = self::bootKernel();
  
       // access the zoo service, that has access to the entity manager
   }
  </code></pre>
  </li>
  </ol>