The JSON object is expected to have the property "version" set.
С версии: 1.3
Автор: Bernhard Schussek (bschussek@gmail.com)
Пример #1
0
 private function migrate(stdClass $jsonData, $targetVersion)
 {
     try {
         $this->migrationManager->migrate($jsonData, $targetVersion);
     } catch (MigrationFailedException $e) {
         throw new ConversionFailedException(sprintf('Could not migrate the JSON data: %s', $e->getMessage()), 0, $e);
     }
 }
Пример #2
0
 /**
  * @expectedException \Webmozart\Json\Conversion\ConversionFailedException
  */
 public function testFromJsonFailsIfVersionIsMissing()
 {
     $this->migrationManager->expects($this->never())->method('migrate');
     $this->innerConverter->expects($this->never())->method('fromJson');
     $this->converter->fromJson((object) array());
 }
Пример #3
0
 public function testGetKnownVersionsWithoutMigrations()
 {
     $this->manager = new MigrationManager(array(), $this->versioner);
     $this->assertSame(array(), $this->manager->getKnownVersions());
 }