protected function setUp()
 {
     global $wgFileBackends;
     parent::setUp();
     # Forge a FSRepo object to not have to rely on local wiki settings
     $tmpPrefix = $this->getNewTempDirectory();
     if ($this->getCliArg('use-filebackend')) {
         $name = $this->getCliArg('use-filebackend');
         $useConfig = [];
         foreach ($wgFileBackends as $conf) {
             if ($conf['name'] == $name) {
                 $useConfig = $conf;
             }
         }
         $useConfig['lockManager'] = LockManagerGroup::singleton()->get($useConfig['lockManager']);
         unset($useConfig['fileJournal']);
         $useConfig['name'] = 'local-testing';
         // swap name
         $class = $useConfig['class'];
         $backend = new $class($useConfig);
     } else {
         $backend = new FSFileBackend(['name' => 'local-testing', 'wikiId' => wfWikiID(), 'containerPaths' => ['unittests-public' => "{$tmpPrefix}/public", 'unittests-thumb' => "{$tmpPrefix}/thumb", 'unittests-temp' => "{$tmpPrefix}/temp", 'unittests-deleted' => "{$tmpPrefix}/deleted"]]);
     }
     $this->repo = new FileRepo(['name' => 'unittests', 'backend' => $backend]);
     $this->date = gmdate("YmdHis");
     $this->createdFiles = [];
 }
 protected function setUp()
 {
     global $wgJobTypeConf;
     parent::setUp();
     if ($this->getCliArg('use-jobqueue')) {
         $name = $this->getCliArg('use-jobqueue');
         if (!isset($wgJobTypeConf[$name])) {
             throw new MWException("No \$wgJobTypeConf entry for '{$name}'.");
         }
         $baseConfig = $wgJobTypeConf[$name];
     } else {
         $baseConfig = ['class' => 'JobQueueDB'];
     }
     $baseConfig['type'] = 'null';
     $baseConfig['wiki'] = wfWikiID();
     $variants = ['queueRand' => ['order' => 'random', 'claimTTL' => 0], 'queueRandTTL' => ['order' => 'random', 'claimTTL' => 10], 'queueTimestamp' => ['order' => 'timestamp', 'claimTTL' => 0], 'queueTimestampTTL' => ['order' => 'timestamp', 'claimTTL' => 10], 'queueFifo' => ['order' => 'fifo', 'claimTTL' => 0], 'queueFifoTTL' => ['order' => 'fifo', 'claimTTL' => 10]];
     foreach ($variants as $q => $settings) {
         try {
             $this->{$q} = JobQueue::factory($settings + $baseConfig);
         } catch (MWException $e) {
             // unsupported?
             // @todo What if it was another error?
         }
     }
 }
 function setUp()
 {
     global $wgHooks;
     parent::setUp();
     Hooks::clear('MediaWikiHooksTest001');
     unset($wgHooks['MediaWikiHooksTest001']);
 }
 protected function setUp()
 {
     parent::setUp();
     $readOnlyFile = tempnam(wfTempDir(), "mwtest_readonly");
     unlink($readOnlyFile);
     $this->setMwGlobals(array('wgReadOnlyFile' => $readOnlyFile, 'wgUrlProtocols' => array('http://', 'https://', 'mailto:', '//', 'file://')));
 }
 protected function setUp()
 {
     global $wgFileBackends;
     parent::setUp();
     $tmpPrefix = wfTempDir() . '/filebackend-unittest-' . time() . '-' . mt_rand();
     if ($this->getCliArg('use-filebackend=')) {
         if (self::$backendToUse) {
             $this->singleBackend = self::$backendToUse;
         } else {
             $name = $this->getCliArg('use-filebackend=');
             $useConfig = array();
             foreach ($wgFileBackends as $conf) {
                 if ($conf['name'] == $name) {
                     $useConfig = $conf;
                     break;
                 }
             }
             $useConfig['name'] = 'localtesting';
             // swap name
             $useConfig['shardViaHashLevels'] = array('unittest-cont1' => array('levels' => 1, 'base' => 16, 'repeat' => 1));
             $class = $useConfig['class'];
             self::$backendToUse = new $class($useConfig);
             $this->singleBackend = self::$backendToUse;
         }
     } else {
         $this->singleBackend = new FSFileBackend(array('name' => 'localtesting', 'lockManager' => 'fsLockManager', 'containerPaths' => array('unittest-cont1' => "{$tmpPrefix}-localtesting-cont1", 'unittest-cont2' => "{$tmpPrefix}-localtesting-cont2")));
     }
     $this->multiBackend = new FileBackendMultiWrite(array('name' => 'localtesting', 'lockManager' => 'fsLockManager', 'parallelize' => 'implicit', 'backends' => array(array('name' => 'localmultitesting1', 'class' => 'FSFileBackend', 'lockManager' => 'nullLockManager', 'containerPaths' => array('unittest-cont1' => "{$tmpPrefix}-localtestingmulti1-cont1", 'unittest-cont2' => "{$tmpPrefix}-localtestingmulti1-cont2"), 'isMultiMaster' => false), array('name' => 'localmultitesting2', 'class' => 'FSFileBackend', 'lockManager' => 'nullLockManager', 'containerPaths' => array('unittest-cont1' => "{$tmpPrefix}-localtestingmulti2-cont1", 'unittest-cont2' => "{$tmpPrefix}-localtestingmulti2-cont2"), 'isMultiMaster' => true))));
     $this->filesToPrune = array();
 }
