private function findPropertyDescriptionBy(DIProperty $property) { if ($this->languageCode !== '') { $this->propertySpecificationLookup->setLanguageCode($this->languageCode); } $description = $this->propertySpecificationLookup->getPropertyDescriptionBy($property); if ($description === '' || $description === null) { return $description; } return array($this->propertySpecificationLookup->getLanguageCode() => $description); }
public function testTryToGetLocalPropertyDescriptionForUserdefinedProperty() { $property = $this->dataItemFactory->newDIProperty('Foo'); $pdesc = $this->dataItemFactory->newDIProperty('_PDESC'); $pdesc->setPropertyTypeId('_mlt_rec'); $container = $this->getMockBuilder('\\Onoi\\BlobStore\\Container')->disableOriginalConstructor()->getMock(); $this->blobStore->expects($this->once())->method('read')->will($this->returnValue($container)); $this->cachedPropertyValuesPrefetcher->expects($this->once())->method('getPropertyValues')->with($this->equalTo($property->getDiWikiPage()), $this->anything(), $this->anything())->will($this->returnValue(array($this->dataItemFactory->newDIContainer(ContainerSemanticData::makeAnonymousContainer())))); $this->cachedPropertyValuesPrefetcher->expects($this->once())->method('getBlobStore')->will($this->returnValue($this->blobStore)); $instance = new PropertySpecificationLookup($this->cachedPropertyValuesPrefetcher, $this->intermediaryMemoryCache); $this->assertInternalType('string', $instance->getPropertyDescriptionBy($property)); }