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'); }
protected function setUp() { parent::setUp(); if (!self::$propertyIds) { self::$propertyIds = $this->getPropertyIds(); } }
protected function setUp() { parent::setUp(); static $hasEntities = false; if (!$hasEntities) { $this->initTestEntities(array('StringProp', 'Berlin')); $hasEntities = true; } }
protected function setUp() { parent::setUp(); ApiTestCase::$users['wbbot'] = new TestUser('Apitestbot', 'Api Test Bot', '*****@*****.**', array('bot')); $this->mergeMwGlobalArrayValue('wgGroupPermissions', array('user' => array('item-merge' => true, 'item-redirect' => true))); if (!isset(self::$hasSetup)) { $this->initTestEntities(array('Empty', 'Leipzig', 'Osaka')); } self::$hasSetup = true; }
protected function tearDown() { global $wgGroupPermissions; global $wgUser; $wgGroupPermissions = $this->permissions; if ($this->old_user) { // should not be null, but sometimes, it is $wgUser = $this->old_user; } parent::tearDown(); }
protected function setUp() { parent::setUp(); $wikibaseRepo = WikibaseRepo::getDefaultInstance(); $store = $wikibaseRepo->getEntityStore(); if (!self::$propertyIds) { self::$propertyIds = array(); for ($i = 0; $i < 4; $i++) { $property = Property::newFromType('string'); $store->saveEntity($property, '', $GLOBALS['wgUser'], EDIT_NEW); self::$propertyIds[] = $property->getId(); } $this->initTestEntities(array('StringProp', 'Berlin')); } $this->serializerFactory = new SerializerFactory(new DataValueSerializer(), SerializerFactory::OPTION_SERIALIZE_REFERENCE_SNAKS_WITHOUT_HASH); $this->deserializerFactory = new DeserializerFactory($wikibaseRepo->getDataValueDeserializer(), $wikibaseRepo->getEntityIdParser()); }
protected 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; }