public function testRoundtripOfSerializedSemanticDataAfterStoreUpdate()
 {
     $subject = DIWikiPage::newFromTitle(Title::newFromText(__METHOD__));
     $semanticDataBeforeUpdate = new SemanticData($subject);
     $subobject = new Subobject($subject->getTitle());
     $subobject->setEmptyContainerForId('SomeSubobjectToSerialize');
     $subobject->getSemanticData()->addDataValue(DataValueFactory::getInstance()->newPropertyValue('Foo', 'Bar'));
     $semanticDataBeforeUpdate->addSubobject($subobject);
     $this->getStore()->updateData($semanticDataBeforeUpdate);
     $semanticDataAfterUpdate = $this->getStore()->getSemanticData($subject);
     $serializerFactory = new SerializerFactory();
     $this->assertEquals($semanticDataAfterUpdate->getHash(), $serializerFactory->deserialize($serializerFactory->serialize($semanticDataAfterUpdate))->getHash());
 }
Example #2
0
 /**
  * @see DISerializer::getSerializedQueryResult
  * @since 1.7
  * @return array
  */
 public function serializeToArray()
 {
     $serializerFactory = new SerializerFactory();
     $serialized = $serializerFactory->newQueryResultSerializer()->serialize($this);
     reset($this->mResults);
     return $serialized;
 }
 public function testGetDeserializerForUnregisteredSerializerThrowsException()
 {
     $instance = new SerializerFactory();
     $this->setExpectedException('OutOfBoundsException');
     $instance->getDeserializerFor(array('Foo'));
 }
Example #4
0
 /**
  * @see DISerializer::getSerializedQueryResult
  * @since 1.7
  * @return array
  */
 public function serializeToArray()
 {
     $serialized = SerializerFactory::serialize($this);
     reset($this->mResults);
     return $serialized;
 }
 /**
  * @dataProvider deserializerDataProvider
  *
  * @since 1.9
  */
 public function testRegisteredDeserializerFactory($object, $instance)
 {
     $unserialized = SerializerFactory::deserialize($object);
     $this->assertInstanceOf($instance, $unserialized, "Asserts that deserialize() returns a {$instance} instance");
 }