r109707 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r109706‎ | r109707 | r109708 >
Date:00:34, 22 January 2012
Author:aaron
Status:ok
Tags:
Comment:
* Modified StoreBatchTest and FileBackendTest to allow specifying a registered backend to use
* Improved FileBackendTest file pruning and added more getFileList() tests
Modified paths:
  • /trunk/phase3/tests/phpunit/MediaWikiPHPUnitCommand.php (modified) (history)
  • /trunk/phase3/tests/phpunit/includes/filerepo/FileBackendTest.php (modified) (history)
  • /trunk/phase3/tests/phpunit/includes/filerepo/StoreBatchTest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/phpunit/MediaWikiPHPUnitCommand.php
@@ -5,6 +5,7 @@
66 static $additionalOptions = array(
77 'regex=' => false,
88 'file=' => false,
 9+ 'use-filebackend=' => false,
910 'keep-uploads' => false,
1011 'use-normal-tables' => false,
1112 'reuse-db' => false,
Index: trunk/phase3/tests/phpunit/includes/filerepo/StoreBatchTest.php
@@ -5,22 +5,36 @@
66 class StoreBatchTest extends MediaWikiTestCase {
77
88 public function setUp() {
 9+ global $wgFileBackends;
910 parent::setUp();
1011
1112 # Forge a FSRepo object to not have to rely on local wiki settings
1213 $this->tmpDir = wfTempDir() . '/store-batch-test-' . time() . '-' . mt_rand();
13 - $this->repo = new FSRepo( array(
14 - 'name' => 'test',
15 - 'backend' => new FSFileBackend( array(
 14+ if ( $this->getCliArg( 'use-filebackend=' ) ) {
 15+ $name = $this->getCliArg( 'use-filebackend=' );
 16+ $useConfig = array();
 17+ foreach ( $wgFileBackends as $conf ) {
 18+ if ( $conf['name'] == $name ) {
 19+ $useConfig = $conf;
 20+ }
 21+ }
 22+ $useConfig['name'] = 'localtesting'; // swap name
 23+ $backend = new $conf['class']( $useConfig );
 24+ } else {
 25+ $backend = new FSFileBackend( array(
1626 'name' => 'local-backend',
1727 'lockManager' => 'nullLockManager',
1828 'containerPaths' => array(
19 - 'test-public' => $this->tmpDir . "/public",
20 - 'test-thumb' => $this->tmpDir . "/thumb",
21 - 'test-temp' => $this->tmpDir . "/temp",
22 - 'test-deleted' => $this->tmpDir . "/deleted",
 29+ 'unittests-public' => $this->tmpDir . "/public",
 30+ 'unittests-thumb' => $this->tmpDir . "/thumb",
 31+ 'unittests-temp' => $this->tmpDir . "/temp",
 32+ 'unittests-deleted' => $this->tmpDir . "/deleted",
2333 )
24 - ) )
 34+ ) );
 35+ }
 36+ $this->repo = new FileRepo( array(
 37+ 'name' => 'unittests',
 38+ 'backend' => $backend
2539 ) );
2640
2741 $this->date = gmdate( "YmdHis" );
Index: trunk/phase3/tests/phpunit/includes/filerepo/FileBackendTest.php
@@ -5,18 +5,31 @@
66 */
77 class FileBackendTest extends MediaWikiTestCase {
88 private $backend, $multiBackend;
9 - private $filesToPrune, $pathsToPrune;
 9+ private $filesToPrune;
1010
1111 function setUp() {
 12+ global $wgFileBackends;
1213 parent::setUp();
1314 $tmpDir = wfTempDir() . '/file-backend-test-' . time() . '-' . mt_rand();
14 - $this->singleBackend = new FSFileBackend( array(
15 - 'name' => 'localtesting',
16 - 'lockManager' => 'fsLockManager',
17 - 'containerPaths' => array(
18 - 'cont1' => "$tmpDir/localtesting/cont1",
19 - 'cont2' => "$tmpDir/localtesting/cont2" )
20 - ) );
 15+ if ( $this->getCliArg( 'use-filebackend=' ) ) {
 16+ $name = $this->getCliArg( 'use-filebackend=' );
 17+ $useConfig = array();
 18+ foreach ( $wgFileBackends as $conf ) {
 19+ if ( $conf['name'] == $name ) {
 20+ $useConfig = $conf;
 21+ }
 22+ }
 23+ $useConfig['name'] = 'localtesting'; // swap name
 24+ $this->singleBackend = new $conf['class']( $useConfig );
 25+ } else {
 26+ $this->singleBackend = new FSFileBackend( array(
 27+ 'name' => 'localtesting',
 28+ 'lockManager' => 'fsLockManager',
 29+ 'containerPaths' => array(
 30+ 'unittest-cont1' => "$tmpDir/localtesting/unittest-cont1",
 31+ 'unittest-cont2' => "$tmpDir/localtesting/unittest-cont2" )
 32+ ) );
 33+ }
2134 $this->multiBackend = new FileBackendMultiWrite( array(
2235 'name' => 'localtesting',
2336 'lockManager' => 'fsLockManager',
@@ -26,8 +39,8 @@
2740 'class' => 'FSFileBackend',
2841 'lockManager' => 'nullLockManager',
2942 'containerPaths' => array(
30 - 'cont1' => "$tmpDir/localtestingmulti1/cont1",
31 - 'cont2' => "$tmpDir/localtestingmulti1/cont2" ),
 43+ 'unittest-cont1' => "$tmpDir/localtestingmulti1/cont1",
 44+ 'unittest-cont2' => "$tmpDir/localtestingmulti1/unittest-cont2" ),
3245 'isMultiMaster' => false
3346 ),
3447 array(
@@ -35,13 +48,13 @@
3649 'class' => 'FSFileBackend',
3750 'lockManager' => 'nullLockManager',
3851 'containerPaths' => array(
39 - 'cont1' => "$tmpDir/localtestingmulti2/cont1",
40 - 'cont2' => "$tmpDir/localtestingmulti2/cont2" ),
 52+ 'unittest-cont1' => "$tmpDir/localtestingmulti2/cont1",
 53+ 'unittest-cont2' => "$tmpDir/localtestingmulti2/unittest-cont2" ),
4154 'isMultiMaster' => true
4255 )
4356 )
4457 ) );
45 - $this->filesToPrune = $this->pathsToPrune = array();
 58+ $this->filesToPrune = array();
4659 }
4760
4861 private function baseStorePath() {
@@ -57,13 +70,14 @@
5871 */
5972 public function testStore( $op, $source, $dest ) {
6073 $this->filesToPrune[] = $source;
61 - $this->pathsToPrune[] = $dest;
6274
6375 $this->backend = $this->singleBackend;
 76+ $this->tearDownFiles();
6477 $this->doTestStore( $op, $source, $dest );
6578 $this->tearDownFiles();
6679
6780 $this->backend = $this->multiBackend;
 81+ $this->tearDownFiles();
6882 $this->doTestStore( $op, $source, $dest );
6983 $this->tearDownFiles();
7084 }
@@ -101,7 +115,7 @@
102116 $cases = array();
103117
104118 $tmpName = TempFSFile::factory( "unittests_", 'txt' )->getPath();
105 - $toPath = $this->baseStorePath() . '/cont1/fun/obj1.txt';
 119+ $toPath = $this->baseStorePath() . '/unittest-cont1/fun/obj1.txt';
106120 $op = array( 'op' => 'store', 'src' => $tmpName, 'dst' => $toPath );
107121 $cases[] = array(
108122 $op, // operation
@@ -116,6 +130,8 @@
117131 $toPath, // dest
118132 );
119133
 134+ // @TODO: test overwriteSame
 135+
120136 return $cases;
121137 }
122138
@@ -123,14 +139,13 @@
124140 * @dataProvider provider_testCopy
125141 */
126142 public function testCopy( $op, $source, $dest ) {
127 - $this->pathsToPrune[] = $source;
128 - $this->pathsToPrune[] = $dest;
129 -
130143 $this->backend = $this->singleBackend;
 144+ $this->tearDownFiles();
131145 $this->doTestCopy( $op, $source, $dest );
132146 $this->tearDownFiles();
133147
134148 $this->backend = $this->multiBackend;
 149+ $this->tearDownFiles();
135150 $this->doTestCopy( $op, $source, $dest );
136151 $this->tearDownFiles();
137152 }
@@ -172,8 +187,8 @@
173188 public function provider_testCopy() {
174189 $cases = array();
175190
176 - $source = $this->baseStorePath() . '/cont1/file.txt';
177 - $dest = $this->baseStorePath() . '/cont2/fileMoved.txt';
 191+ $source = $this->baseStorePath() . '/unittest-cont1/file.txt';
 192+ $dest = $this->baseStorePath() . '/unittest-cont2/fileMoved.txt';
178193
179194 $op = array( 'op' => 'copy', 'src' => $source, 'dst' => $dest );
180195 $cases[] = array(
@@ -196,19 +211,18 @@
197212 * @dataProvider provider_testMove
198213 */
199214 public function testMove( $op, $source, $dest ) {
200 - $this->pathsToPrune[] = $source;
201 - $this->pathsToPrune[] = $dest;
202 -
203215 $this->backend = $this->singleBackend;
 216+ $this->tearDownFiles();
204217 $this->doTestMove( $op, $source, $dest );
205218 $this->tearDownFiles();
206219
207220 $this->backend = $this->multiBackend;
 221+ $this->tearDownFiles();
208222 $this->doTestMove( $op, $source, $dest );
209223 $this->tearDownFiles();
210224 }
211225
212 - public function doTestMove( $op, $source, $dest ) {
 226+ private function doTestMove( $op, $source, $dest ) {
213227 $backendName = $this->backendClass();
214228
215229 $this->backend->prepare( array( 'dir' => dirname( $source ) ) );
@@ -247,8 +261,8 @@
248262 public function provider_testMove() {
249263 $cases = array();
250264
251 - $source = $this->baseStorePath() . '/cont1/file.txt';
252 - $dest = $this->baseStorePath() . '/cont2/fileMoved.txt';
 265+ $source = $this->baseStorePath() . '/unittest-cont1/file.txt';
 266+ $dest = $this->baseStorePath() . '/unittest-cont2/fileMoved.txt';
253267
254268 $op = array( 'op' => 'move', 'src' => $source, 'dst' => $dest );
255269 $cases[] = array(
@@ -271,18 +285,18 @@
272286 * @dataProvider provider_testDelete
273287 */
274288 public function testDelete( $op, $source, $withSource, $okStatus ) {
275 - $this->pathsToPrune[] = $source;
276 -
277289 $this->backend = $this->singleBackend;
 290+ $this->tearDownFiles();
278291 $this->doTestDelete( $op, $source, $withSource, $okStatus );
279292 $this->tearDownFiles();
280293
281294 $this->backend = $this->multiBackend;
 295+ $this->tearDownFiles();
282296 $this->doTestDelete( $op, $source, $withSource, $okStatus );
283297 $this->tearDownFiles();
284298 }
285299
286 - public function doTestDelete( $op, $source, $withSource, $okStatus ) {
 300+ private function doTestDelete( $op, $source, $withSource, $okStatus ) {
287301 $backendName = $this->backendClass();
288302
289303 $this->backend->prepare( array( 'dir' => dirname( $source ) ) );
@@ -322,7 +336,7 @@
323337 public function provider_testDelete() {
324338 $cases = array();
325339
326 - $source = $this->baseStorePath() . '/cont1/myfacefile.txt';
 340+ $source = $this->baseStorePath() . '/unittest-cont1/myfacefile.txt';
327341
328342 $op = array( 'op' => 'delete', 'src' => $source );
329343 $cases[] = array(
@@ -354,18 +368,18 @@
355369 * @dataProvider provider_testCreate
356370 */
357371 public function testCreate( $op, $dest, $alreadyExists, $okStatus, $newSize ) {
358 - $this->pathsToPrune[] = $dest;
359 -
360372 $this->backend = $this->singleBackend;
 373+ $this->tearDownFiles();
361374 $this->doTestCreate( $op, $dest, $alreadyExists, $okStatus, $newSize );
362375 $this->tearDownFiles();
363376
364377 $this->backend = $this->multiBackend;
 378+ $this->tearDownFiles();
365379 $this->doTestCreate( $op, $dest, $alreadyExists, $okStatus, $newSize );
366380 $this->tearDownFiles();
367381 }
368382
369 - public function doTestCreate( $op, $dest, $alreadyExists, $okStatus, $newSize ) {
 383+ private function doTestCreate( $op, $dest, $alreadyExists, $okStatus, $newSize ) {
370384 $backendName = $this->backendClass();
371385
372386 $this->backend->prepare( array( 'dir' => dirname( $dest ) ) );
@@ -418,7 +432,7 @@
419433 public function provider_testCreate() {
420434 $cases = array();
421435
422 - $source = $this->baseStorePath() . '/cont2/myspacefile.txt';
 436+ $source = $this->baseStorePath() . '/unittest-cont2/myspacefile.txt';
423437
424438 $dummyText = 'hey hey';
425439 $op = array( 'op' => 'create', 'content' => $dummyText, 'dst' => $source );
@@ -454,14 +468,15 @@
455469 * @dataProvider provider_testConcatenate
456470 */
457471 public function testConcatenate( $op, $srcs, $srcsContent, $alreadyExists, $okStatus ) {
458 - $this->pathsToPrune = array_merge( $this->pathsToPrune, $srcs );
459472 $this->filesToPrune[] = $op['dst'];
460473
461474 $this->backend = $this->singleBackend;
 475+ $this->tearDownFiles();
462476 $this->doTestConcatenate( $op, $srcs, $srcsContent, $alreadyExists, $okStatus );
463477 $this->tearDownFiles();
464478
465479 $this->backend = $this->multiBackend;
 480+ $this->tearDownFiles();
466481 $this->doTestConcatenate( $op, $srcs, $srcsContent, $alreadyExists, $okStatus );
467482 $this->tearDownFiles();
468483 }
@@ -535,16 +550,16 @@
536551 $rand = mt_rand( 0, 2000000000 ) . time();
537552 $dest = wfTempDir() . "/randomfile!$rand.txt";
538553 $srcs = array(
539 - $this->baseStorePath() . '/cont1/file1.txt',
540 - $this->baseStorePath() . '/cont1/file2.txt',
541 - $this->baseStorePath() . '/cont1/file3.txt',
542 - $this->baseStorePath() . '/cont1/file4.txt',
543 - $this->baseStorePath() . '/cont1/file5.txt',
544 - $this->baseStorePath() . '/cont1/file6.txt',
545 - $this->baseStorePath() . '/cont1/file7.txt',
546 - $this->baseStorePath() . '/cont1/file8.txt',
547 - $this->baseStorePath() . '/cont1/file9.txt',
548 - $this->baseStorePath() . '/cont1/file10.txt'
 554+ $this->baseStorePath() . '/unittest-cont1/file1.txt',
 555+ $this->baseStorePath() . '/unittest-cont1/file2.txt',
 556+ $this->baseStorePath() . '/unittest-cont1/file3.txt',
 557+ $this->baseStorePath() . '/unittest-cont1/file4.txt',
 558+ $this->baseStorePath() . '/unittest-cont1/file5.txt',
 559+ $this->baseStorePath() . '/unittest-cont1/file6.txt',
 560+ $this->baseStorePath() . '/unittest-cont1/file7.txt',
 561+ $this->baseStorePath() . '/unittest-cont1/file8.txt',
 562+ $this->baseStorePath() . '/unittest-cont1/file9.txt',
 563+ $this->baseStorePath() . '/unittest-cont1/file10.txt'
549564 );
550565 $content = array(
551566 'egfage',
@@ -583,13 +598,13 @@
584599 * @dataProvider provider_testGetFileContents
585600 */
586601 public function testGetFileContents( $src, $content ) {
587 - $this->pathsToPrune[] = $src;
588 -
589602 $this->backend = $this->singleBackend;
 603+ $this->tearDownFiles();
590604 $this->doTestGetFileContents( $src, $content );
591605 $this->tearDownFiles();
592606
593607 $this->backend = $this->multiBackend;
 608+ $this->tearDownFiles();
594609 $this->doTestGetFileContents( $src, $content );
595610 $this->tearDownFiles();
596611 }
@@ -604,8 +619,10 @@
605620
606621 $status = $this->backend->doOperation(
607622 array( 'op' => 'create', 'content' => $content, 'dst' => $source ) );
 623+ $this->assertEquals( array(), $status->errors,
 624+ "Creation of file at $source succeeded ($backendName)." );
608625 $this->assertEquals( true, $status->isOK(),
609 - "Creation of file at $source succeeded ($backendName)." );
 626+ "Creation of file at $source succeeded with OK status ($backendName)." );
610627
611628 $newContents = $this->backend->getFileContents( array( 'src' => $source ) );
612629 $this->assertNotEquals( false, $newContents,
@@ -619,8 +636,8 @@
620637 $cases = array();
621638
622639 $base = $this->baseStorePath();
623 - $cases[] = array( "$base/cont1/b/z/some_file.txt", "some file contents" );
624 - $cases[] = array( "$base/cont1/b/some-other_file.txt", "more file contents" );
 640+ $cases[] = array( "$base/unittest-cont1/b/z/some_file.txt", "some file contents" );
 641+ $cases[] = array( "$base/unittest-cont1/b/some-other_file.txt", "more file contents" );
625642
626643 return $cases;
627644 }
@@ -629,13 +646,13 @@
630647 * @dataProvider provider_testGetLocalCopy
631648 */
632649 public function testGetLocalCopy( $src, $content ) {
633 - $this->pathsToPrune[] = $src;
634 -
635650 $this->backend = $this->singleBackend;
 651+ $this->tearDownFiles();
636652 $this->doTestGetLocalCopy( $src, $content );
637653 $this->tearDownFiles();
638654
639655 $this->backend = $this->multiBackend;
 656+ $this->tearDownFiles();
640657 $this->doTestGetLocalCopy( $src, $content );
641658 $this->tearDownFiles();
642659 }
@@ -662,8 +679,8 @@
663680 $cases = array();
664681
665682 $base = $this->baseStorePath();
666 - $cases[] = array( "$base/cont1/a/z/some_file.txt", "some file contents" );
667 - $cases[] = array( "$base/cont1/a/some-other_file.txt", "more file contents" );
 683+ $cases[] = array( "$base/unittest-cont1/a/z/some_file.txt", "some file contents" );
 684+ $cases[] = array( "$base/unittest-cont1/a/some-other_file.txt", "more file contents" );
668685
669686 return $cases;
670687 }
@@ -672,18 +689,18 @@
673690 * @dataProvider provider_testGetLocalReference
674691 */
675692 public function testGetLocalReference( $src, $content ) {
676 - $this->pathsToPrune[] = $src;
677 -
678693 $this->backend = $this->singleBackend;
 694+ $this->tearDownFiles();
679695 $this->doTestGetLocalReference( $src, $content );
680696 $this->tearDownFiles();
681697
682698 $this->backend = $this->multiBackend;
 699+ $this->tearDownFiles();
683700 $this->doTestGetLocalReference( $src, $content );
684701 $this->tearDownFiles();
685702 }
686703
687 - public function doTestGetLocalReference( $source, $content ) {
 704+ private function doTestGetLocalReference( $source, $content ) {
688705 $backendName = $this->backendClass();
689706
690707 $this->backend->prepare( array( 'dir' => dirname( $source ) ) );
@@ -705,8 +722,8 @@
706723 $cases = array();
707724
708725 $base = $this->baseStorePath();
709 - $cases[] = array( "$base/cont1/a/z/some_file.txt", "some file contents" );
710 - $cases[] = array( "$base/cont1/a/some-other_file.txt", "more file contents" );
 726+ $cases[] = array( "$base/unittest-cont1/a/z/some_file.txt", "some file contents" );
 727+ $cases[] = array( "$base/unittest-cont1/a/some-other_file.txt", "more file contents" );
711728
712729 return $cases;
713730 }
@@ -725,9 +742,10 @@
726743 function provider_testPrepareAndClean() {
727744 $base = $this->baseStorePath();
728745 return array(
729 - array( "$base/cont1/a/z/some_file1.txt", true ),
730 - array( "$base/cont2/a/z/some_file2.txt", true ),
731 - array( "$base/cont3/a/z/some_file3.txt", false ),
 746+ array( "$base/unittest-cont1/a/z/some_file1.txt", true ),
 747+ array( "$base/unittest-cont2/a/z/some_file2.txt", true ),
 748+ # Specific to FS backend with no basePath field set
 749+ #array( "$base/unittest-cont3/a/z/some_file3.txt", false ),
732750 );
733751 }
734752
@@ -770,19 +788,14 @@
771789 function doTestDoOperations() {
772790 $base = $this->baseStorePath();
773791
774 - $fileA = "$base/cont1/a/b/fileA.txt";
 792+ $fileA = "$base/unittest-cont1/a/b/fileA.txt";
775793 $fileAContents = '3tqtmoeatmn4wg4qe-mg3qt3 tq';
776 - $fileB = "$base/cont1/a/b/fileB.txt";
 794+ $fileB = "$base/unittest-cont1/a/b/fileB.txt";
777795 $fileBContents = 'g-jmq3gpqgt3qtg q3GT ';
778 - $fileC = "$base/cont1/a/b/fileC.txt";
 796+ $fileC = "$base/unittest-cont1/a/b/fileC.txt";
779797 $fileCContents = 'eigna[ogmewt 3qt g3qg flew[ag';
780 - $fileD = "$base/cont1/a/b/fileD.txt";
 798+ $fileD = "$base/unittest-cont1/a/b/fileD.txt";
781799
782 - $this->pathsToPrune[] = $fileA;
783 - $this->pathsToPrune[] = $fileB;
784 - $this->pathsToPrune[] = $fileC;
785 - $this->pathsToPrune[] = $fileD;
786 -
787800 $this->backend->prepare( array( 'dir' => dirname( $fileA ) ) );
788801 $this->backend->create( array( 'dst' => $fileA, 'content' => $fileAContents ) );
789802 $this->backend->prepare( array( 'dir' => dirname( $fileB ) ) );
@@ -846,35 +859,36 @@
847860
848861 public function testGetFileList() {
849862 $this->backend = $this->singleBackend;
 863+ $this->tearDownFiles();
850864 $this->doTestGetFileList();
851865 $this->tearDownFiles();
852866
853867 $this->backend = $this->multiBackend;
 868+ $this->tearDownFiles();
854869 $this->doTestGetFileList();
855870 $this->tearDownFiles();
856871 }
857872
858 - public function doTestGetFileList() {
 873+ private function doTestGetFileList() {
859874 $backendName = $this->backendClass();
860875
861876 $base = $this->baseStorePath();
862877 $files = array(
863 - "$base/cont1/test1.txt",
864 - "$base/cont1/test2.txt",
865 - "$base/cont1/test3.txt",
866 - "$base/cont1/subdir1/test1.txt",
867 - "$base/cont1/subdir1/test2.txt",
868 - "$base/cont1/subdir2/test3.txt",
869 - "$base/cont1/subdir2/test4.txt",
870 - "$base/cont1/subdir2/subdir/test1.txt",
871 - "$base/cont1/subdir2/subdir/test2.txt",
872 - "$base/cont1/subdir2/subdir/test3.txt",
873 - "$base/cont1/subdir2/subdir/test4.txt",
874 - "$base/cont1/subdir2/subdir/test5.txt",
875 - "$base/cont1/subdir2/subdir/sub/test0.txt",
876 - "$base/cont1/subdir2/subdir/sub/120-px-file.txt",
 878+ "$base/unittest-cont1/test1.txt",
 879+ "$base/unittest-cont1/test2.txt",
 880+ "$base/unittest-cont1/test3.txt",
 881+ "$base/unittest-cont1/subdir1/test1.txt",
 882+ "$base/unittest-cont1/subdir1/test2.txt",
 883+ "$base/unittest-cont1/subdir2/test3.txt",
 884+ "$base/unittest-cont1/subdir2/test4.txt",
 885+ "$base/unittest-cont1/subdir2/subdir/test1.txt",
 886+ "$base/unittest-cont1/subdir2/subdir/test2.txt",
 887+ "$base/unittest-cont1/subdir2/subdir/test3.txt",
 888+ "$base/unittest-cont1/subdir2/subdir/test4.txt",
 889+ "$base/unittest-cont1/subdir2/subdir/test5.txt",
 890+ "$base/unittest-cont1/subdir2/subdir/sub/test0.txt",
 891+ "$base/unittest-cont1/subdir2/subdir/sub/120-px-file.txt",
877892 );
878 - $this->pathsToPrune = array_merge( $this->pathsToPrune, $files );
879893
880894 // Add the files
881895 $ops = array();
@@ -883,8 +897,10 @@
884898 $this->backend->prepare( array( 'dir' => dirname( $file ) ) );
885899 }
886900 $status = $this->backend->doOperations( $ops );
 901+ $this->assertEquals( array(), $status->errors,
 902+ "Creation of files succeeded ($backendName)." );
887903 $this->assertEquals( true, $status->isOK(),
888 - "Creation of files succeeded ($backendName)." );
 904+ "Creation of files succeeded with OK status ($backendName)." );
889905
890906 // Expected listing
891907 $expected = array(
@@ -907,7 +923,7 @@
908924
909925 // Actual listing (no trailing slash)
910926 $list = array();
911 - $iter = $this->backend->getFileList( array( 'dir' => "$base/cont1" ) );
 927+ $iter = $this->backend->getFileList( array( 'dir' => "$base/unittest-cont1" ) );
912928 foreach ( $iter as $file ) {
913929 $list[] = $file;
914930 }
@@ -917,7 +933,7 @@
918934
919935 // Actual listing (with trailing slash)
920936 $list = array();
921 - $iter = $this->backend->getFileList( array( 'dir' => "$base/cont1/" ) );
 937+ $iter = $this->backend->getFileList( array( 'dir' => "$base/unittest-cont1/" ) );
922938 foreach ( $iter as $file ) {
923939 $list[] = $file;
924940 }
@@ -925,11 +941,43 @@
926942
927943 $this->assertEquals( $expected, $list, "Correct file listing ($backendName)." );
928944
 945+ // Expected listing
 946+ $expected = array(
 947+ "test1.txt",
 948+ "test2.txt",
 949+ "test3.txt",
 950+ "test4.txt",
 951+ "test5.txt",
 952+ "sub/test0.txt",
 953+ "sub/120-px-file.txt",
 954+ );
 955+ sort( $expected );
 956+
 957+ // Actual listing (no trailing slash)
 958+ $list = array();
 959+ $iter = $this->backend->getFileList( array( 'dir' => "$base/unittest-cont1/subdir2/subdir" ) );
 960+ foreach ( $iter as $file ) {
 961+ $list[] = $file;
 962+ }
 963+ sort( $list );
 964+
 965+ $this->assertEquals( $expected, $list, "Correct file listing ($backendName)." );
 966+
 967+ // Actual listing (with trailing slash)
 968+ $list = array();
 969+ $iter = $this->backend->getFileList( array( 'dir' => "$base/unittest-cont1/subdir2/subdir/" ) );
 970+ foreach ( $iter as $file ) {
 971+ $list[] = $file;
 972+ }
 973+ sort( $list );
 974+
 975+ $this->assertEquals( $expected, $list, "Correct file listing ($backendName)." );
 976+
929977 foreach ( $files as $file ) {
930978 $this->backend->doOperation( array( 'op' => 'delete', 'src' => "$base/$file" ) );
931979 }
932980
933 - $iter = $this->backend->getFileList( array( 'dir' => "$base/cont1/not/exists" ) );
 981+ $iter = $this->backend->getFileList( array( 'dir' => "$base/unittest-cont1/not/exists" ) );
934982 foreach ( $iter as $iter ) {} // no errors
935983 }
936984
@@ -937,11 +985,22 @@
938986 foreach ( $this->filesToPrune as $file ) {
939987 @unlink( $file );
940988 }
941 - foreach ( $this->pathsToPrune as $file ) {
942 - $this->backend->doOperation( array( 'op' => 'delete', 'src' => $file ) );
943 - $tmp = $file;
944 - while ( $tmp = FileBackend::parentStoragePath( $tmp ) ) {
945 - $this->backend->clean( array( 'dir' => $tmp ) );
 989+ $containers = array( 'unittest-cont1', 'unittest-cont2', 'unittest-cont3' );
 990+ foreach ( $containers as $container ) {
 991+ $this->deleteFiles( $this->backend, $container );
 992+ }
 993+ }
 994+
 995+ private function deleteFiles( $backend, $container ) {
 996+ $base = $this->baseStorePath();
 997+ $iter = $backend->getFileList( array( 'dir' => "$base/$container" ) );
 998+ if ( $iter ) {
 999+ foreach ( $iter as $file ) {
 1000+ $backend->doOperation( array( 'op' => 'delete', 'src' => "$base/$container/$file" ) );
 1001+ $tmp = $file;
 1002+ while ( $tmp = FileBackend::parentStoragePath( $tmp ) ) {
 1003+ $backend->clean( array( 'dir' => $tmp ) );
 1004+ }
9461005 }
9471006 }
9481007 }

Status & tagging log