public function setUp()
 {
     $dir = dirname(__FILE__) . '/../../../';
     global $wgAutoloadClasses;
     $this->setupFile = $dir . 'HubRssFeed.setup.php';
     parent::setUp();
 }
Esempio n. 2
0
 public function setUp()
 {
     global $wgDevelEnvironment;
     $this->org_wgDevelEnvironment = $wgDevelEnvironment;
     $wgDevelEnvironment = true;
     parent::setUp();
 }
 public function setUp()
 {
     $this->setupFile = __DIR__ . '/../LyricFind.setup.php';
     parent::setUp();
     // mock title and prevent DB changes
     $this->mockGlobalVariable('wgTitle', $this->mockClassWithMethods('Title', ['getArticleID' => 123]));
 }
Esempio n. 4
0
 public function setUp()
 {
     parent::setUp();
     global $IP;
     include_once $IP . '/includes/wikia/ui/Factory.class.php';
     $this->instance = Wikia\UI\Factory::getInstance();
 }
Esempio n. 5
0
 public function setUp()
 {
     $this->setupFile = __DIR__ . "/../AbPerformanceTesting.setup.php";
     parent::setUp();
     $this->mockGlobalVariable('wgCityId', 5123);
     $this->mockGlobalFunction('wfGetBeaconId', '8gQHS-Q4_c');
 }
 protected function setUp()
 {
     $this->setupFile = dirname(__FILE__) . '/../PortableInfobox.setup.php';
     parent::setUp();
     $this->parser = $this->setUpParser();
     $this->controller = new PortableInfoboxParserTagController();
 }
 public function setUp()
 {
     parent::setUp();
     global $wgCommandLineSilentMode;
     $this->silentMode = $wgCommandLineSilentMode;
     $wgCommandLineSilentMode = true;
 }
Esempio n. 8
0
 protected function setUp()
 {
     require_once dirname(__FILE__) . '/../SpecialCssHooks.class.php';
     require_once dirname(__FILE__) . '/../SpecialCssModel.class.php';
     require_once dirname(__FILE__) . '/../SpecialCssController.class.php';
     parent::setUp();
 }
Esempio n. 9
0
 public function setUp()
 {
     global $IP;
     $this->setupFile = "{$IP}/extensions/wikia/JsonFormat/JsonFormat.setup.php";
     $this->mockGlobalVariable('wgTitle', Title::newFromText('TestPageDoesNotExist'));
     parent::setUp();
 }
Esempio n. 10
0
 public function setUp()
 {
     $this->setupFile = dirname(__FILE__) . '/../ShareButtons.setup.php';
     parent::setUp();
     $this->mockGlobalVariable('wgTitle', Title::newMainPage());
     $this->mockApp();
 }
Esempio n. 11
0
 public function setUp()
 {
     $this->setupFile = __DIR__ . '/../AutoFollow.setup.php';
     parent::setUp();
     $this->mockGlobalVariable('wgAutoFollowFlag', 'autowatched-already');
     $this->mockGlobalVariable('wgAutoFollowLangCityIdMap', ['de' => 1779, 'en' => 177, 'es' => 3487, 'fi' => 3083, 'fr' => 10261, 'it' => 11250, 'ja' => 3439, 'nl' => 10466, 'pl' => 1686, 'pt' => 696403, 'ru' => 3321, 'uk' => 3321, 'zh' => 4079]);
 }
 protected function setUp()
 {
     global $wgCityId;
     $this->wgCityId = $wgCityId;
     $this->setupFile = dirname(__FILE__) . '/../FounderProgressBar.setup.php';
     parent::setUp();
     // Mock response using $this->getValCallBack()
     $mockR = $this->getMock('WikiaResponse', array('getVal'), array('raw'));
     $mockR->expects($this->any())->method('getVal')->will($this->returnCallback(array($this, "getValCallback")));
     $mock_result = $this->getMock('ResultWrapper', array(), array(), '', false);
     $this->mock_db = $this->getMock('DatabaseMysql', array('select', 'query', 'update', 'commit', 'fetchObject', 'fetchRow'));
     $this->mock_db->expects($this->any())->method('select')->will($this->returnValue($mock_result));
     $this->mock_db->expects($this->any())->method('query');
     $this->mock_db->expects($this->any())->method('update');
     $this->mock_db->expects($this->any())->method('commit');
     $cache = $this->getMock('stdClass', array('get', 'set', 'delete'));
     $cache->expects($this->any())->method('get')->will($this->returnValue(null));
     $cache->expects($this->any())->method('set');
     $cache->expects($this->any())->method('delete');
     $mock = $this->getMock('FounderProgressBarController', array('sendSelfRequest', 'getDb', 'getMCache'));
     $mock->expects($this->any())->method('sendSelfRequest')->will($this->returnValue($mockR));
     $mock->expects($this->any())->method('getDb')->will($this->returnValue($this->mock_db));
     $mock->expects($this->any())->method('getMCache')->will($this->returnValue($cache));
     F::setInstance("FounderProgressBarController", $mock);
     $this->object = F::build('FounderProgressBarController');
     $this->task_id = 0;
 }
