示例#1
0
 /**
  * @medium
  */
 function testGetUidAndFilename()
 {
     \OC_User::setUserId(self::TEST_ENCRYPTION_UTIL_USER1);
     $filename = '/tmp-' . $this->getUniqueID() . '.test';
     // Disable encryption proxy to prevent recursive calls
     $proxyStatus = \OC_FileProxy::$enabled;
     \OC_FileProxy::$enabled = false;
     $this->view->file_put_contents($this->userId . '/files/' . $filename, $this->dataShort);
     // Re-enable proxy - our work is done
     \OC_FileProxy::$enabled = $proxyStatus;
     $util = new \OCA\Files_Encryption\Util($this->view, $this->userId);
     list($fileOwnerUid, $file) = $util->getUidAndFilename($filename);
     $this->assertEquals(self::TEST_ENCRYPTION_UTIL_USER1, $fileOwnerUid);
     $this->assertEquals($file, $filename);
     $this->view->unlink($this->userId . '/files/' . $filename);
 }