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()
 {
     $serialized = SerializerFactory::serialize($this);
     reset($this->mResults);
     return $serialized;
 }
 /**
  * @dataProvider serializerDataProvider
  *
  * @since 1.9
  */
 public function testRegisteredSerializerFactory($object)
 {
     $serialized = SerializerFactory::serialize($object);
     $this->assertInternalType('array', $serialized, 'Asserts that serialize() returns an array');
 }