Dependency inject the repo/backend for proper testing rather than relying on the...
authorAaron Schulz <aaron@users.mediawiki.org>
Sat, 7 Jan 2012 06:13:01 +0000 (06:13 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Sat, 7 Jan 2012 06:13:01 +0000 (06:13 +0000)
tests/phpunit/includes/filerepo/StoreBatchTest.php

index 1686e0e..bc14f48 100644 (file)
@@ -6,8 +6,20 @@ class StoreBatchTest extends MediaWikiTestCase {
 
        public function setUp() {
                parent::setUp();
-               
-               $this->repo = RepoGroup::singleton()->getLocalRepo();
+               $tmpDir = wfTempDir() . '/' . time() . '-' . mt_rand();
+               $this->repo = new FSRepo( array(
+                       'name'    => 'test',
+                       'backend' => new FSFileBackend( array(
+                               'name'        => 'local-backend',
+                               'lockManager' => 'nullLockManager',
+                               'containerPaths' => array(
+                                       'test-public'  => "$tmpDir/public",
+                                       'test-thumb'   => "$tmpDir/thumb",
+                                       'test-temp'    => "$tmpDir/temp",
+                                       'test-deleted' => "$tmpDir/deleted",
+                               )
+                       ) )
+               ) );
                $this->date = gmdate( "YmdHis" );
                $this->createdFiles = array();
                $this->users = array(
@@ -43,8 +55,7 @@ class StoreBatchTest extends MediaWikiTestCase {
                $this->createdFiles[] = $result->value;
                return $result;
        }
-                                       
-       
+
        /**
         * Test storing a file using different flags.
         *
@@ -97,6 +108,5 @@ class StoreBatchTest extends MediaWikiTestCase {
        public function tearDown() {
                $this->repo->cleanupBatch( $this->createdFiles );
                parent::tearDown();
-               
        }
 }