Esempio n. 13
0
 public function setUp()
 {
     $dir = dirname(__FILE__) . '/../';
     $this->setupFile = $dir . 'POI.setup.php';
     $this->tmpFile = tempnam('/tmp', __CLASS__);
     parent::setUp();
 }
Esempio n. 14
0
 public function setUp()
 {
     $this->parser = new Parser();
     $title = Title::newFromText('test');
     $options = new ParserOptions();
     $this->parser->startExternalParse($title, $options, 'text', true);
     parent::setUp();
 }
 public function setUp()
 {
     $this->setupFile = dirname(__FILE__) . '/../CreateNewWiki_setup.php';
     parent::setUp();
     $userMock = $this->getMock('stdClass', array('getGroups'));
     $userMock->expects($this->any())->method('getGroups')->will($this->returnValue(array()));
     $this->mockGlobalVariable('wgUser', $userMock);
 }
Esempio n. 16
0
 function setUp()
 {
     parent::setUp();
     $memcMock = $this->getMock('MemcachedPhpBagOStuff', ['get', 'set'], [], '', false);
     $memcMock->expects($this->any())->method('get')->will($this->returnValue(false));
     $memcMock->expects($this->any())->method('set')->will($this->returnValue(true));
     $this->mockGlobalVariable('wgMemc', $memcMock);
 }
Esempio n. 17
0
 function setUp()
 {
     global $wgAutoloadClasses, $IP;
     $wgAutoloadClasses['UnitTestController'] = dirname(__FILE__) . '/controllers/UnitTestController.class.php';
     $wgAutoloadClasses['UnitTestService'] = dirname(__FILE__) . '/controllers/UnitTestService.class.php';
     $wgAutoloadClasses['OasisTemplate'] = $IP . '/skins/Oasis.php';
     parent::setUp();
 }
Esempio n. 18
0
 public function setUp()
 {
     $this->setupFile = __DIR__ . '/../Helios.setup.php';
     $this->webRequestMock = $this->getMock('\\WebRequest', ['getHeader', 'getCookie'], [], '', false);
     $this->mockGlobalVariable('wgHeliosLoginSamplingRate', 100);
     $this->mockGlobalVariable('wgHeliosLoginShadowMode', false);
     User::purgeAuthenticationCache();
     parent::setUp();
 }
 protected function setUp()
 {
     parent::setUp();
     global $wgUser;
     $this->backupUser = $wgUser;
     $mockFounderEmails = $this->getMock('FounderEmails', ['getLastEventType'], [], '', false);
     $mockFounderEmails->expects($this->any())->method('getLastEventType')->will($this->returnValue('edit'));
     $this->mockClass('FounderEmails', $mockFounderEmails);
 }
Esempio n. 20
0
 function setUp()
 {
     global $wgParser;
     $this->setupFile = __DIR__ . "/../MyHome.php";
     parent::setUp();
     if (empty($wgParser->mOptions)) {
         $wgParser->Options(new ParserOptions());
     }
 }
Esempio n. 21
0
 public function setUp()
 {
     global $wgApiAccess, $wgApiEnvironment;
     $this->org_wgApiAccess = $wgApiAccess;
     $this->org_wgApiEnvironment = $wgApiEnvironment;
     $wgApiAccess = ['AAA' => 111, 'BBB' => ['CCC' => 333]];
     $wgApiEnvironment = 'XXX';
     parent::setUp();
 }
