From: Aaron Schulz Date: Sat, 7 Jan 2012 06:13:01 +0000 (+0000) Subject: Dependency inject the repo/backend for proper testing rather than relying on the... X-Git-Tag: 1.31.0-rc.0~25455 X-Git-Url: https://git.heureux-cyclage.org/?a=commitdiff_plain;h=d010652a6dca8ffbc30da3da221e5c20ce7c1fdd;p=lhc%2Fweb%2Fwiklou.git Dependency inject the repo/backend for proper testing rather than relying on the wiki config --- diff --git a/tests/phpunit/includes/filerepo/StoreBatchTest.php b/tests/phpunit/includes/filerepo/StoreBatchTest.php index 1686e0e455..bc14f48762 100644 --- a/tests/phpunit/includes/filerepo/StoreBatchTest.php +++ b/tests/phpunit/includes/filerepo/StoreBatchTest.php @@ -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(); - } }