migrate() публичный Метод

Migrates a JSON object to the given version.
public migrate ( stdClass $data, string $targetVersion )
$data stdClass The JSON object
$targetVersion string The version string
Пример #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
 public function testMigrateDoesNothingIfAlreadyCorrectVersion()
 {
     $data = (object) array();
     $this->versioner->expects($this->once())->method('parseVersion')->with($data)->willReturn('0.10');
     $this->versioner->expects($this->never())->method('updateVersion');
     $this->migration1->expects($this->never())->method('up');
     $this->migration2->expects($this->never())->method('up');
     $this->migration3->expects($this->never())->method('up');
     $this->migration1->expects($this->never())->method('down');
     $this->migration2->expects($this->never())->method('down');
     $this->migration3->expects($this->never())->method('down');
     $this->manager->migrate($data, '0.10');
 }