public function testLabelLookupFallsBackToId()
 {
     $labelLookup = $this->getMock(LabelLookup::class);
     $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, new UrlBuilder('http://test'));
     $simpleStatements = $builder->buildFromStatements(new StatementList([$statement]));
     $expected = SimpleStatement::newInstance()->withPropertyName('P42')->withPropertyId(new PropertyId('P42'))->withPropertyUrl('http://test/properties/P42')->withType('queryr-entity-identity')->withValues([new EntityIdentityValue(new ItemId('Q1337'), 'Q1337', 'http://test/items/Q1337')]);
     $this->assertEquals([$expected], $simpleStatements);
 }
 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()->withPropertyId(new PropertyId('P1'))->withPropertyUrl('http://property/1')->withPropertyName('fluffiness')->withType('number')->withValues([new NumberValue(9001)]), SimpleStatement::newInstance()->withPropertyId(new PropertyId('P2'))->withPropertyUrl('http://property/2')->withPropertyName('awesome')->withType('string')->withValues([new StringValue('Jeroen'), new StringValue('Abraham')])];
     $item->labelUrl = 'http://labels';
     $item->descriptionUrl = 'http://description';
     $item->aliasesUrl = 'http://aliases';
     $item->dataUrl = 'http://data';
     $item->wikidataUrl = 'http://wikidata';
     return $item;
 }
 private function getSimpleStatement()
 {
     return SimpleStatement::newInstance()->withPropertyName('awesome label')->withPropertyId(new PropertyId('P42'))->withPropertyUrl('http://test/properties/P42')->withType('string')->withValues([new StringValue('kittens')]);
 }
 public function testSafeAccessWhenNothingSetCausesException()
 {
     $ss = new SimpleStatement();
     $this->setExpectedException(\RuntimeException::class);
     $ss->safelyGet()->propertyId;
 }