当前位置: 首页>>代码示例>>PHP>>正文


PHP Site::setGlobalId方法代码示例

本文整理汇总了PHP中Site::setGlobalId方法的典型用法代码示例。如果您正苦于以下问题:PHP Site::setGlobalId方法的具体用法?PHP Site::setGlobalId怎么用?PHP Site::setGlobalId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Site的用法示例。


在下文中一共展示了Site::setGlobalId方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testClear

 /**
  * @covers HashSiteStore::clear
  */
 public function testClear()
 {
     $store = new HashSiteStore();
     $site = new Site();
     $site->setGlobalId('arwiki');
     $store->saveSite($site);
     $this->assertCount(1, $store->getSites(), '1 site in store');
     $store->clear();
     $this->assertCount(0, $store->getSites(), '0 sites in store');
 }
开发者ID:eliagbayani,项目名称:LiteratureEditor,代码行数:13,代码来源:HashSiteStoreTest.php

示例2: getSites

 /**
  * @since 1.21
  *
  * @return array
  */
 public static function getSites()
 {
     $sites = array();
     $site = new Site();
     $site->setGlobalId('foobar');
     $sites[] = $site;
     $site = new MediaWikiSite();
     $site->setGlobalId('enwiktionary');
     $site->setGroup('wiktionary');
     $site->setLanguageCode('en');
     $site->addNavigationId('enwiktionary');
     $site->setPath(MediaWikiSite::PATH_PAGE, "https://en.wiktionary.org/wiki/\$1");
     $site->setPath(MediaWikiSite::PATH_FILE, "https://en.wiktionary.org/w/\$1");
     $sites[] = $site;
     $site = new MediaWikiSite();
     $site->setGlobalId('dewiktionary');
     $site->setGroup('wiktionary');
     $site->setLanguageCode('de');
     $site->addInterwikiId('dewiktionary');
     $site->addInterwikiId('wiktionaryde');
     $site->setPath(MediaWikiSite::PATH_PAGE, "https://de.wiktionary.org/wiki/\$1");
     $site->setPath(MediaWikiSite::PATH_FILE, "https://de.wiktionary.org/w/\$1");
     $sites[] = $site;
     $site = new Site();
     $site->setGlobalId('spam');
     $site->setGroup('spam');
     $site->setLanguageCode('en');
     $site->addNavigationId('spam');
     $site->addNavigationId('spamz');
     $site->addInterwikiId('spamzz');
     $site->setLinkPath("http://spamzz.test/testing/");
     $sites[] = $site;
     /**
      * Add at least one right-to-left language (current RTL languages in MediaWiki core are:
      * aeb, ar, arc, arz, azb, bcc, bqi, ckb, dv, en_rtl, fa, glk, he, khw, kk_arab, kk_cn,
      * ks_arab, ku_arab, lrc, mzn, pnb, ps, sd, ug_arab, ur, yi).
      */
     $languageCodes = array('de', 'en', 'fa', 'nl', 'nn', 'no', 'sr', 'sv');
     foreach ($languageCodes as $langCode) {
         $site = new MediaWikiSite();
         $site->setGlobalId($langCode . 'wiki');
         $site->setGroup('wikipedia');
         $site->setLanguageCode($langCode);
         $site->addInterwikiId($langCode);
         $site->addNavigationId($langCode);
         $site->setPath(MediaWikiSite::PATH_PAGE, "https://{$langCode}.wikipedia.org/wiki/\$1");
         $site->setPath(MediaWikiSite::PATH_FILE, "https://{$langCode}.wikipedia.org/w/\$1");
         $sites[] = $site;
     }
     return $sites;
 }
开发者ID:mb720,项目名称:mediawiki,代码行数:56,代码来源:TestSites.php

