コード例 #1
0
ファイル: preview.php プロジェクト: Romua1d/core
 public function testAreAllPreviewsDeleted()
 {
     $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'];
     $thumbCacheFolder = '/' . $this->user . '/' . \OC\Preview::THUMBNAILS_FOLDER . '/' . $fileId . '/';
     $this->assertEquals($this->rootView->is_dir($thumbCacheFolder), true);
     $preview->deleteAllPreviews();
     $this->assertEquals($this->rootView->is_dir($thumbCacheFolder), false);
 }
コード例 #2
0
ファイル: preview.php プロジェクト: The-Website-Nursery/core
 /**
  * Tests if all previews can be deleted
  *
  * We test this first to make sure we'll be able to cleanup after each preview generating test
  */
 public function testAreAllPreviewsDeleted()
 {
     $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'];
     $thumbCacheFolder = '/' . self::TEST_PREVIEW_USER1 . '/' . \OC\Preview::THUMBNAILS_FOLDER . '/' . $fileId . '/';
     $this->assertSame(true, $this->rootView->is_dir($thumbCacheFolder), "{$thumbCacheFolder} \n");
     $preview->deleteAllPreviews();
     $this->assertSame(false, $this->rootView->is_dir($thumbCacheFolder));
 }