fix url for granting access to workflow by key

This commit is contained in:
Julien Fastré 2024-11-12 17:37:53 +01:00
parent ddf73e1a48
commit bfa58177e0
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB
2 changed files with 10 additions and 3 deletions

View File

@ -4,6 +4,6 @@ Un suivi "{{ workflow.text }}" a atteint une nouvelle étape: {{ place.text }}
Vous pouvez visualiser le workflow sur cette page: Vous pouvez visualiser le workflow sur cette page:
{{ absolute_url(path('chill_main_workflow_grant_access_by_key', {'id': entity_workflow.id, '_locale': 'fr', 'accessKey': entity_workflow.currentStep.accessKey})) }} {{ absolute_url(path('chill_main_workflow_grant_access_by_key', {'id': entity_workflow.currentStep.id, '_locale': 'fr', 'accessKey': entity_workflow.currentStep.accessKey})) }}
Cordialement, Cordialement,

View File

@ -18,6 +18,7 @@ use Chill\MainBundle\Workflow\EntityWorkflowMarkingStore;
use Chill\MainBundle\Workflow\EventSubscriber\NotificationToUserGroupsOnTransition; use Chill\MainBundle\Workflow\EventSubscriber\NotificationToUserGroupsOnTransition;
use Chill\MainBundle\Workflow\Helper\MetadataExtractor; use Chill\MainBundle\Workflow\Helper\MetadataExtractor;
use Chill\MainBundle\Workflow\WorkflowTransitionContextDTO; use Chill\MainBundle\Workflow\WorkflowTransitionContextDTO;
use Doctrine\ORM\EntityManagerInterface;
use Prophecy\Argument; use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait; use Prophecy\PhpUnit\ProphecyTrait;
use Symfony\Bridge\Twig\Mime\TemplatedEmail; use Symfony\Bridge\Twig\Mime\TemplatedEmail;
@ -45,12 +46,14 @@ class NotificationToUserGroupsOnTransitionTest extends KernelTestCase
use ProphecyTrait; use ProphecyTrait;
private Environment $twig; private Environment $twig;
private BodyRendererInterface $bodyRenderer; private BodyRendererInterface $bodyRenderer;
private EntityManagerInterface $em;
protected function setUp(): void protected function setUp(): void
{ {
self::bootKernel(); self::bootKernel();
$this->twig = self::getContainer()->get('twig'); $this->twig = self::getContainer()->get('twig');
$this->bodyRenderer = self::getContainer()->get(BodyRendererInterface::class); $this->bodyRenderer = self::getContainer()->get(BodyRendererInterface::class);
$this->em = self::getContainer()->get('doctrine.orm.entity_manager');
} }
public function testOnCompletedSendNotificationToUserGroupWithEmailAddress(): void public function testOnCompletedSendNotificationToUserGroupWithEmailAddress(): void
@ -66,7 +69,11 @@ class NotificationToUserGroupsOnTransitionTest extends KernelTestCase
$ug->setEmail('test@email.com')->setLabel(['fr' => 'test group']); $ug->setEmail('test@email.com')->setLabel(['fr' => 'test group']);
$mailer = $this->prophesize(MailerInterface::class); $mailer = $this->prophesize(MailerInterface::class);
$sendMethod = $mailer->send(Argument::that(function (RawMessage $message): bool { $sendMethod = $mailer->send(Argument::that(function (RawMessage $message) use ($entityWorkflow): bool {
// we need to set an id to the current step of the entity workflow
$this->em->persist($entityWorkflow);
$this->em->persist($entityWorkflow->getCurrentStep());
if (!$message instanceof TemplatedEmail) { if (!$message instanceof TemplatedEmail) {
return false; return false;
} }
@ -111,7 +118,7 @@ class NotificationToUserGroupsOnTransitionTest extends KernelTestCase
$workflow->apply($entityWorkflow, 'to_one', ['context' => $dto, 'transition' => 'to_one', 'transitionAt' => new \DateTimeImmutable(), 'byUser' => new User()]); $workflow->apply($entityWorkflow, 'to_one', ['context' => $dto, 'transition' => 'to_one', 'transitionAt' => new \DateTimeImmutable(), 'byUser' => new User()]);
} }
public function buildRegistryWithEventSubscriber(MailerInterface $mailer, MetadataExtractor $metadataExtractor): Registry private function buildRegistryWithEventSubscriber(MailerInterface $mailer, MetadataExtractor $metadataExtractor): Registry
{ {
$builder = new DefinitionBuilder(); $builder = new DefinitionBuilder();
$builder $builder