本文整理汇总了PHP中OCA\Files_Versions\Storage::store方法的典型用法代码示例。如果您正苦于以下问题:PHP Storage::store方法的具体用法?PHP Storage::store怎么用?PHP Storage::store使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OCA\Files_Versions\Storage
的用法示例。
在下文中一共展示了Storage::store方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testDownloadVersions
function testDownloadVersions()
{
// login as admin
self::loginHelper(self::TEST_ENCRYPTION_SHARE_USER1);
$rootView = new \OC\Files\View();
// save file twice to create a new version
\OC\Files\Filesystem::file_put_contents($this->filename, "revision1");
\OCA\Files_Versions\Storage::store($this->filename);
\OC\Files\Filesystem::file_put_contents($this->filename, "revision2");
// check if the owner can retrieve the correct version
$versions = \OCA\Files_Versions\Storage::getVersions(self::TEST_ENCRYPTION_SHARE_USER1, $this->filename);
$this->assertSame(1, count($versions));
$version = reset($versions);
$versionUser1 = $rootView->file_get_contents('/' . self::TEST_ENCRYPTION_SHARE_USER1 . '/files_versions/' . $this->filename . '.v' . $version['version']);
$this->assertSame('revision1', $versionUser1);
// share the file
$fileInfo = \OC\Files\Filesystem::getFileInfo($this->filename);
$this->assertInstanceOf('\\OC\\Files\\FileInfo', $fileInfo);
$this->assertTrue(\OCP\Share::shareItem('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, self::TEST_ENCRYPTION_SHARE_USER2, \OCP\Constants::PERMISSION_ALL));
// try to download the version as user2
self::loginHelper(self::TEST_ENCRYPTION_SHARE_USER2);
$versionUser2 = $rootView->file_get_contents('/' . self::TEST_ENCRYPTION_SHARE_USER1 . '/files_versions/' . $this->filename . '.v' . $version['version']);
$this->assertSame('revision1', $versionUser2);
//cleanup
self::loginHelper(self::TEST_ENCRYPTION_SHARE_USER1);
\OCP\Share::unshare('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, self::TEST_ENCRYPTION_SHARE_USER2);
\OC\Files\Filesystem::unlink($this->filename);
}