public function testTryToGetDescriptionDeserializerForNonDispatchableDataValueThrowsException() { $descriptionDeserializer = $this->getMockBuilder('\\SMW\\Deserializers\\DVDescriptionDeserializer\\DescriptionDeserializer')->disableOriginalConstructor()->getMockForAbstractClass(); $descriptionDeserializer->expects($this->once())->method('isDeserializerFor')->will($this->returnValue(false)); $dataValue = $this->getMockBuilder('\\SMWDataValue')->disableOriginalConstructor()->getMockForAbstractClass(); $instance = new DispatchingDescriptionDeserializer(); $instance->addDescriptionDeserializer($descriptionDeserializer); $this->setExpectedException('RuntimeException'); $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; }