Exemple #6
0
 protected function setUp()
 {
     global $wgFileBackends;
     parent::setUp();
     $uniqueId = time() . '-' . mt_rand();
     $tmpDir = $this->getNewTempDirectory();
     if ($this->getCliArg('use-filebackend')) {
         if (self::$backendToUse) {
             $this->singleBackend = self::$backendToUse;
         } else {
             $name = $this->getCliArg('use-filebackend');
             $useConfig = array();
             foreach ($wgFileBackends as $conf) {
                 if ($conf['name'] == $name) {
                     $useConfig = $conf;
                     break;
                 }
             }
             $useConfig['name'] = 'localtesting';
             // swap name
             $useConfig['shardViaHashLevels'] = array('unittest-cont1' => array('levels' => 1, 'base' => 16, 'repeat' => 1));
             if (isset($useConfig['fileJournal'])) {
                 $useConfig['fileJournal'] = FileJournal::factory($useConfig['fileJournal'], $name);
             }
             $useConfig['lockManager'] = LockManagerGroup::singleton()->get($useConfig['lockManager']);
             $class = $useConfig['class'];
             self::$backendToUse = new $class($useConfig);
             $this->singleBackend = self::$backendToUse;
         }
     } else {
         $this->singleBackend = new FSFileBackend(array('name' => 'localtesting', 'lockManager' => LockManagerGroup::singleton()->get('fsLockManager'), 'wikiId' => wfWikiID(), 'containerPaths' => array('unittest-cont1' => "{$tmpDir}/localtesting-cont1", 'unittest-cont2' => "{$tmpDir}/localtesting-cont2")));
     }
     $this->multiBackend = new FileBackendMultiWrite(array('name' => 'localtesting', 'lockManager' => LockManagerGroup::singleton()->get('fsLockManager'), 'parallelize' => 'implicit', 'wikiId' => wfWikiId() . $uniqueId, 'backends' => array(array('name' => 'localmultitesting1', 'class' => 'FSFileBackend', 'containerPaths' => array('unittest-cont1' => "{$tmpDir}/localtestingmulti1-cont1", 'unittest-cont2' => "{$tmpDir}/localtestingmulti1-cont2"), 'isMultiMaster' => false), array('name' => 'localmultitesting2', 'class' => 'FSFileBackend', 'containerPaths' => array('unittest-cont1' => "{$tmpDir}/localtestingmulti2-cont1", 'unittest-cont2' => "{$tmpDir}/localtestingmulti2-cont2"), 'isMultiMaster' => true))));
 }
 protected function setUp()
 {
     global $wgFileBackends;
     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=');
         $useConfig = array();
         foreach ($wgFileBackends as $conf) {
             if ($conf['name'] == $name) {
                 $useConfig = $conf;
             }
         }
         $useConfig['name'] = 'local-testing';
         // swap name
         $class = $useConfig['class'];
         $backend = new $class($useConfig);
     } else {
         $backend = new FSFileBackend(array('name' => 'local-testing', 'lockManager' => 'nullLockManager', 'containerPaths' => array('unittests-public' => "{$tmpPrefix}-public", 'unittests-thumb' => "{$tmpPrefix}-thumb", 'unittests-temp' => "{$tmpPrefix}-temp", 'unittests-deleted' => "{$tmpPrefix}-deleted")));
     }
     $this->repo = new FileRepo(array('name' => 'unittests', 'backend' => $backend));
     $this->date = gmdate("YmdHis");
     $this->createdFiles = array();
 }
 function setUp()
 {
     parent::setUp();
     require_once __DIR__ . '/../data/helpers/WellProtectedClass.php';
     $this->raw = new WellProtectedClass();
     $this->wrapped = TestingAccessWrapper::newFromObject($this->raw);
 }
 protected function setUp()
 {
     if ($this->willSkipTests()) {
         $this->markTestSkipped('GeoData extension is required.');
     }
     parent::setUp();
 }
