title: phpspec testing file contents / file operations
body: <p>I'm curious about the best way of speccing classes that handle file operations.</p>
  
  <p>Assuming I have a fictional class with a method <code>duplicate</code> whose job is to duplicate the contents of a file.</p>
  
  <pre><code>&lt;?php
  
  class FileOperator
  {
      public function duplicate($filename)
      {
          $content = file_get_contents($filename);
          file_put_contents($filename, $content.$content);
      }
  }
  </code></pre>
  
  <p>I know that I can use something like vfsStream to assert the change without touching the actual filesystem (at least with assertions in PHPUnit). </p>
  
  <p>How could I assert that in a spec? Or would it be approached differently?</p>
  
  <p><em>Also, I get that I might want to extract that functionality into another class and use a Spy to assert that the FileOperator calls its dependency correctly, but then I'd still have to spec that adapter class, and my question remains.</em></p>
  
  <p>Thanks.</p>