public function testDoesNotStoreIfCachedVersionAlreadyExists()
{
// Reusing the same logic as this test
$this->testChangesTheImageInstanceOnCacheHit();
$this->response->expects($this->once())->method('getModel')->will($this->returnValue($this->getMock('Imbo\\Model\\Image')));
// Overwrite cached file
$dir = 'vfs://cacheDir/u/s/e/user/7/b/f/7bf2e67f09de203da740a86cd37bbe8d/b/c/6';
$file = 'bc6ffe312a5741a5705afe8639c08835';
$fullPath = $dir . '/' . $file;
file_put_contents($fullPath, 'foobar');
// Since we hit a cached version earlier, we shouldn't overwrite the cached file
$this->listener->storeInCache($this->event);
$this->assertEquals('foobar', file_get_contents($fullPath));
}