private function getCodec($maxBlobSize = 0)
 {
     $idParser = new BasicEntityIdParser();
     $serializerFactory = new SerializerFactory(new DataValueSerializer());
     $deserializerFactory = new DeserializerFactory(new DataValueDeserializer(), $idParser);
     $codec = new EntityContentDataCodec($idParser, $serializerFactory->newEntitySerializer(), $deserializerFactory->newEntityDeserializer(), $maxBlobSize);
     return $codec;
 }
 public function exportTransformProvider()
 {
     $entity = $this->newEntity();
     $internalSerializer = WikibaseRepo::getDefaultInstance()->getInternalEntitySerializer();
     $oldBlob = json_encode($internalSerializer->serialize($entity));
     // fake several old formats
     $type = $entity->getType();
     $id = $entity->getId()->getSerialization();
     // replace "type":"item","id":"q7" with "entity":["item",7]
     $veryOldBlob = preg_replace('/"type":"\\w+"(,"datatype":"\\w+")?,"id":"\\w\\d+"/', '"entity":["' . strtolower($type) . '",' . substr($id, 1) . ']$1', $oldBlob);
     // replace "entity":["item",7] with "entity":"q7"
     $veryVeryOldBlob = preg_replace('/"entity":\\["\\w+",\\d+\\]/', '"entity":"' . strtolower($id) . '"', $veryOldBlob);
     // sanity (cannot compare $veryOldBlob and $oldBlob until we have the new serialization in place)
     if ($veryVeryOldBlob === $veryOldBlob) {
         throw new RuntimeException('Failed to fake very old serialization format based on oldish serialization format.');
     }
     // make new style blob
     $newSerializerFactory = new SerializerFactory(new DataValueSerializer());
     $newSerializer = $newSerializerFactory->newEntitySerializer();
     $newBlob = json_encode($newSerializer->serialize($entity));
     return array('old serialization / ancient id format' => array($veryVeryOldBlob, $newBlob), 'old serialization / new silly id format' => array($veryOldBlob, $newBlob), 'old serialization / old serializer format' => array($oldBlob, $newBlob), 'new serialization format, keep as is' => array($newBlob, $newBlob));
 }