public function testFindPropertyInfoForUnregisteredId()
 {
     $datatypeRegistry = $this->getMockBuilder('\\SMW\\DataTypeRegistry')->disableOriginalConstructor()->getMock();
     $datatypeRegistry->expects($this->once())->method('getKnownTypeLabels')->will($this->returnValue(array()));
     $datatypeRegistry->expects($this->once())->method('getKnownTypeAliases')->will($this->returnValue(array()));
     $store = $this->getMockBuilder('\\SMW\\Store')->disableOriginalConstructor()->getMockForAbstractClass();
     $propertyLabelFinder = new PropertyLabelFinder($store, array());
     $propertyAliases = array();
     $instance = new PropertyRegistry($datatypeRegistry, $propertyLabelFinder, $propertyAliases);
     $this->assertEquals('', $instance->findPropertyLabelById('_UnknownId'));
     $this->assertEquals('', $instance->getPropertyTypeId('_UnknownId'));
     $this->assertFalse($instance->findPropertyIdByLabel('unknownLabel'));
     $this->assertFalse($instance->findPropertyIdByLabel('unknownLabel', true));
 }
예제 #2
0
 public function testFindPropertyLabel()
 {
     $datatypeRegistry = $this->getMockBuilder('\\SMW\\DataTypeRegistry')->disableOriginalConstructor()->getMock();
     $datatypeRegistry->expects($this->once())->method('getKnownTypeLabels')->will($this->returnValue(array()));
     $datatypeRegistry->expects($this->once())->method('getKnownTypeAliases')->will($this->returnValue(array()));
     $propertyLabels = array();
     $propertyAliases = array();
     $instance = new PropertyRegistry($datatypeRegistry, $propertyLabels, $propertyAliases);
     $instance->registerProperty(DIProperty::TYPE_HAS_TYPE, '__typ', 'Has type', true);
     $this->assertEquals('Has type', $instance->findPropertyLabelById('_TYPE'));
     $this->assertEquals('', $instance->findPropertyLabelById('_UnknownId'));
     // findPropertyLabel legacy test
     $this->assertEquals('Has type', $instance->findPropertyLabel('_TYPE'));
     // This was part of an extra test but the extra test caused an segfault on postgres travis-ci
     $this->assertEquals('__typ', $instance->getPropertyTypeId('_TYPE'));
     $this->assertEquals('', $instance->getPropertyTypeId('_UnknownId'));
     // getPredefinedPropertyTypeId legacy test
     $this->assertEquals('__typ', $instance->getPredefinedPropertyTypeId('_TYPE'));
 }