ImboUnitTest\Http\Response\ResponseFormatterTest::testUsesTheOriginalMimeTypeOfTheImageIfTheClientHasNoPreference PHP Method

testUsesTheOriginalMimeTypeOfTheImageIfTheClientHasNoPreference() public method

public testUsesTheOriginalMimeTypeOfTheImageIfTheClientHasNoPreference ( $originalMimeType, $expectedFormatter )
    public function testUsesTheOriginalMimeTypeOfTheImageIfTheClientHasNoPreference($originalMimeType, $expectedFormatter)
    {
        // Use a real object since the code we are testing uses get_class(), which won't work as
        // expected when the object used is a mock
        $image = new Image();
        $image->setMimeType($originalMimeType);
        $requestHeaders = $this->getMock('Symfony\\Component\\HttpFoundation\\HeaderBag');
        $requestHeaders->expects($this->once())->method('get')->with('Accept', '*/*')->will($this->returnValue('image/*'));
        $this->request->headers = $requestHeaders;
        $this->contentNegotiation->expects($this->any())->method('isAcceptable')->will($this->returnValue(1));
        $this->response->expects($this->once())->method('setVary')->with('Accept');
        $this->response->expects($this->once())->method('getModel')->will($this->returnValue($image));
        $this->responseFormatter->negotiate($this->event);
        $this->assertSame($expectedFormatter, $this->responseFormatter->getFormatter());
    }