title: composer phpunit psr-4 autoload class not found
body: <p>I am giving composer autoload a try with some phpunit testing classes, and I can't seem to get it to work. When I run phpunit from the command line, I get the following error : "PHP Fatal Error: Class ... not found".</p>
  
  <p>I will give all the structure and file information. 
  I can, so hopefully someone will spot where I went wrong.</p>
  
  <p>Structure (cut down to relevant files):</p>
  
  <pre><code>composer.json
  composer.lock
  phpunit.xml
  vendor/
  tests/
      functional/
          BaseTestCase.php
          HomepageTest.php
  </code></pre>
  
  <p>composer.json</p>
  
  <pre><code>{
  "require": {
      "php": "&gt;=5.5.0",
      "slim/slim": "^3.1",
      "slim/php-view": "^2.0",
      "monolog/monolog": "^1.17"
  },
  "require-dev": {
      "phpunit/phpunit": "&gt;=4.8 &lt; 6.0"
  },
  "autoload-dev": {
      "psr-4": {
          "Tests\\": "tests/"
      }
  }
  }
  </code></pre>
  
  <p>phpunit.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;phpunit colors="true" bootstrap="vendor/autoload.php"&gt;
      &lt;testsuites&gt;
          &lt;testsuite name="Initial tests"&gt;
              &lt;directory&gt;tests/&lt;/directory&gt;
          &lt;/testsuite&gt;
      &lt;/testsuites&gt;
  &lt;/phpunit&gt;
  </code></pre>
  
  <p>test/functional/BaseTestCase.php</p>
  
  <pre><code>&lt;?php
  namespace Tests\Functional;
  
  use Slim\App;
  use Slim\Http\Request;
  use Slim\Http\Response;
  use Slim\Http\Environment;
  
  class BaseTestCase extends \PHPUnit_Framework_TestCase
  {
    ...
  </code></pre>
  
  <p>test/functional/HomepageTest.php</p>
  
  <pre><code>&lt;?php
  namespace Tests\Functional;
  
  class HomepageTest extends BaseTestCase
  {
     ...
  </code></pre>
  
  <p>I then ran an update to refresh the autoload files</p>
  
  <pre><code>$ composer update
  
  Loading composer repositories with package information
  Updating dependencies (including require-dev)
  Nothing to install or update
  Writing lock file
  Generating autoload files
  </code></pre>
  
  <p>I then tried running phpunit and got a class not found error:</p>
  
  <pre><code>$ vendor/bin/phpunit
  
  PHP Fatal error:  Class 'Tests\Functional\BaseTestCase' not found in &lt;project-root&gt;/tests/functional/HomepageTest.php on line 6
  </code></pre>
  
  <p>Just to be thorough I tried refreshing the autoload files another way, just in case:</p>
  
  <pre><code>$ composer dump-autoload
  
  Generating autoload files
  sfbagency@sfb1:~/clients/ctest/dev$ 
  </code></pre>
  
  <p>I also checked  vendor/composer/autoload_psr4.php to make sure the Test reference is being set, and it is.</p>
  
  <pre><code>...
  Tests\\' =&gt; array($baseDir . '/tests'),
  ...
  </code></pre>
  
  <p>I have Googled like crazy, but have no idea where I am going wrong.</p>