private function newSimpleItem() { $item = new SimpleItem(); $item->ids = ['wikidata' => 'Q1337', 'en.wikipedia' => 'Kitten', 'de.wikipedia' => 'Katzen']; $item->label = 'kittens'; $item->description = 'lots of kittens'; $item->aliases = ['cats']; $item->statements = [SimpleStatement::newInstance()->withPropertyName('Population prop name')->withPropertyId('P23')->withType('number')->withValues([new NumberValue(9001)]), SimpleStatement::newInstance()->withPropertyName('foo bar baz')->withPropertyId('P42')->withType('string')->withValues([new StringValue('Jeroen'), new StringValue('Abraham')]), SimpleStatement::newInstance()->withPropertyName('Property that is no in the map')->withPropertyId('P1337')->withType('number')->withValues([new NumberValue(1337)])]; return $item; }
private function newSimpleItem() { $item = new SimpleItem(); $item->ids = ['wikidata' => 'Q1337', 'en.wikipedia' => 'Kitten', 'de.wikipedia' => 'Katzen']; $item->label = 'kittens'; $item->description = 'lots of kittens'; $item->aliases = ['cats']; $item->statements = [SimpleStatement::newInstance()->withPropertyName('fluffiness')->withType('number')->withValues([new NumberValue(9001)]), SimpleStatement::newInstance()->withPropertyName('awesome')->withType('string')->withValues([new StringValue('Jeroen'), new StringValue('Abraham')])]; return $item; }
public function testLabelLookupFallsBackToId() { $labelLookup = $this->getMock('Queryr\\Resources\\Builders\\ResourceLabelLookup'); $labelLookup->expects($this->any())->method('getLabelByIdAndLanguage')->will($this->returnValue(null)); $statement = new Statement(new PropertyValueSnak(42, new EntityIdValue(new ItemId('Q1337')))); $statement->setGuid('first guid'); $builder = new SimpleStatementsBuilder('en', $labelLookup); $simpleStatements = $builder->buildFromStatements(new StatementList([$statement])); $expected = SimpleStatement::newInstance()->withPropertyName('P42')->withPropertyId(new PropertyId('P42'))->withType('string')->withValues([new StringValue('Q1337')]); $this->assertEquals([$expected], $simpleStatements); }
private function getSimpleStatement() { return SimpleStatement::newInstance()->withPropertyName('awesome label')->withPropertyId(new PropertyId('P42'))->withType('string')->withValues([new StringValue('kittens')]); }