public function testOnRouteWith404Path()
{
$route = Mockery::mock('Zend\\Mvc\\Router\\Http\\RouteMatch');
$route->shouldReceive('getMatchedRouteName')->once()->andReturn('cms');
$route->shouldReceive('getParam')->with('path')->once()->andReturn('/this/is/a/path');
$events = Mockery::mock('Zend\\EventManager\\EventInterface');
$events->shouldReceive('getRouteMatch')->once()->andReturn($route);
$identity = Mockery::mock('Zend\\Authentication\\AuthenticationService');
$identity->shouldReceive('hasIdentity')->andReturn(false);
$serviceManager = Mockery::mock('Zend\\ServiceManager\\ServiceManager');
$serviceManager->shouldReceive('get')->with('Auth')->andReturn($identity);
$serviceManager->shouldReceive('setService')->with('CurrentDocument', false)->once();
$application = Mockery::mock('Zend\\Mvc\\Application');
$application->shouldReceive('getServiceManager')->once()->andReturn($serviceManager);
$events->shouldReceive('getApplication')->once()->andReturn($application);
$this->assertNull($this->object->onRoute($events));
}