ImboUnitTest\EventListener\ImageTransformationCacheTest::testRemovesCorruptCachedDataOnCacheHit PHP Method

testRemovesCorruptCachedDataOnCacheHit() public method

    public function testRemovesCorruptCachedDataOnCacheHit()
    {
        $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->once())->method('get')->with('Accept', '*/*')->will($this->returnValue('text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'));
        $this->query->expects($this->once())->method('get')->with('t')->will($this->returnValue(['thumbnail']));
        $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, 'corrupt data');
        $this->assertTrue(file_exists($fullPath));
        $this->listener->loadFromCache($this->event);
        $this->assertFalse(file_exists($fullPath));
    }