public function testAsArray() { $id = new ItemId('Q7'); $aspect = EntityUsage::LABEL_USAGE; $modifier = 'ru'; $expected = array('entityId' => $id->getSerialization(), 'aspect' => $aspect, 'modifier' => null); $usage = new EntityUsage($id, $aspect); $this->assertEquals($expected, $usage->asArray()); $expected['modifier'] = $modifier; $usage = new EntityUsage($id, $aspect, $modifier); $this->assertEquals($expected, $usage->asArray()); }
public function testNewSpec() { $usageQ5X = new EntityUsage(new ItemId('Q5'), 'X'); $title = Title::makeTitle(NS_MAIN, 'Foo'); $title->resetArticleID(17); $touched = '20150101000000'; $usages = array($usageQ5X); $spec = AddUsagesForPageJob::newSpec($title, $usages, $touched); $expected = array('pageId' => $title->getArticleID(), 'usages' => array($usageQ5X->asArray()), 'touched' => '20150101000000'); $this->assertEquals('wikibase-addUsagesForPage', $spec->getType()); $this->assertEquals($title->getFullText(), $spec->getTitle()->getFullText()); $this->assertEquals($expected, $spec->getParams()); }