protected function setUp() {
global $wgParser, $wgParserConf, $IP, $messageMemc, $wgMemc, $wgUser,
$wgLang, $wgOut, $wgRequest, $wgStyleDirectory,
- $wgEnableParserCache, $wgNamespaceAliases, $wgNamespaceProtection,
+ $wgParserCacheType, $wgNamespaceAliases, $wgNamespaceProtection,
$parserMemc;
+ $tmpDir = $this->getNewTempDirectory();
$tmpGlobals = array();
$tmpGlobals['wgScript'] = '/index.php';
'name' => 'local-backend',
'wikiId' => wfWikiId(),
'containerPaths' => array(
- 'local-public' => wfTempDir() . '/test-repo/public',
- 'local-thumb' => wfTempDir() . '/test-repo/thumb',
- 'local-temp' => wfTempDir() . '/test-repo/temp',
- 'local-deleted' => wfTempDir() . '/test-repo/delete',
+ 'local-public' => "{$tmpDir}/test-repo/public",
+ 'local-thumb' => "{$tmpDir}/test-repo/thumb",
+ 'local-temp' => "{$tmpDir}/test-repo/temp",
+ 'local-deleted' => "{$tmpDir}/test-repo/delete",
)
) ),
);
$wgNamespaceAliases['Image'] = NS_FILE;
$wgNamespaceAliases['Image_talk'] = NS_FILE_TALK;
- $wgEnableParserCache = false;
+ $wgParserCacheType = CACHE_NONE;
DeferredUpdates::clearPendingUpdates();
$wgMemc = wfGetMainCache();
$messageMemc = wfGetMessageCacheStorage();
RepoGroup::destroySingleton();
FileBackendGroup::destroySingleton();
- $this->teardownUploadDir( $this->uploadDir );
-
parent::tearDown();
}
- private $uploadDir;
- private $keepUploads;
-
- /**
- * Remove the dummy uploads directory
- * @param string $dir
- */
- private function teardownUploadDir( $dir ) {
- if ( $this->keepUploads ) {
- return;
- }
-
- // delete the files first, then the dirs.
- self::deleteFiles(
- array(
- "$dir/3/3a/Foobar.jpg",
- "$dir/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg",
- "$dir/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg",
- "$dir/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg",
- "$dir/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg",
-
- "$dir/0/09/Bad.jpg",
- )
- );
-
- self::deleteDirs(
- array(
- "$dir/3/3a",
- "$dir/3",
- "$dir/thumb/6/65",
- "$dir/thumb/6",
- "$dir/thumb/3/3a/Foobar.jpg",
- "$dir/thumb/3/3a",
- "$dir/thumb/3",
-
- "$dir/0/09/",
- "$dir/0/",
-
- "$dir/thumb",
- "$dir",
- )
- );
- }
-
/**
* Delete the specified files, if they exist.
*
private function setupUploadDir() {
global $IP;
- if ( $this->keepUploads ) {
- $dir = wfTempDir() . '/mwParser-images';
-
- if ( is_dir( $dir ) ) {
- return $dir;
- }
- } else {
- $dir = wfTempDir() . "/mwParser-" . mt_rand() . "-images";
- }
+ $dir = $this->getNewTempDirectory();
wfDebug( "Creating upload directory $dir\n" );
- if ( file_exists( $dir ) ) {
- wfDebug( "Already exists!\n" );
-
- return $dir;
- }
-
wfMkdirParents( $dir . '/3/3a', null, __METHOD__ );
copy( "$IP/tests/phpunit/data/upload/headbg.jpg", "$dir/3/3a/Foobar.jpg" );