public function itCreatesGerritMigrationEvent() { $repository = stub('GitRepository')->getId()->returns(54); $remote_server_id = 3; $migrate_access_right = true; expect($this->system_event_manager)->createEvent(SystemEvent_GIT_GERRIT_MIGRATION::NAME, 54 . SystemEvent::PARAMETER_SEPARATOR . $remote_server_id . SystemEvent::PARAMETER_SEPARATOR . true, SystemEvent::PRIORITY_HIGH, SystemEvent::OWNER_APP)->once(); $this->git_system_event_manager->queueMigrateToGerrit($repository, $remote_server_id, $migrate_access_right); }
/** * * @param GitRepository $repository * @param int $remote_server_id the id of the server to which we want to migrate * @param Boolean $migrate_access_right if the acess right will be migrated or not * @param int $gerrit_template_id the id of template if any chosen */ public function migrateToGerrit(GitRepository $repository, $remote_server_id, $gerrit_template_id) { if ($repository->canMigrateToGerrit()) { try { $this->gerrit_server_factory->getServerById($remote_server_id); $this->git_system_event_manager->queueMigrateToGerrit($repository, $remote_server_id, $gerrit_template_id); $this->history_dao->groupAddHistory("git_repo_to_gerrit", $repository->getName(), $repository->getProjectId()); } catch (Exception $e) { $this->logger->log($e->getMessage(), Feedback::ERROR); } } }