@@ -86,11 +86,12 @@ public static function setUpBeforeClass() {
8686 }
8787
8888
89-
9089 public static function tearDownAfterClass () {
9190 // cleanup test user
9291 $ user = \OC ::$ server ->getUserManager ()->get (self ::TEST_TRASHBIN_USER1 );
93- if ($ user !== null ) { $ user ->delete (); }
92+ if ($ user !== null ) {
93+ $ user ->delete ();
94+ }
9495
9596 \OC ::$ server ->getConfig ()->setSystemValue ('trashbin_retention_obligation ' , self ::$ rememberRetentionObligation );
9697
@@ -109,6 +110,18 @@ protected function setUp() {
109110 parent ::setUp ();
110111
111112 \OC ::$ server ->getAppManager ()->enableApp ('files_trashbin ' );
113+ $ config = \OC ::$ server ->getConfig ();
114+ $ mockConfig = $ this ->getMock ('\OCP\IConfig ' );
115+ $ mockConfig ->expects ($ this ->any ())
116+ ->method ('getSystemValue ' )
117+ ->will ($ this ->returnCallback (function ($ key , $ default ) use ($ config ) {
118+ if ($ key === 'filesystem_check_changes ' ) {
119+ return \OC \Files \Cache \Watcher::CHECK_ONCE ;
120+ } else {
121+ return $ config ->getSystemValue ($ key , $ default );
122+ }
123+ }));
124+ $ this ->overwriteService ('AllConfig ' , $ mockConfig );
112125
113126 $ this ->trashRoot1 = '/ ' . self ::TEST_TRASHBIN_USER1 . '/files_trashbin ' ;
114127 $ this ->trashRoot2 = '/ ' . self ::TEST_TRASHBIN_USER2 . '/files_trashbin ' ;
@@ -117,6 +130,7 @@ protected function setUp() {
117130 }
118131
119132 protected function tearDown () {
133+ $ this ->restoreService ('AllConfig ' );
120134 // disable trashbin to be able to properly clean up
121135 \OC ::$ server ->getAppManager ()->disableApp ('files_trashbin ' );
122136
@@ -138,8 +152,8 @@ protected function tearDown() {
138152 public function testExpireOldFiles () {
139153
140154 $ currentTime = time ();
141- $ expireAt = $ currentTime - 2 * 24 * 60 * 60 ;
142- $ expiredDate = $ currentTime - 3 * 24 * 60 * 60 ;
155+ $ expireAt = $ currentTime - 2 * 24 * 60 * 60 ;
156+ $ expiredDate = $ currentTime - 3 * 24 * 60 * 60 ;
143157
144158 // create some files
145159 \OC \Files \Filesystem::file_put_contents ('file1.txt ' , 'file1 ' );
@@ -187,7 +201,7 @@ public function testExpireOldFilesShared() {
187201
188202 $ currentTime = time ();
189203 $ folder = "trashTest- " . $ currentTime . '/ ' ;
190- $ expiredDate = $ currentTime - 3 * 24 * 60 * 60 ;
204+ $ expiredDate = $ currentTime - 3 * 24 * 60 * 60 ;
191205
192206 // create some files
193207 \OC \Files \Filesystem::mkdir ($ folder );
@@ -250,6 +264,7 @@ public function testExpireOldFilesShared() {
250264
251265 /**
252266 * verify that the array contains the expected results
267+ *
253268 * @param OCP\Files\FileInfo[] $result
254269 * @param string[] $expected
255270 */
@@ -265,7 +280,7 @@ private function verifyArray($result, $expected) {
265280 }
266281 if (!$ found ) {
267282 // if we didn't found the expected file, something went wrong
268- $ this ->assertTrue (false , "can't find expected file ' " . $ expectedFile . "' in trash bin " );
283+ $ this ->assertTrue (false , "can't find expected file ' " . $ expectedFile . "' in trash bin " );
269284 }
270285 }
271286 }
@@ -281,7 +296,7 @@ private function manipulateDeleteTime($files, $trashRoot, $expireDate) {
281296 // modify every second file
282297 $ counter = ($ counter + 1 ) % 2 ;
283298 if ($ counter === 1 ) {
284- $ source = $ trashRoot . '/files/ ' . $ file ['name ' ]. '.d ' . $ file ['mtime ' ];
299+ $ source = $ trashRoot . '/files/ ' . $ file ['name ' ] . '.d ' . $ file ['mtime ' ];
285300 $ target = \OC \Files \Filesystem::normalizePath ($ trashRoot . '/files/ ' . $ file ['name ' ] . '.d ' . $ expireDate );
286301 $ this ->rootView ->rename ($ source , $ target );
287302 $ file ['mtime ' ] = $ expireDate ;
@@ -445,7 +460,7 @@ public function testRestoreFileFromTrashedSubfolder() {
445460 $ trashedFile = $ filesInTrash [0 ];
446461
447462 $ this ->assertTrue (
448- OCA \Files_Trashbin \Trashbin::restore (
463+ OCA \Files_Trashbin \Trashbin::restore (
449464 'folder.d ' . $ trashedFile ->getMtime () . '/file1.txt ' ,
450465 'file1.txt ' ,
451466 $ trashedFile ->getMtime ()
@@ -639,7 +654,7 @@ public static function loginHelper($user, $create = false) {
639654 if ($ create ) {
640655 try {
641656 \OC ::$ server ->getUserManager ()->createUser ($ user , $ user );
642- } catch (\Exception $ e ) { // catch username is already being used from previous aborted runs
657+ } catch (\Exception $ e ) { // catch username is already being used from previous aborted runs
643658
644659 }
645660 }
0 commit comments