Esempio n. 1
0
 public function testFindPropertyId()
 {
     $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);
     $instance->registerPropertyAlias('_TYPE', 'foo');
     $this->assertEquals('_TYPE', $instance->findPropertyIdByLabel('Has type'));
     $this->assertEquals('_TYPE', $instance->findPropertyIdByLabel('foo', true));
     $this->assertFalse($instance->findPropertyIdByLabel('unknownLabel'));
     $this->assertFalse($instance->findPropertyIdByLabel('unknownLabel', true));
     // findPropertyId legacy test
     $this->assertEquals('_TYPE', $instance->findPropertyId('Has type'));
 }