The JSON object is expected to have the property "version" set.
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); } }
/** * @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()); }
public function testGetKnownVersionsWithoutMigrations() { $this->manager = new MigrationManager(array(), $this->versioner); $this->assertSame(array(), $this->manager->getKnownVersions()); }