mirror of
https://github.com/nextcloud/server.git
synced 2026-04-29 18:11:41 -04:00
test: add test for shared storage root being changed after watcher
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
5eac86afec
commit
9e7bed0c46
1 changed files with 35 additions and 0 deletions
|
|
@ -14,6 +14,7 @@ use OC\Files\Storage\Wrapper\Jail;
|
|||
use OC\Files\View;
|
||||
use OCA\Files_Sharing\SharedStorage;
|
||||
use OCP\Constants;
|
||||
use OCP\Files\Cache\IWatcher;
|
||||
use OCP\Share\IShare;
|
||||
|
||||
/**
|
||||
|
|
@ -567,4 +568,38 @@ class CacheTest extends TestCase {
|
|||
$results = $sharedStorage->getCache()->search('foo.txt');
|
||||
$this->assertCount(1, $results);
|
||||
}
|
||||
|
||||
public function testWatcherRootChange() {
|
||||
$sourceStorage = new Temporary();
|
||||
$sourceStorage->mkdir('shared');
|
||||
$sourceStorage->file_put_contents('shared/foo.txt', 'foo');
|
||||
$sourceStorage->getScanner()->scan('');
|
||||
$sourceStorage->getWatcher()->setPolicy(IWatcher::CHECK_ALWAYS);
|
||||
$this->registerMount(self::TEST_FILES_SHARING_API_USER1, $sourceStorage, '/' . self::TEST_FILES_SHARING_API_USER1 . '/files/foo');
|
||||
|
||||
self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
|
||||
|
||||
$rootFolder = \OC::$server->getUserFolder(self::TEST_FILES_SHARING_API_USER1);
|
||||
$node = $rootFolder->get('foo/shared');
|
||||
$this->assertEquals(3, $node->getSize());
|
||||
|
||||
$share = $this->shareManager->newShare();
|
||||
$share->setNode($node)
|
||||
->setShareType(IShare::TYPE_USER)
|
||||
->setSharedWith(self::TEST_FILES_SHARING_API_USER2)
|
||||
->setSharedBy(self::TEST_FILES_SHARING_API_USER1)
|
||||
->setPermissions(Constants::PERMISSION_ALL);
|
||||
$share = $this->shareManager->createShare($share);
|
||||
$share->setStatus(IShare::STATUS_ACCEPTED);
|
||||
$this->shareManager->updateShare($share);
|
||||
\OC_Util::tearDownFS();
|
||||
|
||||
self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
|
||||
|
||||
$view = Filesystem::getView();
|
||||
|
||||
$sourceStorage->rmdir('shared');
|
||||
|
||||
$this->assertFalse($view->getFileInfo('shared'));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue