public function testDoesNotAddAccessControlHeadersWhenOriginIsNotAllowed()
{
$route = $this->getMock('Imbo\\Router\\Route');
$route->expects($this->once())->method('__toString')->will($this->returnValue('image'));
$requestHeaders = $this->getMock('Symfony\\Component\\HttpFoundation\\HeaderBag');
$requestHeaders->expects($this->any())->method('get')->with('Origin')->will($this->returnValue('http://somehost'));
$request = $this->getMock('Imbo\\Http\\Request\\Request');
$request->expects($this->once())->method('getRoute')->will($this->returnValue($route));
$request->expects($this->once())->method('getMethod')->will($this->returnValue('GET'));
$request->headers = $requestHeaders;
$event = $this->getMock('Imbo\\EventManager\\Event');
$event->expects($this->once())->method('getRequest')->will($this->returnValue($request));
$event->expects($this->once())->method('getResponse')->will($this->returnValue($this->response));
$listener = new Cors(['allowedOrigin' => 'http://imbo']);
$listener->invoke($event);
}