aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin/tests/StorageTest.php
diff options
context:
space:
mode:
authorLouis Chemineau <louis@chmn.me>2022-12-12 18:27:50 +0100
committerLouis (Rebase PR Action) <artonge@users.noreply.github.com>2023-01-26 10:12:23 +0000
commit53d736207c87485763f5cbfd04a4ea3067b6606d (patch)
tree55027bdce4f1d1307b3fc52ad961eaa45fe3737f /apps/files_trashbin/tests/StorageTest.php
parent2ce4ac4aa4495712692a8c7e02318c8735f8465f (diff)
downloadnextcloud-server-53d736207c87485763f5cbfd04a4ea3067b6606d.tar.gz
nextcloud-server-53d736207c87485763f5cbfd04a4ea3067b6606d.zip
Adapt files_versions tests to modernized hooks
Signed-off-by: Louis Chemineau <louis@chmn.me>
Diffstat (limited to 'apps/files_trashbin/tests/StorageTest.php')
-rw-r--r--apps/files_trashbin/tests/StorageTest.php16
1 files changed, 4 insertions, 12 deletions
diff --git a/apps/files_trashbin/tests/StorageTest.php b/apps/files_trashbin/tests/StorageTest.php
index 0a7a129ca28..0a22a9ea555 100644
--- a/apps/files_trashbin/tests/StorageTest.php
+++ b/apps/files_trashbin/tests/StorageTest.php
@@ -35,11 +35,13 @@ use OC\Files\Filesystem;
use OC\Files\Storage\Common;
use OC\Files\Storage\Local;
use OC\Files\Storage\Temporary;
+use OCA\Files_Versions\AppInfo\Application as FVApplication;
use OCA\Files_Trashbin\AppInfo\Application;
use OCA\Files_Trashbin\Events\MoveToTrashEvent;
use OCA\Files_Trashbin\Storage;
use OCA\Files_Trashbin\Trash\ITrashManager;
use OCP\AppFramework\Bootstrap\IBootContext;
+use OCP\AppFramework\Bootstrap\IRegistrationContext;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\Files\Cache\ICache;
use OCP\Files\Folder;
@@ -92,6 +94,8 @@ class StorageTest extends \Test\TestCase {
parent::setUp();
\OC_Hook::clear();
+ \OC::$server->boot();
+
// register trashbin hooks
$trashbinApp = new Application();
$trashbinApp->boot($this->createMock(IBootContext::class));
@@ -224,8 +228,6 @@ class StorageTest extends \Test\TestCase {
* Test that deleted versions properly land in the trashbin.
*/
public function testDeleteVersionsOfFile() {
- \OCA\Files_Versions\Hooks::connectHooks();
-
// trigger a version (multiple would not work because of the expire logic)
$this->userView->file_put_contents('test.txt', 'v1');
@@ -253,8 +255,6 @@ class StorageTest extends \Test\TestCase {
* Test that deleted versions properly land in the trashbin.
*/
public function testDeleteVersionsOfFolder() {
- \OCA\Files_Versions\Hooks::connectHooks();
-
// trigger a version (multiple would not work because of the expire logic)
$this->userView->file_put_contents('folder/inside.txt', 'v1');
@@ -288,8 +288,6 @@ class StorageTest extends \Test\TestCase {
* Test that deleted versions properly land in the trashbin when deleting as share recipient.
*/
public function testDeleteVersionsOfFileAsRecipient() {
- \OCA\Files_Versions\Hooks::connectHooks();
-
$this->userView->mkdir('share');
// trigger a version (multiple would not work because of the expire logic)
$this->userView->file_put_contents('share/test.txt', 'v1');
@@ -341,8 +339,6 @@ class StorageTest extends \Test\TestCase {
* Test that deleted versions properly land in the trashbin when deleting as share recipient.
*/
public function testDeleteVersionsOfFolderAsRecipient() {
- \OCA\Files_Versions\Hooks::connectHooks();
-
$this->userView->mkdir('share');
$this->userView->mkdir('share/folder');
// trigger a version (multiple would not work because of the expire logic)
@@ -410,8 +406,6 @@ class StorageTest extends \Test\TestCase {
* unlink() which should NOT trigger the version deletion logic.
*/
public function testKeepFileAndVersionsWhenMovingFileBetweenStorages() {
- \OCA\Files_Versions\Hooks::connectHooks();
-
$storage2 = new Temporary([]);
\OC\Files\Filesystem::mount($storage2, [], $this->user . '/files/substorage');
@@ -451,8 +445,6 @@ class StorageTest extends \Test\TestCase {
* unlink() which should NOT trigger the version deletion logic.
*/
public function testKeepFileAndVersionsWhenMovingFolderBetweenStorages() {
- \OCA\Files_Versions\Hooks::connectHooks();
-
$storage2 = new Temporary([]);
\OC\Files\Filesystem::mount($storage2, [], $this->user . '/files/substorage');