Index: trunk/phase3/tests/phpunit/includes/filerepo/FileBackendTest.php |
— | — | @@ -695,7 +695,7 @@ |
696 | 696 | $this->assertEquals( true, $status->isOK(), |
697 | 697 | "Creation of file at $source succeeded with OK status ($backendName)." ); |
698 | 698 | |
699 | | - $newContents = $this->backend->getFileContents( array( 'src' => $source ) ); |
| 699 | + $newContents = $this->backend->getFileContents( array( 'src' => $source, 'latest' => 1 ) ); |
700 | 700 | $this->assertNotEquals( false, $newContents, |
701 | 701 | "Read of file at $source succeeded ($backendName)." ); |
702 | 702 | |
— | — | @@ -972,8 +972,8 @@ |
973 | 973 | // Add the files |
974 | 974 | $ops = array(); |
975 | 975 | foreach ( $files as $file ) { |
976 | | - $ops[] = array( 'op' => 'create', 'content' => 'xxy', 'dst' => $file ); |
977 | 976 | $this->prepare( array( 'dir' => dirname( $file ) ) ); |
| 977 | + $ops[] = array( 'op' => 'create', 'content' => 'xxy', 'dst' => $file ); |
978 | 978 | } |
979 | 979 | $status = $this->backend->doOperations( $ops ); |
980 | 980 | $this->assertEquals( array(), $status->errors, |
— | — | @@ -1055,9 +1055,6 @@ |
1056 | 1056 | foreach ( $files as $file ) { // clean up |
1057 | 1057 | $this->backend->doOperation( array( 'op' => 'delete', 'src' => $file ) ); |
1058 | 1058 | } |
1059 | | - foreach ( $files as $file ) { // clean up |
1060 | | - $this->recursiveClean( FileBackend::parentStoragePath( $file ) ); |
1061 | | - } |
1062 | 1059 | |
1063 | 1060 | $iter = $this->backend->getFileList( array( 'dir' => "$base/unittest-cont1/not/exists" ) ); |
1064 | 1061 | foreach ( $iter as $iter ) {} // no errors |
Index: trunk/phase3/tests/phpunit/includes/parser/NewParserTest.php |
— | — | @@ -8,11 +8,11 @@ |
9 | 9 | * @group Stub |
10 | 10 | */ |
11 | 11 | class NewParserTest extends MediaWikiTestCase { |
12 | | - |
13 | 12 | static protected $articles = array(); // Array of test articles defined by the tests |
14 | 13 | /* The dataProvider is run on a different instance than the test, so it must be static |
15 | 14 | * When running tests from several files, all tests will see all articles. |
16 | 15 | */ |
| 16 | + static protected $backendToUse; |
17 | 17 | |
18 | 18 | public $keepUploads = false; |
19 | 19 | public $runDisabled = false; |
— | — | @@ -234,6 +234,7 @@ |
235 | 235 | * Ideally this should replace the global configuration entirely. |
236 | 236 | */ |
237 | 237 | protected function setupGlobals( $opts = '', $config = '' ) { |
| 238 | + global $wgFileBackends; |
238 | 239 | # Find out values for some special options. |
239 | 240 | $lang = |
240 | 241 | self::getOptionValue( 'language', $opts, 'en' ); |
— | — | @@ -245,14 +246,32 @@ |
246 | 247 | self::getOptionValue( 'wgLinkHolderBatchSize', $opts, 1000 ); |
247 | 248 | |
248 | 249 | $uploadDir = $this->getUploadDir(); |
249 | | - $backend = new FSFileBackend( array( |
250 | | - 'name' => 'local-backend', |
251 | | - 'lockManager' => 'nullLockManager', |
252 | | - 'containerPaths' => array( |
253 | | - 'local-public' => "$uploadDir", |
254 | | - 'local-thumb' => "$uploadDir/thumb", |
255 | | - ) |
256 | | - ) ); |
| 250 | + if ( $this->getCliArg( 'use-filebackend=' ) ) { |
| 251 | + if ( self::$backendToUse ) { |
| 252 | + $backend = self::$backendToUse; |
| 253 | + } else { |
| 254 | + $name = $this->getCliArg( 'use-filebackend=' ); |
| 255 | + $useConfig = array(); |
| 256 | + foreach ( $wgFileBackends as $conf ) { |
| 257 | + if ( $conf['name'] == $name ) { |
| 258 | + $useConfig = $conf; |
| 259 | + } |
| 260 | + } |
| 261 | + $useConfig['name'] = 'local-backend'; // swap name |
| 262 | + $class = $conf['class']; |
| 263 | + self::$backendToUse = new $class( $useConfig ); |
| 264 | + $backend = self::$backendToUse; |
| 265 | + } |
| 266 | + } else { |
| 267 | + $backend = new FSFileBackend( array( |
| 268 | + 'name' => 'local-backend', |
| 269 | + 'lockManager' => 'nullLockManager', |
| 270 | + 'containerPaths' => array( |
| 271 | + 'local-public' => "$uploadDir", |
| 272 | + 'local-thumb' => "$uploadDir/thumb", |
| 273 | + ) |
| 274 | + ) ); |
| 275 | + } |
257 | 276 | |
258 | 277 | $settings = array( |
259 | 278 | 'wgServer' => 'http://Britney-Spears', |