protected function setUp()
 {
     parent::setUp();
     $this->clearExtraLifecycleHandlers();
     // We don't want local config getting in the way of testing whether or
     // not our permissions implementation works well.
     // This will load default $wgGroupPermissions + Flow settings, so we can
     // test if permissions work well, regardless of any custom config.
     global $IP, $wgFlowGroupPermissions;
     $wgGroupPermissions = array();
     require "{$IP}/includes/DefaultSettings.php";
     $wgGroupPermissions = array_merge_recursive($wgGroupPermissions, $wgFlowGroupPermissions);
     $this->setMwGlobals('wgGroupPermissions', $wgGroupPermissions);
     // When external store is used, data is written to "blobs" table, which
     // by default doesn't exist - let's just not use externalstorage in test
     $this->setMwGlobals('wgFlowExternalStore', false);
     // load actions object
     $this->actions = Container::get('flow_actions');
     // block a user
     $blockedUser = $this->blockedUser();
     $this->block = new Block(array('address' => $blockedUser->getName(), 'user' => $blockedUser->getID()));
     $this->block->insert();
     // ensure that block made it into the database
     wfGetDB(DB_MASTER)->commit(__METHOD__, 'flush');
 }
コード例 #2
0
 public function setUp()
 {
     parent::setUp();
     if (!class_exists('EchoEvent')) {
         $this->markTestSkipped();
         return;
     }
 }
コード例 #3
0
 protected function setUp()
 {
     parent::setUp();
     // create a dummy filter
     $this->setMwGlobals('wgSpamRegex', array('/http:\\/\\/spam/'));
     // create spam filter
     $this->spamFilter = new SpamRegex();
     if (!$this->spamFilter->enabled()) {
         $this->markTestSkipped('SpamRegex not enabled');
     }
 }
コード例 #4
0
 protected function setUp()
 {
     parent::setUp();
     // recent changes isn't fully setup here, just skip it
     $this->clearExtraLifecycleHandlers();
     // generate a post with multiple revisions
     $revision = $this->generateObject(array('rev_content' => 'first revision'));
     $this->store($revision);
     $revision = $this->generateObject(array('rev_content' => 'second revision', 'rev_change_type' => 'edit-post', 'rev_parent_id' => $revision->getRevisionId()->getBinary(), 'tree_rev_descendant_id' => $revision->getPostId()->getBinary(), 'rev_type_id' => $revision->getPostId()->getBinary()));
     $this->store($revision);
     $revision = $this->generateObject(array('rev_content' => 'third revision', 'rev_change_type' => 'edit-post', 'rev_parent_id' => $revision->getRevisionId()->getBinary(), 'tree_rev_descendant_id' => $revision->getPostId()->getBinary(), 'rev_type_id' => $revision->getPostId()->getBinary()));
     $this->store($revision);
 }
コード例 #5
0
 protected function setUp()
 {
     parent::setUp();
     // We don't want local config getting in the way of testing whether or
     // not our permissions implementation works well.
     // This will load default $wgGroupPermissions + Flow settings, so we can
     // test if permissions work well, regardless of any custom config.
     global $IP, $wgFlowGroupPermissions;
     $wgGroupPermissions = array();
     require "{$IP}/includes/DefaultSettings.php";
     $wgGroupPermissions = array_merge_recursive($wgGroupPermissions, $wgFlowGroupPermissions);
     $this->setMwGlobals('wgGroupPermissions', $wgGroupPermissions);
     // load actions object
     $this->actions = Container::get('flow_actions');
 }
コード例 #6
0
 protected function setUp()
 {
     parent::setUp();
     global $wgFlowAbuseFilterGroup, $wgFlowAbuseFilterEmergencyDisableThreshold, $wgFlowAbuseFilterEmergencyDisableCount, $wgFlowAbuseFilterEmergencyDisableAge;
     // Needed because abuse filter tries to read the title out and then
     // set it back.  If we never provide one it tries to set a null title
     // and bails.
     \RequestContext::getMain()->setTitle(Title::newMainPage());
     $user = User::newFromName('UTSysop');
     $this->spamFilter = new AbuseFilter($user, $wgFlowAbuseFilterGroup);
     if (!$this->spamFilter->enabled()) {
         $this->markTestSkipped('AbuseFilter not enabled');
     }
     $this->spamFilter->setup(array('threshold' => $wgFlowAbuseFilterEmergencyDisableThreshold, 'count' => $wgFlowAbuseFilterEmergencyDisableCount, 'age' => $wgFlowAbuseFilterEmergencyDisableAge));
     foreach ($this->filters as $pattern => $action) {
         $this->createFilter($pattern, $action);
     }
 }
コード例 #7
0
 protected function setUp()
 {
     parent::setUp();
     // create spam filter
     $this->spamFilter = new SpamBlacklist();
     if (!$this->spamFilter->enabled()) {
         $this->markTestSkipped('SpamBlacklist not enabled');
     }
     $this->setMwGlobals('wgBlacklistSettings', array('files' => array()));
     \MessageCache::singleton()->enable();
     $this->insertPage('MediaWiki:Spam-blacklist', implode("\n", $this->blacklist));
     $this->insertPage('MediaWiki:Spam-whitelist', implode("\n", $this->whitelist));
     // That only works if the spam blacklist is really reset
     $instance = BaseBlacklist::getInstance('spam');
     $reflProp = new \ReflectionProperty($instance, 'regexes');
     $reflProp->setAccessible(true);
     $reflProp->setValue($instance, false);
 }
コード例 #8
0
 public function setUp()
 {
     parent::setUp();
     // create a workflow & revision associated with it
     $this->revision = $this->generateObject();
     $this->workflow = $this->workflows[$this->revision->getCollectionId()->getAlphadecimal()];
     $this->storage = Container::get('storage');
     $this->extractor = Container::get('reference.extractor');
     $this->recorder = Container::get('reference.recorder');
     $this->updater = Container::get('reference.updater.links-tables');
     // Check for Parsoid
     try {
         Utils::convert('html', 'wikitext', 'Foo', $this->workflow->getOwnerTitle());
     } catch (WikitextException $excep) {
         $this->markTestSkipped('Parsoid not enabled');
     }
     // These tests don't provide sufficient data to properly run all listeners
     $this->clearExtraLifecycleHandlers();
 }