Esempio n. 22
0
 protected function setUp()
 {
     parent::setUp();
     $this->attribs = array('align' => 'right', 'width' => 300, 'caption' => 'Foo', 'lat' => '52.406878', 'lon' => '16.922124');
     $this->model = F::build('PlaceModel', array($this->attribs), 'newFromAttributes');
     // use main page as an article for this place
     $mainPage = Title::newMainPage();
     $this->model->setPageId($mainPage->getArticleId());
 }
Esempio n. 23
0
 public function setUp()
 {
     parent::setUp();
     // assume we're in production environment
     $this->mockGlobalVariable('wgDevelEnvironment', false);
     $this->mockGlobalVariable('wgDevBoxImageServerOverride', false);
     $this->mockGlobalVariable('wgEnableVignette', false);
     $this->mockGlobalVariable('wgImagesDomainSharding', 'images%s.wikia.nocookie.net');
     $this->mockGlobalVariable('wgCdnStylePath', sprintf('http://slot1.images.wikia.nocookie.net/__cb%s/common', self::DEFAULT_CB));
 }
Esempio n. 24
0
 protected function setUp()
 {
     $this->setupFile = __DIR__ . '/../Places.setup.php';
     parent::setUp();
     $this->attribs = array('align' => 'right', 'width' => 300, 'caption' => 'Foo', 'lat' => '52.406878', 'lon' => '16.922124');
     $this->model = PlaceModel::newFromAttributes($this->attribs);
     // use main page as an article for this place
     $mainPage = Title::newMainPage();
     $this->model->setPageId($mainPage->getArticleId());
 }
Esempio n. 25
0
 public function setUp()
 {
     parent::setUp();
     global $wgStagingList;
     $this->org_StagingList = $wgStagingList;
     $wgStagingList = ['teststagging'];
     if (isset($_SERVER['SERVER_NAME'])) {
         $this->serverName = $_SERVER['SERVER_NAME'];
     }
 }
 public function setUp()
 {
     $this->setupFile = __DIR__ . '/../LyricFind.setup.php';
     parent::setUp();
     // mock API settings
     $this->mockGlobalVariable('wgLyricFindApiUrl', self::SERVICE_URL);
     $this->mockGlobalVariable('wgLyricFindApiKeys', ['display' => self::API_KEY]);
     // prevent DB changes
     $this->mockGlobalFunction('wfSetWikiaPageProp', null);
 }
Esempio n. 27
0
 function setUp()
 {
     parent::setUp();
     $this->disableMemCache();
     $this->getStaticMethodMock('WikiFactory', 'getVarValueByName')->expects($this->any())->method('getVarValueByName')->willReturnMap([['wgServer', 177, 'http://community.wikia.com'], ['wgServer', 113, 'http://en.memory-alpha.org'], ['wgServer', 490, 'http://www.wowwiki.com'], ['wgServer', 1686, 'http://spolecznosc.wikia.com'], ['wgArticlePath', 490, '/$1'], ['wgExtraNamespacesLocal', 490, [116 => 'Portal']]]);
     global $wgDevelEnvironment, $wgDevelEnvironmentName;
     $this->wgDevelEnv = $wgDevelEnvironment;
     $this->wgDevelEnvName = $wgDevelEnvironmentName;
     $wgDevelEnvironment = false;
     $wgDevelEnvironmentName = 'qa-testing-class-' . get_class($this);
 }
 protected function setUp()
 {
     global $wgUser;
     parent::setUp();
     $this->origUser = $wgUser;
     $wgUser = User::newFromName('WikiaBot');
     $this->fileName = self::PREFIX . str_replace('$1', time(), self::FILENAME);
     // get a hash of both external file
     $this->fileHash = md5(Http::get(self::URL, 'default', ['noProxy' => true]));
     $this->reuploadedFileHash = md5(Http::get(self::REUPLOAD_URL, 'default', ['noProxy' => true]));
     // use Swift domain
     global $wgDevelEnvironmentName;
     // Disabling forcing the image domain due to BAC-1136
     //$this->mockGlobalVariable( 'wgDevBoxImageServerOverride', "static.{$wgDevelEnvironmentName}.wikia-dev.com" );
     // debug
     global $wgLocalFileRepo;
     echo "Files repository in use: '{$wgLocalFileRepo['backend']}'\n";
     // local-backend / swift-backend
 }
