ImboUnitTest\EventListener\ImageTransformationCacheTest::testChangesTheImageInstanceOnCacheHit PHP Method

testChangesTheImageInstanceOnCacheHit() public method

    public function testChangesTheImageInstanceOnCacheHit()
    {
        $imageFromCache = $this->getMock('Imbo\\Model\\Image');
        $headersFromCache = $this->getMock('Symfony\\Component\\HttpFoundation\\ResponseHeaderBag');
        $cachedData = serialize(['image' => $imageFromCache, 'headers' => $headersFromCache]);
        $this->request->expects($this->any())->method('getUser')->will($this->returnValue($this->user));
        $this->request->expects($this->any())->method('getImageIdentifier')->will($this->returnValue($this->imageIdentifier));
        $this->request->expects($this->any())->method('getExtension')->will($this->returnValue('png'));
        $this->requestHeaders->expects($this->any())->method('get')->with('Accept', '*/*')->will($this->returnValue('text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'));
        $this->query->expects($this->any())->method('get')->with('t')->will($this->returnValue(['thumbnail']));
        $this->response->expects($this->once())->method('setModel')->with($imageFromCache)->will($this->returnSelf());
        $this->event->expects($this->once())->method('stopPropagation');
        $dir = 'vfs://cacheDir/u/s/e/user/7/b/f/7bf2e67f09de203da740a86cd37bbe8d/b/c/6';
        $file = 'bc6ffe312a5741a5705afe8639c08835';
        $fullPath = $dir . '/' . $file;
        mkdir($dir, 0775, true);
        file_put_contents($fullPath, $cachedData);
        $this->listener->loadFromCache($this->event);
        $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\ResponseHeaderBag', $this->response->headers);
        return $this->listener;
    }