Skip to content
Snippets Groups Projects
Verified Commit ae62b1d5 authored by Alex Pott's avatar Alex Pott Committed by Alex Pott
Browse files

Issue #3374295 by alexpott: drush vgwort:send produces an error

parent bf31966c
No related branches found
Tags 2.0.0-beta6
No related merge requests found
......@@ -79,9 +79,16 @@ final class EntityJobMapper {
throw new \LogicException(sprintf('The revision ID must be supplied when marking %s entities as successfully sent to VG Wort', $entity_type));
}
// If the job has been created outside of the advanced queue module it will
// not have an ID. In this case assign an ID of 0 so we can still save the
// map although no job with that ID will ever exist in advanced queue. This
// allows drush to send an individual entity to VG Wort outside of the full
// queue system.
$job_id = $job->getId() === '' ? 0 : $job->getId();
$this->connection->merge(self::TABLE)
->keys(['entity_type' => $entity_type, 'entity_id' => $entity_id, 'counter_id' => $counter_id])
->fields(['revision_id' => $revision_id, 'job_id' => $job->getId(), 'success_timestamp' => $success_timestamp])
->fields(['revision_id' => $revision_id, 'job_id' => $job_id, 'success_timestamp' => $success_timestamp])
->execute();
return $this;
}
......
......@@ -140,7 +140,7 @@ class RegistrationNotificationJobTypeTest extends VgWortKernelTestBase {
->save();
$this->handler->append(new Response());
$job = RegistrationNotification::createJob($this->entity);
$job->setId('1');
$result = $this->processJob($job);
$this->assertSame(Job::STATE_SUCCESS, $result->getState());
$this->assertSame('', $result->getMessage());
......@@ -163,6 +163,7 @@ class RegistrationNotificationJobTypeTest extends VgWortKernelTestBase {
->save();
$this->handler->append(new Response());
$result = $this->processJob($job);
$this->assertSame('', $job->getId());
$this->assertSame(Job::STATE_SUCCESS, $result->getState());
/** @var \GuzzleHttp\Psr7\Request $request */
$request = $this->history[1]['request'];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment