예제 #1
0
 public function testDeserializePropertyIdFilterItemId()
 {
     $entityIdDeserializerMock = $this->getMock('\\Deserializers\\Deserializer');
     $entityIdDeserializerMock->expects($this->any())->method('deserialize')->with($this->equalTo('Q42'))->will($this->returnValue(new ItemId('Q42')));
     $deserializer = new SnakDeserializer(new DataValueDeserializer(), $entityIdDeserializerMock);
     $this->setExpectedException('\\Deserializers\\Exceptions\\InvalidAttributeException');
     $deserializer->deserialize(array('snaktype' => 'somevalue', 'property' => 'Q42'));
 }
 /**
  * Render a snak from its serialization as provided from Lua.
  *
  * @since 0.5
  *
  * @param array $snakSerialization As obtained from ItemSerializer
  *
  * @return string wikitext
  */
 public function renderSnak(array $snakSerialization)
 {
     $snak = $this->snakDeserializer->deserialize($snakSerialization);
     return $this->snakFormatter->formatSnak($snak);
 }