title: PHP Class not found from a different namespace
body: <p>I'm currently working on a Symfony2 project with Phpspec and I'm having problems to extend a Spec class described in a different namespace.</p>
  
  <p>In my project, for instance, I'm having the following class described in <code>spec/Acme/Model/Foo/FooSpec.php</code> :</p>
  
  <pre><code>namespace spec\Acme\Model\Foo;
  
  use PhpSpec\ObjectBehavior;
  use Prophecy\Argument;
  
  abstract class FooSpec extends ObjectBehavior{
      //some code here
  }
  </code></pre>
  
  <p>And I have another class in <code>spec/Acme/Model/Bar/BarSpec.php</code> extending <code>FooSpec</code> :</p>
  
  <pre><code>namespace spec\Acme\Model\Bar;
  
  use spec\Acme\Model\Foo\FooSpec;
  
  class BarSpec extends FooSpec{
      //some code here
  }
  </code></pre>
  
  <p>When I try to run phpspec, I have the following error :</p>
  
  <p><code>PHP Fatal error:  Class 'spec\Acme\Model\Foo\FooSpec' not found in /home/user/Projects/Acme/spec/Acme/Model/Bar/BarSpec.php on line 9</code></p>
  
  <p>The only way I found to make it work was to add the following line in <code>spec/Acme/Model/Bar/BarSpec.php</code>:</p>
  
  <pre><code>include('./spec/Acme/Model/Foo/FooSpec.php');
  </code></pre>
  
  <p>I don't know why I have to include this specific file to make it run, especially when the other classes (like <code>PhpSpec\ObjectBehavior</code>) are correctly found.</p>
  
  <p>Do you have any idea why is this happening?</p>
  
  <hr>
  
  <p>Edit:</p>
  
  <p>As suggested by @Phil and @Sheikh Heera in the comments, I tried to set up an <code>autoload</code> to register my spec namespace but it's not working neither. Here is what I tried so far :</p>
  
  <pre><code>require_once getcwd() . '/vendor/composer/ClassLoader.php';
  
  $loader = new \Composer\Autoload\ClassLoader();
  
  // register classes with namespaces
  $loader-&gt;add('spec', getcwd().'/spec');
  
  // activate the autoloader
  $loader-&gt;register();
  </code></pre>
  
  <p>I also tried to modify the file <code>vendor/composer/autoload_namespaces.php</code> to add this :</p>
  
  <pre><code>return array(
      //some code here
  
      'spec' =&gt; array(getcwd() . '/spec'),
      //some more code
  
  );
  </code></pre>
  
  <p>But still the same error. I also tried with <code>'spec' =&gt; array(getcwd())</code> or <code>$loader-&gt;add('spec', getcwd());</code> just to see what will happen and this time I get a <code>Cannot redeclare class</code> on another spec class.</p>
  
  <hr>
  
  <p>My php version is <code>PHP 5.4.9-4ubuntu2.4 (cli)</code>.</p>
  
  <p>Thank you in advance for your help.</p>