Esempio n. 1
0
 public function setup()
 {
     parent::setup();
     if (!isset(self::$hasSetup)) {
         $wikibaseRepo = WikibaseRepo::getDefaultInstance();
         $store = $wikibaseRepo->getEntityStore();
         $prop = Property::newFromType('string');
         $store->saveEntity($prop, 'EditEntityTestP56', $GLOBALS['wgUser'], EDIT_NEW);
         self::$idMap['%P56%'] = $prop->getId()->getSerialization();
         self::$idMap['%StringProp%'] = $prop->getId()->getSerialization();
         $prop = Property::newFromType('string');
         $store->saveEntity($prop, 'EditEntityTestP72', $GLOBALS['wgUser'], EDIT_NEW);
         self::$idMap['%P72%'] = $prop->getId()->getSerialization();
         $this->initTestEntities(array('Berlin'), self::$idMap);
         self::$idMap['%Berlin%'] = EntityTestHelper::getId('Berlin');
         $p56 = self::$idMap['%P56%'];
         $berlinData = EntityTestHelper::getEntityOutput('Berlin');
         self::$idMap['%BerlinP56%'] = $berlinData['claims'][$p56][0]['id'];
         $badge = new Item();
         $store->saveEntity($badge, 'EditEntityTestQ42', $GLOBALS['wgUser'], EDIT_NEW);
         self::$idMap['%Q42%'] = $badge->getId()->getSerialization();
         $badge = new Item();
         $store->saveEntity($badge, 'EditEntityTestQ149', $GLOBALS['wgUser'], EDIT_NEW);
         self::$idMap['%Q149%'] = $badge->getId()->getSerialization();
         $badge = new Item();
         $store->saveEntity($badge, 'EditEntityTestQ32', $GLOBALS['wgUser'], EDIT_NEW);
         self::$idMap['%Q32%'] = $badge->getId()->getSerialization();
         $wikibaseRepo->getSettings()->setSetting('badgeItems', array(self::$idMap['%Q42%'] => '', self::$idMap['%Q149%'] => '', 'Q99999' => ''));
     }
     self::$hasSetup = true;
 }
 public function setup()
 {
     parent::setup();
     $this->tablesUsed[] = 'wbs_propertypairs';
     $apiMain = $this->getMockBuilder('ApiMain')->disableOriginalConstructor()->getMockForAbstractClass();
     $this->getSuggestions = new GetSuggestions($apiMain, 'wbgetsuggestion');
 }
Esempio n. 3
0
 public function setup()
 {
     parent::setup();
     if (!isset(self::$hasSetup)) {
         $wikibaseRepo = WikibaseRepo::getDefaultInstance();
         $store = $wikibaseRepo->getEntityStore();
         $this->initTestEntities(array('StringProp', 'Leipzig', 'Berlin'));
         $badge = new Item();
         $store->saveEntity($badge, 'SetSiteLinkTestGA', $GLOBALS['wgUser'], EDIT_NEW);
         self::$gaItemId = $badge->getId();
         $badge = new Item();
         $store->saveEntity($badge, 'SetSiteLinkTestFA', $GLOBALS['wgUser'], EDIT_NEW);
         self::$faItemId = $badge->getId();
         $badge = new Item();
         $store->saveEntity($badge, 'SetSiteLinkTestOther', $GLOBALS['wgUser'], EDIT_NEW);
         self::$otherItemId = $badge->getId();
         $wikibaseRepo->getSettings()->setSetting('badgeItems', array(self::$gaItemId->getSerialization() => '', self::$faItemId->getSerialization() => '', 'Q99999' => ''));
     }
     self::$hasSetup = true;
 }