public function testConstructor()
 {
     $options = array('foo' => 42, 'bar' => 4.2, 'baz' => array('o_O', false, null, '42' => 42, array()));
     $genericOptions = new GenericOptions($options);
     $this->assertEquals($options, $genericOptions->getOptions());
     $this->assertFalse($genericOptions->hasOption('ohi'));
 }
Exemplo n.º 2
0
 /**
  * @since 0.2
  *
  * @param DataValue $value
  * @param string $dataTypeId
  * @param GenericOptions $options
  *
  * @returns string
  */
 public function format(DataValue $value, $dataTypeId, GenericOptions $options = null)
 {
     if ($options === null) {
         $options = new GenericOptions();
     }
     $params = array('datavalue' => json_encode($this->dataValueSerializer->serialize($value)), 'datatype' => $dataTypeId, 'options' => json_encode($options->getOptions()));
     $result = $this->api->getRequest(new SimpleRequest('wbformatvalue', $params));
     return $result['result'];
 }