private function getIdFromSerialization(array $serialization) { if (!array_key_exists('id', $serialization)) { return null; } return $this->entityIdDeserializer->deserialize($serialization['id']); }
public function testDeserializeWithEntityIdParsingException() { $entityIdParserMock = $this->getMock('\\Wikibase\\DataModel\\Entity\\EntityIdParser'); $entityIdParserMock->expects($this->any())->method('parse')->will($this->throwException(new EntityIdParsingException())); $entityIdDeserializer = new EntityIdDeserializer($entityIdParserMock); $this->setExpectedException('\\Deserializers\\Exceptions\\DeserializationException'); $entityIdDeserializer->deserialize('test'); }