title: Unit testing in ZF2 with Routes
body: <p>I'm attempting to unit test my ZF2 application and am constantly fighting with the framework just to test my code. Right now it seems now it doesn't like that I'm using routes.</p>
  
  <p>My ServiceConfig is creating a service and I'm hoping to get a route for my service.</p>
  
  <pre><code>$callbackUrl = $serviceManager-&gt;get('router')-&gt;assemble(array(), array(
      'name' =&gt; 'some_random_route_name'
  ));
  </code></pre>
  
  <p>My application runs fine but PHPUnit complains when creating the service:</p>
  
  <pre><code>Zend\Mvc\Router\Exception\RuntimeException: Route with name "some_random_route_name" not found
  </code></pre>
  
  <p>Dumping the list of routes in onBootstrap() I'm seeing that there are routes set there, but in my Service factory which is called AFTERWARDS, there are none. They're being overwritten somehow.</p>
  
  <p>Should routes work within my unit tests or do I need to mock them somehow?</p>
  
  <p>It seems that the only route I'm seeing is "doctrine_cli" and I've figured that only Console routes are working. PHPUnit being a console command, it's removing all of my routes and killing my Service. Is this normal?</p>