title: PHPUnit: how can you test method with class instantiation?
body: <p>I have a simple class like:</p>
  
  <pre><code>class Subject {
      /** @var ValueObject[] */
      private $collection = [];
  
      function addToCollection (array $whatver) {
          if (array_key_exists($whatever, 'smth')) {
              $collection[] = new ValueObject($whatever);
              return true;
          }
          return false;
      }
  }
  </code></pre>
  
  <p>I know I could simply pass ValueObject to the method, but real life <code>addToCollection()</code> is a bit more complex.</p>
  
  <p>Is it at all possible to test this method with PHPUnit or I should redo it with DI in mind?</p>
  
  <p>Thanks</p>