Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public static function deserializeMetadataJson($json)
 {
     return MetadataFactory::getSerializer()->deserialize($json, 'fr\\ina\\amalia\\model\\Metadata', 'json');
 }
Exemplo n.º 2
0
 /**
  * Fonction en charge de deserialization
  */
 public function testDeserializeJsonFile()
 {
     $toDeserializeJson = file_get_contents('tests/data/amalia-simple-localisation-sublocalisation.json');
     /** @var \fr\ina\amalia\model\Metadata $metadata */
     $metadata = MetadataFactory::deserializeMetadataJson($toDeserializeJson);
     $this->assertEquals(get_class($metadata), 'fr\\ina\\amalia\\model\\Metadata');
     $this->assertEquals($metadata->getId(), 'amalia-simple');
     $this->assertEquals($metadata->getType(), 'test');
     /** @var array<\fr\ina\amalia\model\Localisation> $localisations */
     $localisations = $metadata->getLocalisation();
     $this->assertEquals(count($localisations), 1);
     if (count($localisations) > 0) {
         /** @var \fr\ina\amalia\model\Localisation $loc */
         $loc = $localisations[0];
         $this->assertEquals($loc->getTcin(), '00:00:00.0000');
         $this->assertEquals($loc->getTcout(), '00:01:00.0000');
     }
 }