Esempio n. 29
0
 public function setUp()
 {
     $dir = dirname(__FILE__) . '/../../../';
     global $wgAutoloadClasses;
     $wgAutoloadClasses['EditHubModel'] = $dir . '../WikiaHubsServices/models/EditHubModel.class.php';
     $wgAutoloadClasses['WikiaHubsModuleSliderService'] = $dir . '../WikiaHubsServices/modules/WikiaHubsModuleSliderService.class.php';
     $wgAutoloadClasses['WikiaHubsModuleFromthecommunityService'] = $dir . '../WikiaHubsServices/modules/WikiaHubsModuleFromthecommunityService.class.php';
     $wgAutoloadClasses['WikiaHubsModuleWikiaspicksService'] = $dir . '../WikiaHubsServices/modules/WikiaHubsModuleWikiaspicksService.class.php';
     $wgAutoloadClasses['WikiaHubsModuleEditableService'] = $dir . '../WikiaHubsServices/modules/WikiaHubsModuleEditableService.class.php';
     $wgAutoloadClasses['WikiaHubsModuleFeaturedvideoService'] = $dir . '../WikiaHubsServices/modules/WikiaHubsModuleFeaturedvideoService.class.php';
     $wgAutoloadClasses['WikiaHubsModuleExploreService'] = $dir . '../WikiaHubsServices/modules/WikiaHubsModuleExploreService.class.php';
     $wgAutoloadClasses['WikiaHubsModulePollsService'] = $dir . '../WikiaHubsServices/modules/WikiaHubsModulePollsService.class.php';
     $wgAutoloadClasses['WikiaHubsModulePopularvideosService'] = $dir . '../WikiaHubsServices/modules/WikiaHubsModulePopularvideosService.class.php';
     $wgAutoloadClasses['WikiaHubsExploreModel'] = $dir . '../WikiaHubsServices/models/WikiaHubsExploreModel.class.php';
     $wgAutoloadClasses['WikiaHubsModuleWAMService'] = $dir . '../WikiaHubsServices/modules/WikiaHubsModuleWAMService.class.php';
     $wgAutoloadClasses['WikiaHubsModuleNonEditableService'] = $dir . '../WikiaHubsServices/modules/WikiaHubsModuleNonEditableService.class.php';
     $wgAutoloadClasses['WikiaHubsModuleService'] = $dir . '../WikiaHubsServices/modules/WikiaHubsModuleService.class.php';
     $this->setupFile = $dir . 'HubRssFeed.setup.php';
     $this->editHubModel = $this->getMockBuilder('EditHubModel')->disableOriginalConstructor();
     parent::setUp();
 }
Esempio n. 30
0
 public function setUp()
 {
     $this->setupFile = dirname(__FILE__) . '/../VideoPageTool.setup.php';
     parent::setUp();
     $mock_user = $this->getMock('User', ['getId', 'getName']);
     $mock_user->expects($this->any())->method('getId')->will($this->returnValue(123));
     $mock_user->expects($this->any())->method('getName')->will($this->returnValue('Garthwebb'));
     $this->mockGlobalVariable('wgUser', $mock_user);
     $this->mockStaticMethod('User', 'newFromId', $mock_user);
     /*
      * That's pretty bad, as we will return master db connection for all wfGetDB calls, even those for slave and
      * dataware. But as for now mockGlobalFunction does not support PHPUnit's callbacks and returnValueArray
      */
     $slaveDb = wfGetDB(DB_MASTER, [], 'video151');
     $this->mockGlobalFunction('wfGetDB', $slaveDb);
     $language = 'en';
     $date = 158486400;
     // This is Jan 9th, 1975 a date suitably far in the past but doing well for its age thank you very much
     $this->program = VideoPageToolProgram::newProgram($language, $date);
     // If a previous test faield and didn't clean itself up, clean up now.  This includes
     // deleting related assets and clearing their caches
     if ($this->program->exists()) {
         $cascade = true;
         $this->program->delete($cascade);
         $this->program = VideoPageToolProgram::newProgram($language, $date);
     }
     if (empty($this->program)) {
         throw new Exception("Failed to load program with lang={$language} and date={$date}");
     }
     // Save this program to get a program ID
     $status = $this->program->save();
     if (!$status->isGood()) {
         throw new Exception("Failed to save program with lang={$language} and date={$date}");
     }
     $this->programID = $this->program->getProgramId();
 }