Merge "Maintenance script for exporting site definitions"
[lhc/web/wiklou.git] / tests / phpunit / includes / filerepo / StoreBatchTest.php
index 3276cf9..86bfe12 100644 (file)
@@ -16,9 +16,9 @@ class StoreBatchTest extends MediaWikiTestCase {
                parent::setUp();
 
                # Forge a FSRepo object to not have to rely on local wiki settings
-               $tmpPrefix = wfTempDir() . '/storebatch-test-' . time() . '-' . mt_rand();
-               if ( $this->getCliArg( 'use-filebackend=' ) ) {
-                       $name = $this->getCliArg( 'use-filebackend=' );
+               $tmpPrefix = $this->getNewTempDirectory();
+               if ( $this->getCliArg( 'use-filebackend' ) ) {
+                       $name = $this->getCliArg( 'use-filebackend' );
                        $useConfig = array();
                        foreach ( $wgFileBackends as $conf ) {
                                if ( $conf['name'] == $name ) {
@@ -35,10 +35,10 @@ class StoreBatchTest extends MediaWikiTestCase {
                                'name' => 'local-testing',
                                'wikiId' => wfWikiID(),
                                'containerPaths' => array(
-                                       'unittests-public' => "{$tmpPrefix}-public",
-                                       'unittests-thumb' => "{$tmpPrefix}-thumb",
-                                       'unittests-temp' => "{$tmpPrefix}-temp",
-                                       'unittests-deleted' => "{$tmpPrefix}-deleted",
+                                       'unittests-public' => "{$tmpPrefix}/public",
+                                       'unittests-thumb' => "{$tmpPrefix}/thumb",
+                                       'unittests-temp' => "{$tmpPrefix}/temp",
+                                       'unittests-deleted' => "{$tmpPrefix}/deleted",
                                )
                        ) );
                }
@@ -52,13 +52,8 @@ class StoreBatchTest extends MediaWikiTestCase {
        }
 
        protected function tearDown() {
-               $this->repo->cleanupBatch( $this->createdFiles ); // delete files
-               foreach ( $this->createdFiles as $tmp ) { // delete dirs
-                       $tmp = $this->repo->resolveVirtualUrl( $tmp );
-                       while ( $tmp = FileBackend::parentStoragePath( $tmp ) ) {
-                               $this->repo->getBackend()->clean( array( 'dir' => $tmp ) );
-                       }
-               }
+               // Delete files
+               $this->repo->cleanupBatch( $this->createdFiles );
                parent::tearDown();
        }
 
@@ -132,14 +127,14 @@ class StoreBatchTest extends MediaWikiTestCase {
                global $IP;
                $this->storecohort(
                        "Test1.png",
-                       "$IP/skins/monobook/wiki.png",
-                       "$IP/skins/monobook/video.png",
+                       "$IP/tests/phpunit/data/filerepo/wiki.png",
+                       "$IP/tests/phpunit/data/filerepo/video.png",
                        false
                );
                $this->storecohort(
                        "Test2.png",
-                       "$IP/skins/monobook/wiki.png",
-                       "$IP/skins/monobook/video.png",
+                       "$IP/tests/phpunit/data/filerepo/wiki.png",
+                       "$IP/tests/phpunit/data/filerepo/video.png",
                        true
                );
        }