Merge "StringUtils: Add a utility for checking if a string is a valid regex"
[lhc/web/wiklou.git] / tests / phpunit / includes / filebackend / FileBackendTest.php
index 062087d..e344d57 100644 (file)
@@ -942,8 +942,7 @@ class FileBackendTest extends MediaWikiTestCase {
                        "$base/unittest-cont1/e/fileB.a",
                        "$base/unittest-cont1/e/fileC.a"
                ];
-               $createOps = [];
-               $purgeOps = [];
+               $createOps = $copyOps = $moveOps = $deleteOps = [];
                foreach ( $files as $path ) {
                        $status = $this->prepare( [ 'dir' => dirname( $path ) ] );
                        $this->assertGoodStatus( $status,
@@ -951,10 +950,21 @@ class FileBackendTest extends MediaWikiTestCase {
                        $createOps[] = [ 'op' => 'create', 'dst' => $path, 'content' => mt_rand( 0, 50000 ) ];
                        $copyOps[] = [ 'op' => 'copy', 'src' => $path, 'dst' => "$path-2" ];
                        $moveOps[] = [ 'op' => 'move', 'src' => "$path-2", 'dst' => "$path-3" ];
-                       $purgeOps[] = [ 'op' => 'delete', 'src' => $path ];
-                       $purgeOps[] = [ 'op' => 'delete', 'src' => "$path-3" ];
+                       $moveOps[] = [
+                               'op' => 'move',
+                               'src' => "$path-nothing",
+                               'dst' => "$path-nowhere",
+                               'ignoreMissingSource' => true
+                       ];
+                       $deleteOps[] = [ 'op' => 'delete', 'src' => $path ];
+                       $deleteOps[] = [ 'op' => 'delete', 'src' => "$path-3" ];
+                       $deleteOps[] = [
+                               'op' => 'delete',
+                               'src' => "$path-gone",
+                               'ignoreMissingSource' => true
+                       ];
                }
-               $purgeOps[] = [ 'op' => 'null' ];
+               $deleteOps[] = [ 'op' => 'null' ];
 
                $this->assertGoodStatus(
                        $this->backend->doQuickOperations( $createOps ),
@@ -995,7 +1005,7 @@ class FileBackendTest extends MediaWikiTestCase {
                        "File {$files[0]} still exists." );
 
                $this->assertGoodStatus(
-                       $this->backend->doQuickOperations( $purgeOps ),
+                       $this->backend->doQuickOperations( $deleteOps ),
                        "Quick deletion of source files succeeded ($backendName)." );
                foreach ( $files as $file ) {
                        $this->assertFalse( $this->backend->fileExists( [ 'src' => $file ] ),
@@ -2412,7 +2422,7 @@ class FileBackendTest extends MediaWikiTestCase {
                        "$base/subdir2/subdir/sub/120-px-file.txt",
                ];
 
-               for ( $i = 0; $i < 25; $i++ ) {
+               for ( $i = 0; $i < 2; $i++ ) {
                        $status = $this->backend->lockFiles( $paths, LockManager::LOCK_EX );
                        $this->assertEquals( print_r( [], true ), print_r( $status->getErrors(), true ),
                                "Locking of files succeeded ($backendName) ($i)." );