ImboUnitTest\EventListener\CorsTest::testAddsHeadersIfOriginIsDefinedAndAllowed PHP Method

testAddsHeadersIfOriginIsDefinedAndAllowed() public method

    public function testAddsHeadersIfOriginIsDefinedAndAllowed()
    {
        $listener = new Cors(['allowedOrigins' => ['http://imbo-project.org']]);
        $headers = $this->getMock('Symfony\\Component\\HttpFoundation\\HeaderBag');
        $headers->expects($this->once())->method('add')->with(['Access-Control-Allow-Origin' => 'http://imbo-project.org']);
        $this->response->headers = $headers;
        $this->request->expects($this->once())->method('getMethod')->will($this->returnValue('GET'));
        $route = $this->getMock('Imbo\\Router\\Route');
        $route->expects($this->once())->method('__toString')->will($this->returnValue('index'));
        $this->request->expects($this->once())->method('getRoute')->will($this->returnValue($route));
        $listener->invoke($this->event);
    }