Exemple #10
0
 protected function setUp()
 {
     global $wgJobTypeConf;
     parent::setUp();
     $this->setMwGlobals('wgMemc', new HashBagOStuff());
     if ($this->getCliArg('use-jobqueue')) {
         $name = $this->getCliArg('use-jobqueue');
         if (!isset($wgJobTypeConf[$name])) {
             throw new MWException("No \$wgJobTypeConf entry for '{$name}'.");
         }
         $baseConfig = $wgJobTypeConf[$name];
     } else {
         $baseConfig = array('class' => 'JobQueueDB');
     }
     $baseConfig['type'] = 'null';
     $baseConfig['wiki'] = wfWikiID();
     $variants = array('queueRand' => array('order' => 'random', 'claimTTL' => 0), 'queueRandTTL' => array('order' => 'random', 'claimTTL' => 10), 'queueTimestamp' => array('order' => 'timestamp', 'claimTTL' => 0), 'queueTimestampTTL' => array('order' => 'timestamp', 'claimTTL' => 10), 'queueFifo' => array('order' => 'fifo', 'claimTTL' => 0), 'queueFifoTTL' => array('order' => 'fifo', 'claimTTL' => 10));
     foreach ($variants as $q => $settings) {
         try {
             $this->{$q} = JobQueue::factory($settings + $baseConfig);
             if (!$this->{$q} instanceof JobQueueDB) {
                 $this->{$q}->setTestingPrefix('unittests-' . wfRandomString(32));
             }
         } catch (MWException $e) {
             // unsupported?
             // @todo What if it was another error?
         }
     }
 }
 protected function setUp()
 {
     parent::setUp();
     $this->cache1 = new HashBagOStuff();
     $this->cache2 = new HashBagOStuff();
     $this->cache = new MultiWriteBagOStuff(array('caches' => array($this->cache1, $this->cache2), 'replication' => 'async'));
 }
 function setUp()
 {
     parent::setUp();
     $parser = new Parser();
     $options = new ParserOptions();
     $options->setTemplateCallback(array($this, 'templateCallback'));
     $parser->startExternalParse(Title::newMainPage(), $options, Parser::OT_HTML, true);
     try {
         $engine = new Scribunto_LuaSandboxEngine(array('parser' => $parser) + $this->sandboxOpts);
         $engine->setTitle($parser->getTitle());
         $engine->getInterpreter();
         $this->engines['LuaSandbox'] = $engine;
     } catch (Scribunto_LuaInterpreterNotFoundError $e) {
         $this->markTestSkipped("LuaSandbox interpreter not available");
         return;
     }
     try {
         $engine = new Scribunto_LuaStandaloneEngine(array('parser' => $parser) + $this->standaloneOpts);
         $engine->setTitle($parser->getTitle());
         $engine->getInterpreter();
         $this->engines['LuaStandalone'] = $engine;
     } catch (Scribunto_LuaInterpreterNotFoundError $e) {
         $this->markTestSkipped("LuaStandalone interpreter not available");
         return;
     }
 }
Exemple #13
0
 protected function setUp()
 {
     parent::setUp();
     $this->setMwGlobals(['wgAllowUserJs' => false, 'wgDefaultLanguageVariant' => false, 'wgMetaNamespace' => 'Project']);
     $this->setUserLang('en');
     $this->setContentLang('en');
 }
 protected function setUp()
 {
     parent::setUp();
     $this->writeCache = new HashBagOStuff();
     $this->readCache = new HashBagOStuff();
     $this->cache = new ReplicatedBagOStuff(array('writeFactory' => $this->writeCache, 'readFactory' => $this->readCache));
 }
