title: PHPUnit (Phar) Fatal Error Only When Test Fails
body: <p>I have chosen to use a <code>Phar</code> of <code>PHPUnit</code> (phpunit-4.8.26.phar) to unit test my custom built PHP Framework and Application. The reason I am using the old stable release is because I need compatibility with <code>PHP 5.4.29</code>.</p>
  <p>The reason I have chosen not to use <code>Composer</code> to get PHPUnit is because it's tends to pollute my <code>vendors</code> folder with dependencies. I like to keep it as lean as possible.</p>
  <p>I am using <code>Windows 7 Pro SP1</code>, <code>WampDeveloper v5.4.0.1</code>, <code>ProPhpStorm 2016.1.2</code>, <code>Phing</code> and a whole bunch of other cool stuff to do my thing.</p>
  <hr />
  <h2>The Problem</h2>
  <ul>
  <li>I <strong>CAN</strong> run a passing unit test successfully from within PhpStorm.</li>
  <li>I <strong>CAN</strong> run a group of passing unit tests successfully from within PhpStorm.</li>
  <li>I <strong>CAN NOT</strong> run a FAILING unit test successfully from within PhpStorm.</li>
  <li>I <strong>CAN</strong> run a passing unit test successfully from the command line.</li>
  <li>I <strong>CAN</strong> run a group of passing unit test successfully from the command.</li>
  <li>I <strong>CAN NOT</strong> run a FAILING unit test successfully from the command line.</li>
  </ul>
  <p>Instead of <code>PHPUnit</code> display a typical test failure message it exits with the below errors:</p>
  <pre><code>Warning: require(Composer\Autoload\ClassLoader.php): failed to open stream: No such file or directory in D:\WampDeveloper\Websites\qclean.development\bootstrap\Autoloader.php on line 23
  
  Fatal error: require(): Failed opening required 'Composer\Autoload\ClassLoader.php' (include_path='.;D:\WampDeveloper\Tools\PEAR\pear;D:\WampDeveloper\Tools\PEAR;D:\WampDeveloper\Components\Php\PEAR;D:\WampDeveloper\Tools\PHPMailer;') in D:\WampDeveloper\Websites\qclean.development\bootstrap\Autoloader.php on line 23
  </code></pre>
  <p>And a screen shot to expand on the above:</p>
  <p><a href="https://i.stack.imgur.com/gOxwd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gOxwd.png" alt="enter image description here" /></a></p>
  <hr />
  <h2>Supporting Info</h2>
  <p>My directory structure:</p>
  <p><a href="https://i.stack.imgur.com/py15u.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/py15u.png" alt="enter image description here" /></a></p>
  <hr />
  <p>My unit test script <code>ConfigurationTest.php</code></p>
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  /**
   * Created by PhpStorm
   * User:
   * Date: 04/06/16
   * Time: 12:04 PM
   */
  
  namespace nova\tests\configuration;
  
  use PHPUnit_Framework_TestCase as TestCase;
  
  /**
   * Class ConfigurationTest
   * 
   * @package nova\tests\configuration
   */
  class ConfigurationTest extends TestCase
  {
      protected function setUp()
      {
          parent::setUp();
      }
      
      public function test()
      {
          $result = false;
          
          $this-&gt;assertTrue($result);
      }
      
      protected function tearDown()
      {
          parent::tearDown();
      }
      
  }
  </code></pre>
  <hr />
  <p>My PHPUnit XML configuration file <code>TestAll.xml</code></p>
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  
  &lt;phpunit backupGlobals=&quot;false&quot;
           backupStaticAttributes=&quot;false&quot;
           bootstrap=&quot;../../../bootstrap/Start.php&quot;
           colors=&quot;true&quot;
           convertErrorsToExceptions=&quot;true&quot;
           convertNoticesToExceptions=&quot;true&quot;
           convertWarningsToExceptions=&quot;true&quot;
           processIsolation=&quot;false&quot;
           stopOnError=&quot;false&quot;
           stopOnFailure=&quot;false&quot;
           stopOnIncomplete=&quot;false&quot;
           stopOnSkipped=&quot;false&quot;
           stopOnRisky=&quot;false&quot;
           syntaxCheck=&quot;false&quot;
           timeoutForSmallTests=&quot;1&quot;
           timeoutForMediumTests=&quot;10&quot;
           timeoutForLargeTests=&quot;60&quot;
           verbose=&quot;false&quot;&gt;
  
      &lt;testsuites&gt;
  
          &lt;testsuite name=&quot;Nova Framework Test Suite&quot;&gt;
  
              &lt;!-- &lt;directory&gt;.&lt;/directory&gt; --&gt;
  
              &lt;directory&gt;./configuration&lt;/directory&gt;
  
              &lt;exclude&gt;./input&lt;/exclude&gt;
              &lt;exclude&gt;./request&lt;/exclude&gt;
              &lt;exclude&gt;./security&lt;/exclude&gt;
              &lt;exclude&gt;./validation&lt;/exclude&gt;
          &lt;/testsuite&gt;
  
      &lt;/testsuites&gt;
  
  &lt;/phpunit&gt;
  </code></pre>
  <hr />
  <p>And lastly my Autoloader <code>Autoloader.php</code></p>
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  
  // Ref: https://github.com/philsturgeon/fig-standards
  
  /**
   * Define the application autoloader function.
   */
  function autoload($className)
  {
      $className = ltrim($className, '\\');
      $fileName = '';
      $namespace = '';
      
      if ($lastNsPos = strrpos($className, '\\'))
      {
          $namespace = substr($className, 0, $lastNsPos);
          $className = substr($className, $lastNsPos + 1);
          $fileName  = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
      }
      
      $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $namespace) . '.php';
      
      require $fileName;
  }
  
  /**
   * Register the autoloader functions.
   */
  spl_autoload_register('autoload');
  </code></pre>
  <p>The error and warning indicate the inability to load the <code>Composer\Autoload\ClassLoader.php</code> file. What I don't understand is why it is asking for this file when I am using a <code>Phar</code>? Reading snippets off the internet indicate the Phar should have an internal autoloader though I am unable to see one.</p>
  <p>I do not want to have to install <code>Composer</code> just to get it's autoloader. That would defeat the purpose of trying to solely use the Phar.</p>
  <p>I added the <code>PHPUnit Phar</code> path to my Windows <code>%path%</code> but this did not make any difference. I understand that this should be done if PHPUnit was installed using <code>PEAR</code>.</p>
  <p>Any help on this 'hair pulling out matter' would be greatly appreciated...</p>