99
1010use OC \Files \Cache \Cache ;
1111use OC \Files \Filesystem ;
12+ use OC \Files \SetupManager ;
1213use OC \Files \Storage \Storage ;
1314use OC \Files \Storage \Temporary ;
1415use OC \Files \Storage \Wrapper \Jail ;
1516use OC \Files \View ;
1617use OCA \Files_Sharing \SharedStorage ;
1718use OCP \Constants ;
1819use OCP \Files \Cache \IWatcher ;
20+ use OCP \Files \IRootFolder ;
1921use OCP \IUserManager ;
2022use OCP \Server ;
2123use OCP \Share \IShare ;
@@ -424,8 +426,7 @@ public function testGetPathByIdDirectShare(): void {
424426 $ share = $ this ->shareManager ->createShare ($ share );
425427 $ share ->setStatus (IShare::STATUS_ACCEPTED );
426428 $ this ->shareManager ->updateShare ($ share );
427-
428- \OC_Util::tearDownFS ();
429+ Server::get (SetupManager::class)->tearDown ();
429430
430431 self ::loginHelper (self ::TEST_FILES_SHARING_API_USER2 );
431432 $ this ->assertTrue (Filesystem::file_exists ('/test.txt ' ));
@@ -456,7 +457,7 @@ public function testGetPathByIdShareSubFolder(): void {
456457 $ share = $ this ->shareManager ->createShare ($ share );
457458 $ share ->setStatus (IShare::STATUS_ACCEPTED );
458459 $ this ->shareManager ->updateShare ($ share );
459- \OC_Util:: tearDownFS ();
460+ Server:: get (SetupManager::class)-> tearDown ();
460461
461462 self ::loginHelper (self ::TEST_FILES_SHARING_API_USER2 );
462463 $ this ->assertTrue (Filesystem::file_exists ('/foo ' ));
@@ -484,7 +485,7 @@ public function testNumericStorageId(): void {
484485 $ share = $ this ->shareManager ->createShare ($ share );
485486 $ share ->setStatus (IShare::STATUS_ACCEPTED );
486487 $ this ->shareManager ->updateShare ($ share );
487- \OC_Util:: tearDownFS ();
488+ Server:: get (SetupManager::class)-> tearDown ();
488489
489490 [$ sourceStorage ] = Filesystem::resolvePath ('/ ' . self ::TEST_FILES_SHARING_API_USER1 . '/files/foo ' );
490491
@@ -521,7 +522,7 @@ public function testShareJailedStorage(): void {
521522 $ share = $ this ->shareManager ->createShare ($ share );
522523 $ share ->setStatus (IShare::STATUS_ACCEPTED );
523524 $ this ->shareManager ->updateShare ($ share );
524- \OC_Util:: tearDownFS ();
525+ Server:: get (SetupManager::class)-> tearDown ();
525526
526527 self ::loginHelper (self ::TEST_FILES_SHARING_API_USER2 );
527528 $ this ->assertEquals ('foo ' , Filesystem::file_get_contents ('/sub/foo.txt ' ));
@@ -560,7 +561,7 @@ public function testSearchShareJailedStorage(): void {
560561 $ share = $ this ->shareManager ->createShare ($ share );
561562 $ share ->setStatus (IShare::STATUS_ACCEPTED );
562563 $ this ->shareManager ->updateShare ($ share );
563- \OC_Util:: tearDownFS ();
564+ Server:: get (SetupManager::class)-> tearDown ();
564565
565566 self ::loginHelper (self ::TEST_FILES_SHARING_API_USER2 );
566567
@@ -571,7 +572,7 @@ public function testSearchShareJailedStorage(): void {
571572 $ this ->assertCount (1 , $ results );
572573 }
573574
574- public function testWatcherRootChange () {
575+ public function testWatcherRootChange (): void {
575576 $ sourceStorage = new Temporary ();
576577 $ sourceStorage ->mkdir ('shared ' );
577578 $ sourceStorage ->file_put_contents ('shared/foo.txt ' , 'foo ' );
@@ -581,7 +582,8 @@ public function testWatcherRootChange() {
581582
582583 self ::loginHelper (self ::TEST_FILES_SHARING_API_USER1 );
583584
584- $ rootFolder = \OC ::$ server ->getUserFolder (self ::TEST_FILES_SHARING_API_USER1 );
585+ $ rootFolder = Server::get (IRootFolder::class)
586+ ->getUserFolder (self ::TEST_FILES_SHARING_API_USER1 );
585587 $ node = $ rootFolder ->get ('foo/shared ' );
586588 $ this ->assertEquals (3 , $ node ->getSize ());
587589
@@ -594,14 +596,14 @@ public function testWatcherRootChange() {
594596 $ share = $ this ->shareManager ->createShare ($ share );
595597 $ share ->setStatus (IShare::STATUS_ACCEPTED );
596598 $ this ->shareManager ->updateShare ($ share );
597- \OC_Util:: tearDownFS ();
599+ Server:: get (SetupManager::class)-> tearDown ();
598600
599601 self ::loginHelper (self ::TEST_FILES_SHARING_API_USER2 );
600602
601- $ view = Filesystem::getView ();
602-
603- $ sourceStorage ->rmdir ('shared ' );
603+ $ this ->assertTrue ($ sourceStorage ->rmdir ('shared ' ));
604604
605- $ this ->assertFalse ($ view ->getFileInfo ('shared ' ));
605+ $ this ->assertFalse (Server::get (IRootFolder::class)
606+ ->getUserFolder (self ::TEST_FILES_SHARING_API_USER2 )
607+ ->nodeExists ('shared ' ));
606608 }
607609}
0 commit comments