summaryrefslogtreecommitdiffstats
path: root/apps/files_versions
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2023-02-14 12:38:51 +0100
committerJulius Härtl <jus@bitgrid.net>2023-03-13 10:52:37 +0100
commitc22d51c1ad939e1bf2a2b78f8fb3329a5269c9e7 (patch)
treef357405c1ae2baf59361303159d12995562967cf /apps/files_versions
parentcf46bd691566833ee60e8939872d16425f48a64e (diff)
downloadnextcloud-server-c22d51c1ad939e1bf2a2b78f8fb3329a5269c9e7.tar.gz
nextcloud-server-c22d51c1ad939e1bf2a2b78f8fb3329a5269c9e7.zip
tests(files_versions): Tear down fs to clear mount cache before testing
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'apps/files_versions')
-rw-r--r--apps/files_versions/lib/Versions/VersionManager.php2
-rw-r--r--apps/files_versions/tests/VersioningTest.php9
2 files changed, 9 insertions, 2 deletions
diff --git a/apps/files_versions/lib/Versions/VersionManager.php b/apps/files_versions/lib/Versions/VersionManager.php
index c11b429202b..5a2480d6233 100644
--- a/apps/files_versions/lib/Versions/VersionManager.php
+++ b/apps/files_versions/lib/Versions/VersionManager.php
@@ -96,7 +96,7 @@ class VersionManager implements IVersionManager, INameableVersionBackend, IDelet
$backend = $version->getBackend();
$result = $backend->rollback($version);
\OC_Hook::emit('\OCP\Versions', 'rollback', [
- 'path' => \OC\Files\Filesystem::getView()->getRelativePath($version->getSourceFile()->getPath()),
+ 'path' => $version->getVersionPath(),
'revision' => $version->getRevisionId(),
'node' => $version->getSourceFile(),
]);
diff --git a/apps/files_versions/tests/VersioningTest.php b/apps/files_versions/tests/VersioningTest.php
index 4f171031ab3..547f1eca4a6 100644
--- a/apps/files_versions/tests/VersioningTest.php
+++ b/apps/files_versions/tests/VersioningTest.php
@@ -37,6 +37,7 @@ namespace OCA\Files_Versions\Tests;
use OC\Files\Storage\Temporary;
use OCA\Files_Versions\Db\VersionEntity;
use OCA\Files_Versions\Db\VersionsMapper;
+use OCA\Files_Versions\Versions\IVersionManager;
use OCP\Files\IMimeTypeLoader;
use OCP\IConfig;
use OCP\IUser;
@@ -661,6 +662,7 @@ class VersioningTest extends \Test\TestCase {
public function testRestoreCrossStorage() {
$storage2 = new Temporary([]);
\OC\Files\Filesystem::mount($storage2, [], self::TEST_VERSIONS_USER . '/files/sub');
+ \OC\Files\Filesystem::tearDown();
$this->doTestRestore();
}
@@ -822,7 +824,12 @@ class VersioningTest extends \Test\TestCase {
$params = [];
$this->connectMockHooks('rollback', $params);
- $this->assertTrue(\OCA\Files_Versions\Storage::rollback('sub/test.txt', $t2, $this->user1));
+ $versionManager = \OCP\Server::get(IVersionManager::class);
+ $versions = $versionManager->getVersionsForFile($this->user1, $info1);
+ $version = array_filter($versions, function ($version) use ($t2) {
+ return $version->getRevisionId() === $t2;
+ });
+ $this->assertTrue($versionManager->rollback(current($version)));
$expectedParams = [
'path' => '/sub/test.txt',
];