title: Zend Framework 2 project relative paths in PHPUnit + PHPStorm
body: <p>I'm attempting to execute my PHPUnit test cases within PHPStorm.  </p>
  
  <p>I already added the composer.phar at the root of the project, and tied it into my PHPStorm configuration.</p>
  
  <p>Now I right click on the <code>phpunit.xml.dist</code> and select run.. </p>
  
  <p>The module leverages a Logger module I wrote with the following line</p>
  
  <p><code>
          // Error occurred, begin a logfile
          $logger = new Logger();
          $writer = new Stream('data/logs/services-api.log');
          $logger-&gt;addWriter($writer);s
  </code>
  This works fine while running on Apache, NGinx, etc...</p>
  
  <p>but in PHPunit it seems to not go where I'm expecting.  </p>
  
  <p>```</p>
  
  <pre><code>Zend\Log\Exception\RuntimeException : "data/logs/services-api.log" cannot be opened with mode "a"
  #0 ~ZendProject/module/Common/src/Common/Listeners/ApiErrorListener.php(31): Zend\Log\Writer\Stream-&gt;__construct('data/logs/servi...')
  #1 [internal function]: Common\Listeners\ApiErrorListener::onRender(Object(Zend\Mvc\MvcEvent))
  </code></pre>
  
  <p>```</p>
  
  <p>I know the data\logs folder is writeable because this code works fine in ZendFramework on Apache... I'm guessing I need to modify my Bootstrap.php somehow?</p>
  
  <p>How can I debug this path, and more importantly refactor my PATH(s) properly for production AND PHPUnit calls?</p>
  
  <p><strong>Edit</strong> : I am starting to ouput my current working directory thanks to this tip</p>
  
  <p><a href="https://stackoverflow.com/a/7493389/389976">https://stackoverflow.com/a/7493389/389976</a></p>
  
  <pre><code>    public function setUp()
      {
          $this-&gt;expectOutputString('');
          print_r("Current Working Directory = " . getcwd());
          print "";
       ...
      }
  </code></pre>
  
  <p>Giving me some output ...</p>
  
  <pre><code> Current Working Directory = ~ZendProject/module/ActivityWall/test
  </code></pre>
  
  <p>How do I properly modify the CWD so that PHPunit can log properly?  I'm guessing in BootStrap.php but...?</p>