예제 #1
0
파일: preview.php 프로젝트: Romua1d/core
 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);
 }
예제 #2
0
 /**
  * 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));
 }