public function testIsPreviewDeleted() { $sampleFile = '/' . $this->user . '/files/test.txt'; $this->rootView->file_put_contents($sampleFile, 'dummy file data'); $x = 50; $y = 50; $preview = new \OC\Preview($this->user, 'files/', 'test.txt', $x, $y); $preview->getPreview(); $fileInfo = $this->rootView->getFileInfo($sampleFile); $fileId = $fileInfo['fileid']; $thumbCacheFile = '/' . $this->user . '/' . \OC\Preview::THUMBNAILS_FOLDER . '/' . $fileId . '/' . $x . '-' . $y . '.png'; $this->assertEquals($this->rootView->file_exists($thumbCacheFile), true); $preview->deletePreview(); $this->assertEquals($this->rootView->file_exists($thumbCacheFile), false); }
/** * Tests if a preview can be deleted */ public function testIsPreviewDeleted() { $sampleFile = '/' . self::TEST_PREVIEW_USER1 . '/files/test.txt'; $this->rootView->file_put_contents($sampleFile, 'dummy file data'); $x = 50; $y = 50; $preview = new \OC\Preview(self::TEST_PREVIEW_USER1, 'files/', 'test.txt', $x, $y); $preview->getPreview(); $fileInfo = $this->rootView->getFileInfo($sampleFile); /** @var int $fileId */ $fileId = $fileInfo['fileid']; $thumbCacheFile = $this->buildCachePath($fileId, $x, $y, true); $this->assertSame(true, $this->rootView->file_exists($thumbCacheFile), "{$thumbCacheFile} \n"); $preview->deletePreview(); $this->assertSame(false, $this->rootView->file_exists($thumbCacheFile)); }