title: PHPUnit cannot find classes namespace
body: <p>I'm trying to run some unit tests using PHPUnit, but, when I use the command line to test, my test class cannot find the namespace from my main class.</p>
  
  <p>This is my folder structure:</p>
  
  <pre><code>data/ 
  src/
      Dao/
      Entity/
          City.php
      Facade/
      SplClassLoader.php 
  tests/
      Entity/
          CityTest.php
      bootstrap.php
      phpunit.xml 
  vendor/ 
  composer.json 
  composer.lock
  </code></pre>
  
  <p>This is the content of one of my classes inside /src/Entity/</p>
  
  <pre><code>&lt;?php
  
  namespace Entity;
  
  class City
  {
      /**
       * @var int
       */
      private $id;
  </code></pre>
  
  <p>my phpunit.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;phpunit bootstrap="../vendor/autoload.php"&gt;
      &lt;testsuites&gt;
          &lt;testsuite name="Application Test"&gt;
              &lt;directory&gt;tests&lt;/directory&gt;
          &lt;/testsuite&gt;
      &lt;/testsuites&gt;
  &lt;/phpunit&gt;
  </code></pre>
  
  <p>And my CityTest.php</p>
  
  <pre><code>&lt;?php
  
  class CityTest extends PHPUnit_Framework_TestCase
  {
      public function testAdd()
      {
          $city = new Entity\City(1, "London");
      }
  }
  </code></pre>
  
  <p>When I run the command <code>phpunit tests/Entity/CityTest.php</code> I got this message error:</p>
  
  <blockquote>
    <p>PHP Fatal error:  Class 'Entity\City' not found</p>
  </blockquote>
  
  <p>What can I do to fix this problem?</p>
  
  <p>Thank you.</p>
  
  <p><strong>Update</strong></p>
  
  <p>I've resolved my problem with some updates. Here is my final folder structure:</p>
  
  <pre><code>data/  
  src/  
  tests/  
  vendor/
  composer.json*  
  composer.lock*
  phpunit.xml*
  </code></pre>
  
  <p>phpunit.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;phpunit backupGlobals="false"
           backupStaticAttributes="false"
           bootstrap="vendor/autoload.php"
           colors="true"
           convertErrorsToExceptions="true"
           convertNoticesToExceptions="true"
           convertWarningsToExceptions="true"
           processIsolation="false"
           stopOnFailure="false"
           syntaxCheck="false"
          &gt;
      &lt;testsuites&gt;
          &lt;testsuite name="Application Test Suite"&gt;
              &lt;directory&gt;./tests/&lt;/directory&gt;
          &lt;/testsuite&gt;
      &lt;/testsuites&gt;
  &lt;/phpunit&gt;
  </code></pre>
  
  <p>composer.json</p>
  
  <pre><code>"require-dev": {
      "phpunit/phpunit": "4.8.*"
    },
  
    "config": {
      "process-timeout": 600,
      "preferred-install": "dist",
      "github-protocols": ["https"]
    },
  
    "autoload": {
      "psr-4": {
        "": "src/"
      }
    },
  </code></pre>