Exemple #15
0
 protected function setUp()
 {
     parent::setUp();
     $this->setMwGlobals('wgShowEXIF', true);
     $this->filePath = __DIR__ . '/../../data/media/';
     $this->handler = new TiffHandler();
 }
Exemple #16
0
 protected function setUp()
 {
     parent::setUp();
     $this->checkPHPExtension('exif');
     $this->mediaPath = __DIR__ . '/../../data/media/';
     $this->setMwGlobals('wgShowEXIF', true);
 }
 protected function setUp()
 {
     parent::setUp();
     $group = MessageGroupBase::factory($this->groupConfiguration);
     /** @var YamlFFS $ffs */
     $this->ffs = $group->getFFS();
 }
Exemple #18
0
 protected function setUp()
 {
     parent::setUp();
     if (!wfDl('xml')) {
         $this->markTestSkipped('Requires libxml to do XMP parsing');
     }
 }
Exemple #19
0
 protected function setUp()
 {
     parent::setUp();
     $dbw = wfGetDB(DB_MASTER);
     $dbw->replace('interwiki', array('iw_prefix'), array('iw_prefix' => 'linksupdatetest', 'iw_url' => 'http://testing.com/wiki/$1', 'iw_api' => 'http://testing.com/w/api.php', 'iw_local' => 0, 'iw_trans' => 0, 'iw_wikiid' => 'linksupdatetest'));
     $this->setMwGlobals('wgRCWatchCategoryMembership', true);
 }
 public function setUp()
 {
     parent::setUp();
     global $IP;
     $this->json = "{$IP}/tests/phpunit/data/composer/composer.json";
     $this->json2 = "{$IP}/tests/phpunit/data/composer/new-composer.json";
 }
 protected function setUp()
 {
     parent::setUp();
     $this->database_test_instance_creator = new DatabaseTestInserter();
     $this->database_test_instance_creator->createManuscriptsTest();
     $this->t = new ConcreteManuscriptDeskBaseWrapper('testuser');
 }
 protected function setUp()
 {
     parent::setUp();
     if (!defined('SELENIUMTEST')) {
         define('SELENIUMTEST', true);
     }
 }
 protected function setUp()
 {
     parent::setUp();
     $readOnlyFile = $this->getNewTempFile();
     unlink($readOnlyFile);
     $this->setMwGlobals(array('wgReadOnlyFile' => $readOnlyFile, 'wgUrlProtocols' => array('http://', 'https://', 'mailto:', '//', 'file://')));
 }
 protected function setUp()
 {
     parent::setUp();
     if (!MWTidy::isEnabled()) {
         $this->markTestSkipped('Tidy not found');
     }
 }
Exemple #25
0
 protected function setUp()
 {
     parent::setUp();
     $langObj = Language::factory('en');
     $langObj->setNamespaces(array(-2 => 'Media', -1 => 'Special', 0 => '', 1 => 'Talk', 2 => 'User', 3 => 'User_talk', 4 => 'MyWiki', 5 => 'MyWiki_Talk', 6 => 'File', 7 => 'File_talk', 8 => 'MediaWiki', 9 => 'MediaWiki_talk', 10 => 'Template', 11 => 'Template_talk', 100 => 'Custom', 101 => 'Custom_talk'));
     $this->setMwGlobals(array('wgLang' => $langObj, 'wgWellFormedXml' => true));
 }
 protected function setUp()
 {
     parent::setUp();
     $this->cache1 = new HashBagOStuff();
     $this->cache2 = new HashBagOStuff();
     $this->cache = new MultiWriteBagOStuff(['caches' => [$this->cache1, $this->cache2], 'replication' => 'async', 'asyncHandler' => 'DeferredUpdates::addCallableUpdate']);
 }
 public function setup()
 {
     parent::setUp();
     $u = new User();
     $t = new Title();
     $this->c = new ReservationController($u, $t);
 }
 protected function setUp()
 {
     global $wgGroupPermissions;
     parent::setUp();
     $this->stashMwGlobals(['wgGroupPermissions']);
     $wgGroupPermissions['local-id-lookup-test']['hideuser'] = true;
 }
 protected function setUp()
 {
     parent::setUp();
     $router = new PathRouter();
     $router->add("/wiki/\$1");
     $this->basicRouter = $router;
 }
Exemple #30
0
 protected function setUp()
 {
     parent::setUp();
     if (!CdbReader::haveExtension()) {
         $this->markTestSkipped('Native CDB support is not available');
     }
 }