示例3: getSites

 private function getSites()
 {
     $sites = array();
     $site = new Site();
     $site->setGlobalId('foobar');
     $sites[] = $site;
     $site = new MediaWikiSite();
     $site->setGlobalId('enwiktionary');
     $site->setGroup('wiktionary');
     $site->setLanguageCode('en');
     $site->addNavigationId('enwiktionary');
     $site->setPath(MediaWikiSite::PATH_PAGE, "https://en.wiktionary.org/wiki/\$1");
     $site->setPath(MediaWikiSite::PATH_FILE, "https://en.wiktionary.org/w/\$1");
     $sites[] = $site;
     return new SiteList($sites);
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:16,代码来源:FileBasedSiteLookupTest.php

示例4: testSaveSites

 /**
  * @covers CachingSiteStore::saveSites
  */
 public function testSaveSites()
 {
     $store = new CachingSiteStore(new HashSiteStore(), wfGetMainCache());
     $sites = [];
     $site = new Site();
     $site->setGlobalId('ertrywuutr');
     $site->setLanguageCode('en');
     $sites[] = $site;
     $site = new MediaWikiSite();
     $site->setGlobalId('sdfhxujgkfpth');
     $site->setLanguageCode('nl');
     $sites[] = $site;
     $this->assertTrue($store->saveSites($sites));
     $site = $store->getSite('ertrywuutr');
     $this->assertInstanceOf('Site', $site);
     $this->assertEquals('en', $site->getLanguageCode());
     $site = $store->getSite('sdfhxujgkfpth');
     $this->assertInstanceOf('Site', $site);
     $this->assertEquals('nl', $site->getLanguageCode());
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:23,代码来源:CachingSiteStoreTest.php

示例5: testSaveSites

 public function testSaveSites()
 {
     $store = SiteSQLStore::newInstance();
     $sites = array();
     $site = new Site();
     $site->setGlobalId('ertrywuutr');
     $site->setLanguageCode('en');
     $sites[] = $site;
     $site = new MediaWikiSite();
     $site->setGlobalId('sdfhxujgkfpth');
     $site->setLanguageCode('nl');
     $sites[] = $site;
     $this->assertTrue($store->saveSites($sites));
     $site = $store->getSite('ertrywuutr');
     $this->assertInstanceOf('Site', $site);
     $this->assertEquals('en', $site->getLanguageCode());
     $this->assertTrue(is_integer($site->getInternalId()));
     $this->assertTrue($site->getInternalId() >= 0);
     $site = $store->getSite('sdfhxujgkfpth');
     $this->assertInstanceOf('Site', $site);
     $this->assertEquals('nl', $site->getLanguageCode());
     $this->assertTrue(is_integer($site->getInternalId()));
     $this->assertTrue($site->getInternalId() >= 0);
 }
开发者ID:mangowi,项目名称:mediawiki,代码行数:24,代码来源:SiteSQLStoreTest.php

示例6: newSite

 /**
  * Factory for creating new site objects.
  *
  * @since 1.21
  * @deprecated
  *
  * @param string|boolean false $globalId
  *
  * @return Site
  */
 public static function newSite($globalId = false)
 {
     $site = new Site();
     if ($globalId !== false) {
         $site->setGlobalId($globalId);
     }
     return $site;
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:18,代码来源:SiteSQLStore.php

示例7: testGetSitesDefaultOrder

 /**
  * @covers DBSiteStore::getSites
  */
 public function testGetSitesDefaultOrder()
 {
     $store = new DBSiteStore();
     $siteB = new Site();
     $siteB->setGlobalId('B');
     $siteA = new Site();
     $siteA->setGlobalId('A');
     $store->saveSites(array($siteB, $siteA));
     $sites = $store->getSites();
     $siteIdentifiers = array();
     /** @var Site $site */
     foreach ($sites as $site) {
         $siteIdentifiers[] = $site->getGlobalId();
     }
     $this->assertSame(array('A', 'B'), $siteIdentifiers);
     // Note: SiteList::getGlobalIdentifiers uses an other internal state. Iteration must be
     // tested separately.
     $this->assertSame(array('A', 'B'), $sites->getGlobalIdentifiers());
 }
开发者ID:jpena88,项目名称:mediawiki-dokku-deploy,代码行数:22,代码来源:DBSiteStoreTest.php

示例8: testSetGlobalId

 /**
  * @dataProvider instanceProvider
  * @param Site $site
  * @covers Site::setGlobalId
  */
 public function testSetGlobalId(Site $site)
 {
     $site->setGlobalId('foobar');
     $this->assertEquals('foobar', $site->getGlobalId());
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:10,代码来源:SiteTest.php


注:本文中的Site::setGlobalId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。