public function testGetDefaultDescriptionDeserializerForMatchableDataValue() { $descriptionDeserializer = $this->getMockBuilder('\\SMW\\Deserializers\\DVDescriptionDeserializer\\DescriptionDeserializer')->disableOriginalConstructor()->getMockForAbstractClass(); $descriptionDeserializer->expects($this->once())->method('isDeserializerFor')->will($this->returnValue(true)); $dataValue = $this->getMockBuilder('\\SMWDataValue')->disableOriginalConstructor()->getMockForAbstractClass(); $instance = new DispatchingDescriptionDeserializer(); $instance->addDefaultDescriptionDeserializer($descriptionDeserializer); $this->assertInstanceOf('\\SMW\\Deserializers\\DVDescriptionDeserializer\\DescriptionDeserializer', $instance->getDescriptionDeserializerBy($dataValue)); }
private function newDispatchingDescriptionDeserializer() { $dispatchingDescriptionDeserializer = new DispatchingDescriptionDeserializer(); $dispatchingDescriptionDeserializer->addDescriptionDeserializer(new TimeValueDescriptionDeserializer()); $dispatchingDescriptionDeserializer->addDescriptionDeserializer(new RecordValueDescriptionDeserializer()); $dispatchingDescriptionDeserializer->addDescriptionDeserializer(new MonolingualTextValueDescriptionDeserializer()); $dispatchingDescriptionDeserializer->addDefaultDescriptionDeserializer(new SomeValueDescriptionDeserializer()); return $dispatchingDescriptionDeserializer; }